google-genai 1.21.1__py3-none-any.whl → 1.23.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
google/genai/version.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
  #
15
15
 
16
- __version__ = '1.21.1' # x-release-please-version
16
+ __version__ = '1.23.0' # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-genai
3
- Version: 1.21.1
3
+ Version: 1.23.0
4
4
  Summary: GenAI Python SDK
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache-2.0
@@ -743,6 +743,53 @@ response = client.models.generate_content(
743
743
  ),
744
744
  )
745
745
  ```
746
+
747
+ #### Model Context Protocol (MCP) support (experimental)
748
+
749
+ Built-in [MCP](https://modelcontextprotocol.io/introduction) support is an
750
+ experimental feature. You can pass a local MCP server as a tool directly.
751
+
752
+ ```python
753
+ import os
754
+ import asyncio
755
+ from datetime import datetime
756
+ from mcp import ClientSession, StdioServerParameters
757
+ from mcp.client.stdio import stdio_client
758
+ from google import genai
759
+
760
+ client = genai.Client()
761
+
762
+ # Create server parameters for stdio connection
763
+ server_params = StdioServerParameters(
764
+ command="npx", # Executable
765
+ args=["-y", "@philschmid/weather-mcp"], # MCP Server
766
+ env=None, # Optional environment variables
767
+ )
768
+
769
+ async def run():
770
+ async with stdio_client(server_params) as (read, write):
771
+ async with ClientSession(read, write) as session:
772
+ # Prompt to get the weather for the current day in London.
773
+ prompt = f"What is the weather in London in {datetime.now().strftime('%Y-%m-%d')}?"
774
+
775
+ # Initialize the connection between client and server
776
+ await session.initialize()
777
+
778
+ # Send request to the model with MCP function declarations
779
+ response = await client.aio.models.generate_content(
780
+ model="gemini-2.5-flash",
781
+ contents=prompt,
782
+ config=genai.types.GenerateContentConfig(
783
+ temperature=0,
784
+ tools=[session], # uses the session, will automatically call the tool using automatic function calling
785
+ ),
786
+ )
787
+ print(response.text)
788
+
789
+ # Start the asyncio event loop and run the main function
790
+ asyncio.run(run())
791
+ ```
792
+
746
793
  ### JSON Response Schema
747
794
 
748
795
  However you define your schema, don't duplicate it in your input prompt,
@@ -1260,7 +1307,7 @@ client.
1260
1307
 
1261
1308
  ### Tune
1262
1309
 
1263
- - Vertex AI supports tuning from GCS source
1310
+ - Vertex AI supports tuning from GCS source or from a Vertex Multimodal Dataset
1264
1311
  - Gemini Developer API supports tuning from inline examples
1265
1312
 
1266
1313
  ```python
@@ -1269,10 +1316,12 @@ from google.genai import types
1269
1316
  if client.vertexai:
1270
1317
  model = 'gemini-2.0-flash-001'
1271
1318
  training_dataset = types.TuningDataset(
1319
+ # or gcs_uri=my_vertex_multimodal_dataset
1272
1320
  gcs_uri='gs://cloud-samples-data/ai-platform/generative_ai/gemini-1_5/text/sft_train_data.jsonl',
1273
1321
  )
1274
1322
  else:
1275
1323
  model = 'models/gemini-2.0-flash-001'
1324
+ # or gcs_uri=my_vertex_multimodal_dataset.resource_name
1276
1325
  training_dataset = types.TuningDataset(
1277
1326
  examples=[
1278
1327
  types.TuningExample(
@@ -1,35 +1,35 @@
1
1
  google/genai/__init__.py,sha256=SYTxz3Ho06pP2TBlvDU0FkUJz8ytbR3MgEpS9HvVYq4,709
2
2
  google/genai/_adapters.py,sha256=Kok38miNYJff2n--l0zEK_hbq0y2rWOH7k75J7SMYbQ,1744
3
- google/genai/_api_client.py,sha256=LCRuQtUd6OJs7WpvAIzw8bno7veJBFvZ1TuCeJGXMHg,49747
3
+ google/genai/_api_client.py,sha256=bbuu6LUCEf6MH-DzhEg-w7iv84SqRy5vIluXDKOn1UU,52447
4
4
  google/genai/_api_module.py,sha256=lj8eUWx8_LBGBz-49qz6_ywWm3GYp3d8Bg5JoOHbtbI,902
5
5
  google/genai/_automatic_function_calling_util.py,sha256=IJkPq2fT9pYxYm5Pbu5-e0nBoZKoZla7yT4_txWRKLs,10324
6
6
  google/genai/_base_url.py,sha256=E5H4dew14Y16qfnB3XRnjSCi19cJVlkaMNoM_8ip-PM,1597
7
- google/genai/_common.py,sha256=l9kLBg_gQibATGneHoPvsDoH-E2b5CJ6gP3q6MQ8-Ac,14962
8
- google/genai/_extra_utils.py,sha256=_w8hB9Ag7giRR94nIOBJFTLiLEufulPXkCZpJG1XY5g,19241
7
+ google/genai/_common.py,sha256=CuG7wvroFu9kV0Im-asXJGmfbaFCAjCocZyRxYDss5g,19849
8
+ google/genai/_extra_utils.py,sha256=GoIh_SxB5nf_0sjErYkjm8wdg93sfemLKrU_5QhlcBo,20562
9
9
  google/genai/_live_converters.py,sha256=lbpN5E8DjL74a2XLcgND4pzs3bHDeVpUtPDN8s7IZCU,108613
10
10
  google/genai/_mcp_utils.py,sha256=khECx-DMuHemKzOQQ3msWp7FivPeEOnl3n1lvWc_b5o,3833
11
11
  google/genai/_replay_api_client.py,sha256=0IXroewCZbyZ01qN3ZQwW5OUZRMzCrf2-3nyfTerqNY,21363
12
12
  google/genai/_test_api_client.py,sha256=4ruFIy5_1qcbKqqIBu3HSQbpSOBrxiecBtDZaTGFR1s,4797
13
13
  google/genai/_tokens_converters.py,sha256=LxLZGgSWn6VC2-1R-4ArcuaPK45svg5P-bpC1LjBb3w,48901
14
- google/genai/_transformers.py,sha256=D0oFJhVeetwnXidaI0NYXB4hiljQubbUwJXb0qDNHyY,34851
15
- google/genai/batches.py,sha256=Ykua0YpLP-FWNq7TncH123nGyL-EpZ9OS-ZJdmKf-3c,34631
16
- google/genai/caches.py,sha256=dNP2RC-52Er-JvOoimGoIgvvcATZJUvJNTRSA6jskBM,65901
14
+ google/genai/_transformers.py,sha256=Nd_h_zYVOkWN1XTSnM9r3IR7R_qg3tPe2mE9jozaX-Q,36935
15
+ google/genai/batches.py,sha256=ZpF3qgJUkPcpWjbaJtESiQq5qiZ0obsJl77yCtgZknA,170525
16
+ google/genai/caches.py,sha256=Ckqqi0osoxNmkqYGvBGpvrZUx19D6hmuwS9UXcnGWmk,65911
17
17
  google/genai/chats.py,sha256=0QdOUeWEYDQgAWBy1f7a3z3yY9S8tXSowUzNrzazzj4,16651
18
18
  google/genai/client.py,sha256=wXnfZBSv9p-yKtX_gabUrfBXoYHuqHhzK_VgwRttMgY,10777
19
19
  google/genai/errors.py,sha256=UebysH1cDeIdtp1O06CW7lQjnNrWtuqZTeVgEJylX48,5589
20
- google/genai/files.py,sha256=08M3PxoJ3RxomDopfyKYP-pSxEEbQr60-XgohDdg_T0,39647
21
- google/genai/live.py,sha256=gORtkDEG_-IY9-50HHKkMckOUOp-YzO2Ye3oPgblRiI,39016
20
+ google/genai/files.py,sha256=MCcHRXiMFKjbnt78yVPejszEgGz_MHRXfJyDi5-07Gs,39655
21
+ google/genai/live.py,sha256=8Vts1bX8ZWOa0PiS3zmYhG1QMhLtBPC_ATLTSAIrazs,38945
22
22
  google/genai/live_music.py,sha256=3GG9nsto8Vhkohcs-4CPMS4DFp1ZtMuLYzHfvEPYAeg,6971
23
- google/genai/models.py,sha256=qScVQWW6KSqvlNLE3Y7qNKx-DHOMQLwRPUhdyMewvpw,236500
24
- google/genai/operations.py,sha256=4gSKgJ-2tISwd3O5S8Y7oNe5ue01S9Zejr6WvYNLPJM,19605
23
+ google/genai/models.py,sha256=7gBXwg6_RdW_HRD_iRFIAdqu0bkUkW0fAp_PMEPVwoU,239309
24
+ google/genai/operations.py,sha256=99zs__fTWsyQu7rMGmBI1_4tuAJxLR0g3yp7ymsUsBA,19609
25
25
  google/genai/pagers.py,sha256=nyVYxp92rS-UaewO_oBgP593knofeLU6yOn6RolNoGQ,6797
26
26
  google/genai/py.typed,sha256=RsMFoLwBkAvY05t6izop4UHZtqOPLiKp3GkIEizzmQY,40
27
27
  google/genai/tokens.py,sha256=oew9I0fGuGLlXMdCn2Ot9Lv_herHMnvZOYjjdOz2CAM,12324
28
- google/genai/tunings.py,sha256=6rdzZwh15Ievj7pg6wA7JI1SkjIvORogeZBT9wr0FUM,48295
29
- google/genai/types.py,sha256=23t4YZB1cLZBJ9iWOjF37Fm997ZtRBoTxAxLpTpDkE8,449073
30
- google/genai/version.py,sha256=6p_TDljUWRMSW0wvtrkBQzXvlcWur4r3euI17pCmG1Q,627
31
- google_genai-1.21.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
32
- google_genai-1.21.1.dist-info/METADATA,sha256=T3WBq3x4T82dc8MUId1hSdJmO7EXtoilHqKPi5SVXYo,37123
33
- google_genai-1.21.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
- google_genai-1.21.1.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
35
- google_genai-1.21.1.dist-info/RECORD,,
28
+ google/genai/tunings.py,sha256=u6Hcfkc-nUYB_spSfY98h7EIiSz0dH3wVH0b2feMh1M,49072
29
+ google/genai/types.py,sha256=LGLNmXkmnCLU-narShhG_1rtglfARNm6pvvZOiO5_lA,460023
30
+ google/genai/version.py,sha256=Snuhu088Fxuibck04VaPaZ69LvJ5pKNdicb9oZYwcrY,627
31
+ google_genai-1.23.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
32
+ google_genai-1.23.0.dist-info/METADATA,sha256=Yylx0cTXrq87K2-VIbM9e1RT80LHMcvUC5ZB8Y0YTqc,38902
33
+ google_genai-1.23.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
+ google_genai-1.23.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
35
+ google_genai-1.23.0.dist-info/RECORD,,