From a94dc6ee444e8a3160c40bfddb0a47212c27dd44 Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:42:35 -0700 Subject: [PATCH] model garden nit (#10194) --- .../llms/google_vertex_ai_palm.ipynb | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/docs/extras/integrations/llms/google_vertex_ai_palm.ipynb b/docs/extras/integrations/llms/google_vertex_ai_palm.ipynb index e0bbd87a70..cff7d9bdd0 100644 --- a/docs/extras/integrations/llms/google_vertex_ai_palm.ipynb +++ b/docs/extras/integrations/llms/google_vertex_ai_palm.ipynb @@ -236,7 +236,7 @@ "metadata": {}, "outputs": [], "source": [ - "llm_oss = VertexAIModelGarden(\n", + "llm = VertexAIModelGarden(\n", " project=\"YOUR PROJECT\",\n", " endpoint_id=\"YOUR ENDPOINT_ID\"\n", ")" @@ -248,14 +248,25 @@ "metadata": {}, "outputs": [], "source": [ - "llm_oss(\"What is the meaning of life?\")" + "llm(\"What is the meaning of life?\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "You can also use it as a chain:" + "Like all LLMs, we can then compose it with other components:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.prompts import PromptTemplate\n", + "\n", + "prompt = PromptTemplate.from_template(\"What is the meaning of {thing}?\")" ] }, { @@ -264,17 +275,17 @@ "metadata": {}, "outputs": [], "source": [ - "llm_oss_chain = LLMChain(prompt=prompt, llm=llm_oss(\"What is the meaning of life?\")\n", - ")\n", - "llm_oss_chain.run(question)" + "llm_oss_chain = prompt | llm\n", + "\n", + "llm_oss_chain.invoke({\"thing\": \"life\"})" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "poetry-venv", "language": "python", - "name": "python3" + "name": "poetry-venv" }, "language_info": { "codemirror_mode": { @@ -286,7 +297,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.9.1" }, "vscode": { "interpreter": {