Skip to content

Commit 8db16b5

Browse files
authored
fix: use new Google model names in examples (#32288)
1 parent 6f10160 commit 8db16b5

File tree

15 files changed

+308
-354
lines changed

15 files changed

+308
-354
lines changed

cookbook/Multi_modal_RAG_google.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
},
145145
{
146146
"cell_type": "code",
147-
"execution_count": 4,
147+
"execution_count": null,
148148
"id": "kWDWfSDBMPl8",
149149
"metadata": {},
150150
"outputs": [
@@ -185,7 +185,7 @@
185185
" )\n",
186186
" # Text summary chain\n",
187187
" model = VertexAI(\n",
188-
" temperature=0, model_name=\"gemini-2.0-flash-lite-001\", max_tokens=1024\n",
188+
" temperature=0, model_name=\"gemini-2.5-flash\", max_tokens=1024\n",
189189
" ).with_fallbacks([empty_response])\n",
190190
" summarize_chain = {\"element\": lambda x: x} | prompt | model | StrOutputParser()\n",
191191
"\n",
@@ -235,7 +235,7 @@
235235
},
236236
{
237237
"cell_type": "code",
238-
"execution_count": 6,
238+
"execution_count": null,
239239
"id": "PeK9bzXv3olF",
240240
"metadata": {},
241241
"outputs": [],
@@ -254,7 +254,7 @@
254254
"\n",
255255
"def image_summarize(img_base64, prompt):\n",
256256
" \"\"\"Make image summary\"\"\"\n",
257-
" model = ChatVertexAI(model=\"gemini-2.0-flash\", max_tokens=1024)\n",
257+
" model = ChatVertexAI(model=\"gemini-2.5-flash\", max_tokens=1024)\n",
258258
"\n",
259259
" msg = model.invoke(\n",
260260
" [\n",
@@ -431,7 +431,7 @@
431431
},
432432
{
433433
"cell_type": "code",
434-
"execution_count": 9,
434+
"execution_count": null,
435435
"id": "GlwCErBaCKQW",
436436
"metadata": {},
437437
"outputs": [],
@@ -553,7 +553,7 @@
553553
" \"\"\"\n",
554554
"\n",
555555
" # Multi-modal LLM\n",
556-
" model = ChatVertexAI(temperature=0, model_name=\"gemini-2.0-flash\", max_tokens=1024)\n",
556+
" model = ChatVertexAI(temperature=0, model_name=\"gemini-2.5-flash\", max_tokens=1024)\n",
557557
"\n",
558558
" # RAG pipeline\n",
559559
" chain = (\n",

docs/docs/how_to/multimodal_inputs.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@
373373
},
374374
{
375375
"cell_type": "code",
376-
"execution_count": 2,
376+
"execution_count": null,
377377
"id": "a0b91b29-dbd6-4c94-8f24-05471adc7598",
378378
"metadata": {},
379379
"outputs": [
@@ -397,7 +397,7 @@
397397
"\n",
398398
"\n",
399399
"# Pass to LLM\n",
400-
"llm = init_chat_model(\"google_genai:gemini-2.0-flash-001\")\n",
400+
"llm = init_chat_model(\"google_genai:gemini-2.5-flash\")\n",
401401
"\n",
402402
"message = {\n",
403403
" \"role\": \"user\",\n",

docs/docs/how_to/response_metadata.ipynb

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
{
2424
"data": {
2525
"text/plain": [
26-
"{'token_usage': {'completion_tokens': 93,\n",
26+
"{'token_usage': {'completion_tokens': 88,\n",
2727
" 'prompt_tokens': 16,\n",
28-
" 'total_tokens': 109,\n",
28+
" 'total_tokens': 104,\n",
2929
" 'completion_tokens_details': {'accepted_prediction_tokens': 0,\n",
3030
" 'audio_tokens': 0,\n",
3131
" 'reasoning_tokens': 0,\n",
3232
" 'rejected_prediction_tokens': 0},\n",
3333
" 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}},\n",
3434
" 'model_name': 'gpt-4o-mini-2024-07-18',\n",
3535
" 'system_fingerprint': 'fp_34a54ae93c',\n",
36-
" 'id': 'chatcmpl-ByJtse6I3U1lmVyPscLCjzydCvfDO',\n",
36+
" 'id': 'chatcmpl-ByN1Qkvqb5fAGKKzXXxZ3rBlnqkWs',\n",
3737
" 'service_tier': 'default',\n",
3838
" 'finish_reason': 'stop',\n",
3939
" 'logprobs': None}"
@@ -69,14 +69,14 @@
6969
{
7070
"data": {
7171
"text/plain": [
72-
"{'id': 'msg_017S9H7GMwA5RdZ1wHxzXoeX',\n",
72+
"{'id': 'msg_01NTWnqvbNKSjGfqQL7xikau',\n",
7373
" 'model': 'claude-3-7-sonnet-20250219',\n",
7474
" 'stop_reason': 'end_turn',\n",
7575
" 'stop_sequence': None,\n",
7676
" 'usage': {'cache_creation_input_tokens': 0,\n",
7777
" 'cache_read_input_tokens': 0,\n",
7878
" 'input_tokens': 17,\n",
79-
" 'output_tokens': 180,\n",
79+
" 'output_tokens': 197,\n",
8080
" 'server_tool_use': None,\n",
8181
" 'service_tier': 'standard'},\n",
8282
" 'model_name': 'claude-3-7-sonnet-20250219'}"
@@ -100,30 +100,22 @@
100100
"id": "c1f24f69-18f6-43c1-8b26-3f88ec515259",
101101
"metadata": {},
102102
"source": [
103-
"## Google VertexAI"
103+
"## Google Generative AI"
104104
]
105105
},
106106
{
107107
"cell_type": "code",
108-
"execution_count": 1,
108+
"execution_count": null,
109109
"id": "39549336-25f5-4839-9846-f687cd77e59b",
110110
"metadata": {},
111111
"outputs": [
112112
{
113113
"data": {
114114
"text/plain": [
115-
"{'is_blocked': False,\n",
116-
" 'safety_ratings': [],\n",
117-
" 'usage_metadata': {'prompt_token_count': 10,\n",
118-
" 'candidates_token_count': 55,\n",
119-
" 'total_token_count': 65,\n",
120-
" 'prompt_tokens_details': [{'modality': 1, 'token_count': 10}],\n",
121-
" 'candidates_tokens_details': [{'modality': 1, 'token_count': 55}],\n",
122-
" 'cached_content_token_count': 0,\n",
123-
" 'cache_tokens_details': []},\n",
115+
"{'prompt_feedback': {'block_reason': 0, 'safety_ratings': []},\n",
124116
" 'finish_reason': 'STOP',\n",
125-
" 'avg_logprobs': -0.251378042047674,\n",
126-
" 'model_name': 'gemini-2.0-flash-001'}"
117+
" 'model_name': 'gemini-2.5-flash',\n",
118+
" 'safety_ratings': []}"
127119
]
128120
},
129121
"execution_count": 1,
@@ -132,9 +124,9 @@
132124
}
133125
],
134126
"source": [
135-
"from langchain_google_vertexai import ChatVertexAI\n",
127+
"from langchain_google_genai import ChatGoogleGenerativeAI\n",
136128
"\n",
137-
"llm = ChatVertexAI(model=\"gemini-2.0-flash-001\")\n",
129+
"llm = ChatGoogleGenerativeAI(model=\"gemini-2.5-flash\")\n",
138130
"msg = llm.invoke(\"What's the oldest known example of cuneiform\")\n",
139131
"msg.response_metadata"
140132
]
@@ -199,14 +191,14 @@
199191
"data": {
200192
"text/plain": [
201193
"{'token_usage': {'prompt_tokens': 13,\n",
202-
" 'total_tokens': 219,\n",
203-
" 'completion_tokens': 206},\n",
194+
" 'total_tokens': 306,\n",
195+
" 'completion_tokens': 293},\n",
204196
" 'model_name': 'mistral-small-latest',\n",
205197
" 'model': 'mistral-small-latest',\n",
206198
" 'finish_reason': 'stop'}"
207199
]
208200
},
209-
"execution_count": 5,
201+
"execution_count": 9,
210202
"metadata": {},
211203
"output_type": "execute_result"
212204
}

docs/docs/integrations/chat/google_generative_ai.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"\n",
2020
"Access Google's Generative AI models, including the Gemini family, directly via the Gemini API or experiment rapidly using Google AI Studio. The `langchain-google-genai` package provides the LangChain integration for these models. This is often the best starting point for individual developers.\n",
2121
"\n",
22-
"For information on the latest models, their features, context windows, etc. head to the [Google AI docs](https://ai.google.dev/gemini-api/docs/models/gemini). All examples use the `gemini-2.0-flash` model. Gemini 2.5 Pro and 2.5 Flash can be used via `gemini-2.5-pro-preview-03-25` and `gemini-2.5-flash-preview-04-17`. All model ids can be found in the [Gemini API docs](https://ai.google.dev/gemini-api/docs/models).\n",
22+
"For information on the latest models, their features, context windows, etc. head to the [Google AI docs](https://ai.google.dev/gemini-api/docs/models/gemini). All model ids can be found in the [Gemini API docs](https://ai.google.dev/gemini-api/docs/models).\n",
2323
"\n",
2424
"### Integration details\n",
2525
"\n",
@@ -117,7 +117,7 @@
117117
"from langchain_google_genai import ChatGoogleGenerativeAI\n",
118118
"\n",
119119
"llm = ChatGoogleGenerativeAI(\n",
120-
" model=\"gemini-2.0-flash\",\n",
120+
" model=\"gemini-2.5-flash\",\n",
121121
" temperature=0,\n",
122122
" max_tokens=None,\n",
123123
" timeout=None,\n",
@@ -242,7 +242,7 @@
242242
"\n",
243243
"### Image Input\n",
244244
"\n",
245-
"Provide image inputs along with text using a `HumanMessage` with a list content format. The `gemini-2.0-flash` model can handle images."
245+
"Provide image inputs along with text using a `HumanMessage` with a list content format. Make sure to use a model that supports image input, such as `gemini-2.5-flash`."
246246
]
247247
},
248248
{
@@ -297,7 +297,7 @@
297297
"\n",
298298
"### Audio Input\n",
299299
"\n",
300-
"Provide audio file inputs along with text. Use a model like `gemini-2.0-flash`."
300+
"Provide audio file inputs along with text."
301301
]
302302
},
303303
{
@@ -340,7 +340,7 @@
340340
"source": [
341341
"### Video Input\n",
342342
"\n",
343-
"Provide video file inputs along with text. Use a model like `gemini-2.0-flash`."
343+
"Provide video file inputs along with text."
344344
]
345345
},
346346
{
@@ -384,7 +384,7 @@
384384
"source": [
385385
"### Image Generation (Multimodal Output)\n",
386386
"\n",
387-
"The `gemini-2.0-flash` model can generate text and images inline (image generation is experimental). You need to specify the desired `response_modalities`."
387+
"Certain models (such as `gemini-2.0-flash-preview-image-generation`) can generate text and images inline. You need to specify the desired `response_modalities`. See more information on the [Gemini API docs](https://ai.google.dev/gemini-api/docs/image-generation) for details."
388388
]
389389
},
390390
{
@@ -830,7 +830,7 @@
830830
"source": [
831831
"from langchain_google_genai import ChatGoogleGenerativeAI\n",
832832
"\n",
833-
"llm = ChatGoogleGenerativeAI(model=\"gemini-2.0-flash\")\n",
833+
"llm = ChatGoogleGenerativeAI(model=\"gemini-2.5-flash\")\n",
834834
"\n",
835835
"\n",
836836
"async def run_async_calls():\n",
@@ -900,7 +900,7 @@
900900
"source": [
901901
"## API reference\n",
902902
"\n",
903-
"For detailed documentation of all ChatGoogleGenerativeAI features and configurations head to the API reference: https://python.langchain.com/api_reference/google_genai/chat_models/langchain_google_genai.chat_models.ChatGoogleGenerativeAI.html"
903+
"For detailed documentation of all ChatGoogleGenerativeAI features and configurations head to the [API reference](https://python.langchain.com/api_reference/google_genai/chat_models/langchain_google_genai.chat_models.ChatGoogleGenerativeAI.html)."
904904
]
905905
}
906906
],

docs/docs/integrations/chat/google_vertex_ai_palm.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"\n",
2020
"This page provides a quick overview for getting started with VertexAI [chat models](/docs/concepts/chat_models). For detailed documentation of all ChatVertexAI features and configurations head to the [API reference](https://python.langchain.com/api_reference/google_vertexai/chat_models/langchain_google_vertexai.chat_models.ChatVertexAI.html).\n",
2121
"\n",
22-
"ChatVertexAI exposes all foundational models available in Google Cloud, like `gemini-1.5-pro`, `gemini-1.5-flash`, etc. For a full and updated list of available models visit [VertexAI documentation](https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/overview).\n",
22+
"ChatVertexAI exposes all foundational models available in Google Cloud, like `gemini-2.5-pro`, `gemini-2.5-flash`, etc. For a full and updated list of available models visit [VertexAI documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/models).\n",
2323
"\n",
2424
":::info Google Cloud VertexAI vs Google PaLM\n",
2525
"\n",
@@ -60,7 +60,7 @@
6060
},
6161
{
6262
"cell_type": "code",
63-
"execution_count": 1,
63+
"execution_count": null,
6464
"id": "a15d341e-3e26-4ca3-830b-5aab30ed66de",
6565
"metadata": {},
6666
"outputs": [],
@@ -109,15 +109,15 @@
109109
},
110110
{
111111
"cell_type": "code",
112-
"execution_count": 3,
112+
"execution_count": null,
113113
"id": "cb09c344-1836-4e0c-acf8-11d13ac1dbae",
114114
"metadata": {},
115115
"outputs": [],
116116
"source": [
117117
"from langchain_google_vertexai import ChatVertexAI\n",
118118
"\n",
119119
"llm = ChatVertexAI(\n",
120-
" model=\"gemini-1.5-flash-001\",\n",
120+
" model=\"gemini-2.5-flash\",\n",
121121
" temperature=0,\n",
122122
" max_tokens=None,\n",
123123
" max_retries=6,\n",
@@ -210,7 +210,7 @@
210210
"source": [
211211
"from langchain_google_vertexai import ChatVertexAI\n",
212212
"\n",
213-
"llm = ChatVertexAI(model=\"gemini-2.0-flash-001\").bind_tools([{\"google_search\": {}}])\n",
213+
"llm = ChatVertexAI(model=\"gemini-2.5-flash\").bind_tools([{\"google_search\": {}}])\n",
214214
"\n",
215215
"response = llm.invoke(\"What is today's news?\")"
216216
]
@@ -237,7 +237,7 @@
237237
"source": [
238238
"from langchain_google_vertexai import ChatVertexAI\n",
239239
"\n",
240-
"llm = ChatVertexAI(model=\"gemini-2.0-flash-001\").bind_tools([{\"code_execution\": {}}])\n",
240+
"llm = ChatVertexAI(model=\"gemini-2.5-flash\").bind_tools([{\"code_execution\": {}}])\n",
241241
"\n",
242242
"response = llm.invoke(\"What is 3^3?\")"
243243
]

0 commit comments

Comments
 (0)