|
|
|
@ -114,7 +114,7 @@
|
|
|
|
|
"human = \"Translate this sentence from English to French. I love programming.\"\n",
|
|
|
|
|
"prompt = ChatPromptTemplate.from_messages([(\"system\", system), (\"human\", human)])\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"chat = ChatVertexAI(model_name=\"gemini-pro\", convert_system_message_to_human=True)\n",
|
|
|
|
|
"chat = ChatVertexAI(model=\"gemini-pro\", convert_system_message_to_human=True)\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"chain = prompt | chat\n",
|
|
|
|
|
"chain.invoke({})"
|
|
|
|
@ -233,9 +233,7 @@
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"chat = ChatVertexAI(\n",
|
|
|
|
|
" model_name=\"codechat-bison\", max_output_tokens=1000, temperature=0.5\n",
|
|
|
|
|
")\n",
|
|
|
|
|
"chat = ChatVertexAI(model=\"codechat-bison\", max_tokens=1000, temperature=0.5)\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"message = chat.invoke(\"Write a Python function generating all prime numbers\")\n",
|
|
|
|
|
"print(message.content)"
|
|
|
|
@ -399,7 +397,7 @@
|
|
|
|
|
" location: str = Field(..., description=\"The city and state, e.g. San Francisco, CA\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"llm = ChatVertexAI(model_name=\"gemini-pro\", temperature=0)\n",
|
|
|
|
|
"llm = ChatVertexAI(model=\"gemini-pro\", temperature=0)\n",
|
|
|
|
|
"llm_with_tools = llm.bind_tools([GetWeather])\n",
|
|
|
|
|
"ai_msg = llm_with_tools.invoke(\n",
|
|
|
|
|
" \"what is the weather like in San Francisco\",\n",
|
|
|
|
@ -551,7 +549,7 @@
|
|
|
|
|
"human = \"{text}\"\n",
|
|
|
|
|
"prompt = ChatPromptTemplate.from_messages([(\"system\", system), (\"human\", human)])\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"chat = ChatVertexAI(model_name=\"chat-bison\", max_output_tokens=1000, temperature=0.5)\n",
|
|
|
|
|
"chat = ChatVertexAI(model=\"chat-bison\", max_tokens=1000, temperature=0.5)\n",
|
|
|
|
|
"chain = prompt | chat\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"asyncio.run(\n",
|
|
|
|
|