1、探索 MakerSuite 与 PaLM API解锁大语言模型的力量江骏Google Developer Expert(Machine Learning)字节跳动 火山引擎上海 ShanghaiGeminiGemini with BardEnglish OnlyWhat Well Cover TodayWhats a LLM?01Prototyping:Intro to MakerSuite LLMs for Chat02Moving to code:Intro to the PaLM APIPaLM for TextPaLM for ChatPaLM for Embeddings03Gett
2、ing Hands On:Building with MakerSuite&PaLM API04.What is an LLM?0.020.030.90.010.0LLMs ExplainedDogsRainDropsFishWindandcatsrainingItsRoses are red,Violets are blue,Sugar is sweet,LLMs ExplainedRoses are red,Violets are blue,Sugar is sweet,LLMs Explainedfor(var i=0;i 10;i+)for(var i=0;i 10;i+)Modern
3、 LLMs arelarge.Classic Natural Language Problems LLMs ExplainedEntity extractionClassificationSummarizationSentiment AnalysisTranslationExplain this joke:“I used to be addicted to soap,but Im clean now.”Model:The joke is a pun on the word clean.It has two meanings:Model:User:The joke is funny becaus
4、e it is unexpected.The listener expects the speaker to be talking about the first meaning of clean,but they are actually talking about the second meaning.This creates a surprise and a laugh.To be free of dirt or other unwanted substances.To be free of addiction.LLMs ExplainedModel:1.*Build a volcano
5、.*This is a classic science fair project that is both fun and educational.You can learn about the science of volcanoes,earthquakes,and plate tectonics.2.*Make a solar oven.*This is a great project to learn about renewable energy and how to harness the power of the sun.You can use your solar oven to
6、cook food,dry fruit,or even melt chocolate.3.*Create a 3D printer.*This is a more challenging project,but it is also very rewarding.You can learn about 3D printing technology and design your own custom objects.4.*Build a robot.*This is a great project for those who are interested in engineering and
7、robotics.You can learn about basic electronics,mechanics,and programming.5.*Design a water filtration system.*This is a project that can help you learn about the importance of clean water and how to filter it.You can use your water filtration system to clean water from a stream or river.LLMs Explain
8、edGive me five neat ideas for science fair projects.User:LLMs let us prototype fast.LLMs ExplainedPrototyping in the Browser:Intro to MakerSuiteMakerSuiteMakerSuiteGlobal AvailabilityMakerSuite and the PaLM API are now available in 180 countries in us-en only.Workspace SupportMakerSuite and the PaLM
9、 API are now available to Workspace accounts.Previously was on gmail accounts.ProdApps can now be taken to prod in supported countries.Whats new since Google I/O?Visit https:/ art and science of writing input text to guide an LLM to generate the kind of output you want.*AKA Prompt Design*AKA Prompti
10、ngPrompt EngineeringMakerSuiteVisit https:/ method for using LLMs to generate training data.Synthetic Data GenerationMakerSuiteLLMs for ChatVisit https:/ of a Conversation“Act like a kindergarten teacher and explain complicated topics like Im five.”“Whats quantum physics?”“Quantum physics is”“But I
11、dont get it!Whats an atom?”“An atom is”ContextUser messageModel responseUser messageModel responseConversation HistoryLLMs for ChatLLM-Powered Chat ApplicationsCustomer servicePersonal assistantsInteractive storytellingConversational product recommenderCustomer feedback collection.A lot more LLMs fo
12、r ChatGemini with MakerSuite(Leak?)Get Started with the PaLM APIEditable LocationGetting started with three examplesChat with an alienTalk to documentsReverse dictionaryGet Started with the PaLM APIREST APIClient libraries for Python,Node,Java,and SwiftGet Started with the PaLM APIChat endpointBest
13、for interactive applications Embeddings endpointDevelop new applications Text endpointBest for short interactions Chat with an alienTalk to documentsReverse dictionaryGet Started with the PaLM APIGet Started with the PaLM APIGet Started with the PaLM APIPaLM API for TextEditable Locationpip install
14、google-generativeaiimport google.generativeai as palmpalm.configure(“Your API Key”)Treat your API key like apasswordfor model in palm.list_models():if generateText in model.supported_generation_methods:print(model)#Outputtext-bison-001prompt=“”This is a reverse dictionary.Describe a word or concept
15、and this will help you find the term you are looking for.Description:A moment in a game where no one can win and you get caught in an endless loop.Word:Stalemate Description:Fear of running out of something to read.Word:AbibliophobiaDescription:A type of vehicle that goes under the water.Word:”compl
16、etion=palm.generate_text(model=text-bison-001,prompt=prompt)print(completion.result)#OutputSubmarinecompletion=palm.generate_text(model=text-bison-001,prompt=prompt,temperature=0.2)PaLM API for ChatBest for iterative applicationsEditable Locationresponse=palm.chat(messages=Hello!)print(response.last
17、)#Hello!How can I help you today?context=Be an alien that lives on one of Jupiters moonsexamples=#Example user input(Hows it going?,#Example model responseI am doing well,thank you for asking.I am currently enjoying the beautiful view of Jupiter from my home on Europa.The atmosphere is very thin her
18、e,so I can see the stars very clearly.The surface of Europa is also very interesting.It is covered in ice,but there are cracks in the ice that reveal a liquid ocean below.Scientists believe that this ocean may contain life,so I am very excited to learn more about it.How are you doing today?)response
19、=palm.chat(context=context,examples=examples,messages=Id like to visit,what should I do?)print(response.messages)#Outputauthor:0,content:Id like to visit,what should I do?,author:1,content:You should visit the Great Red Spot,its an enormous storm that has been raging for hundreds of years.It is larg
20、er than the Earth and it is the most gigantic storm in the solar system.There are also a lot of very interesting species of animals that I am sure you would be fascinated by.print(response.last)#OutputYou should visit the Great Red Spot,its an enormous storm that has been raging for hundreds of year
21、s.It is larger than the Earth and it is the most gigantic storm in the solar system.There are also a lot of very interesting species of animals that I am sure you would be fascinated by.response.reply(Whats the weather like?)print(response.last)#OutputIt is very cold,but the atmosphere is very thin,
22、so it doesnt feel as cold as it actually is.The temperature is around-150 degrees Celsius.PaLM API for EmbeddingsEditable LocationEmbeddings EndpointConvert text into a list of numbers computers can understandSimilar text will have similar embeddingsYou can use these to develop applications,like sea
23、rch!What is an embedding?A vector representation of a conceptKnowledge BasePromptWhats the latest version of TensorFlow?PaLM APIEmbeddings EndpointRetrieve embeddings for the question and for the pageFind the section most likely to contain the answerUse the Text endpoint to answer the question.Workf
24、low010203Embeddings Endpointembedding=palm.generate_embeddings(text=Create production-grade machine learning models withTensorFlow)#Outputembedding:-0.025894878,-0.02103396,.embedding=palm.generate_embeddings(text=What is the latest version of TensorFlow?)You are a helpful and informative bot that a
25、nswers questions using text from the reference passage included below.Be sure to respond in a complete sentence,being comprehensive,including all relevant background information.However,you are talking to a non-technical audience,so be sure to break down complicated concepts and strike a friendly an
26、d conversational tone.If the passage is irrelevant to the answer,you may ignore it.PromptEmbeddings EndpointQUESTION:PASSAGE:ANSWER:Retrieve embeddings with the PaLM API for your training and test setReuse the knowledge learned by an LLMTrain an open-source modelEmbeddings EndpointUse-casesEmbeddings EndpointRecommendationsQuestion answeringInformational retrievalGetting Hands-On:Building with MakerSuite and the PaLM APIResponsible AILets Start Building!Go to https:/ moreThank You江骏Google Developer Expert(Machine Learning)|ohmystack