@devries-cameron20 / composio Mirror · read-only / commits / 183a274d9
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 18:30 UTC

docs: fix Gemini Python example to use composio_gemini with google-genai (#3839)

## Summary The Gemini Python example paired composio_google (which wraps tools as VertexAI FunctionDeclaration objects) with google-genai client. GenerateContentConfig silently coerces those VertexAI objects into an empty genai Tool ({}), so the documented flow sends requests with no tool schemas at all - the model never sees or calls any Composio tool, with no error surfaced anywhere. Fixes #3836 ## Changes - docs/content/docs/providers/google.mdx (Gemini tab, Python only): - install line: composio_google → composio_gemini - example: GeminiProvider + Automatic Function Calling; the manual while response.function_calls: loop is gone because the google-genai SDK executes the wrapped callables itself - intro paragraph updated to describe the Python (AFC) and TypeScript (manual loop) flows separately The TypeScript tab and the Google ADK section are untouched; both already target the right SDKs. The new Python example matches the existing quickstart in python/providers/gemini/README.md. ## Type of change - [ ] Bug fix - [ ] New feature - [ ] Refactor/Chore - [x] Documentation - [ ] Breaking change ## How Has This Been Tested? - Offline repro of the bug (issue #3836): with composio_google, config.tools[0].model_dump(exclude_none=True) is {} and genai's _transformers.t_tools raises AttributeError on the vertexai type. - Offline verification of the fix: the exact construction path of the new example (GeminiProvider().wrap_tools → GenerateContentConfig → chats.create → t_tools) serializes a complete FunctionDeclaration (name, description, parameters) with composio==0.17.1, google-genai==2.11.0, Python 3.12. - Docs: bun run build and bun run lint:links from docs/: green. ## Screenshots (if applicable) ## Checklist - [x] I have read the Code of Conduct, and this PR adheres to it - [x] I ran linters/tests locally, and they passed - [x] I updated documentation as needed - [x] I added tests or explain why not applicable - [x] I added a changeset if this change affects published packages ## Additional context No changeset: docs-only change, no published package affected. Regression coverage: `docs/tests/static/content.test.ts` now guards the documented `composio_gemini` + `google-genai` pairing; the example's construction path was also exercised offline as described above. The underlying provider split (composio_google targeting the upstream-deprecated vertexai generative_models SDK vs composio_gemini targeting google-genai) is flagged in #3836 as an open question for maintainers; this PR is the docs-only fix. --------- Co-authored-by: jkomyno <alberto@composio.dev>

Aditya Painuli committed Jul 15, 2026 at 17:08 UTC 183a274d9950cb6d969c23b8a434c8a2615a7758
2 files changed +22 -13
docs/content/docs/providers/google.mdx
+8 -13
@@ -13,7 +13,7 @@ The Google provider formats Composio tools for [Gemini](https://ai.google.dev/)
13
14 <IntegrationContent value="gemini">
15
16 -The Google Generative AI provider transforms Composio tools into Gemini function declarations. Gemini is non-agentic, so the model returns function calls and you run the loop: execute each call with `composio.provider.executeToolCall`, feed the result back, and repeat until the model replies with text.
16 +In Python, the Gemini provider (`composio_gemini`) wraps Composio tools as typed callables, and the `google-genai` SDK's Automatic Function Calling executes tool calls inside the chat loop for you. In TypeScript, the Google provider transforms Composio tools into Gemini function declarations, and you run the loop: execute each call with `composio.provider.executeToolCall`, feed the result back, and repeat until the model replies with text.
17
18 <Steps>
19 <Step>
@@ -21,7 +21,7 @@ The Google Generative AI provider transforms Composio tools into Gemini function
21
22 <Tabs groupId="language" items={["Python", "TypeScript"]} persist>
23 <Tab value="Python">
24 -<PackageInstall ecosystem="python" packages="composio composio_google google-genai" />
24 +<PackageInstall ecosystem="python" packages="composio composio_gemini google-genai" />
25 </Tab>
26 <Tab value="TypeScript">
27 <PackageInstall packages="@composio/core @composio/google @google/genai" />
@@ -49,11 +49,11 @@ GOOGLE_API_KEY=xxxxxxxxx
49 <Tab value="Python">
50 ```python
51 from composio import Composio
52 -from composio_google import GoogleProvider
52 +from composio_gemini import GeminiProvider
53 from google import genai
54 from google.genai import types
55
56 -composio = Composio(provider=GoogleProvider())
56 +composio = Composio(provider=GeminiProvider())
57 client = genai.Client()
58
59 # Create a session for your user
@@ -62,16 +62,11 @@ tools = session.tools()
62
63 config = types.GenerateContentConfig(tools=tools)
64 chat = client.chats.create(model="gemini-3-pro-preview", config=config)
65 -response = chat.send_message("Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'")
66 -
67 -# Agentic loop: keep executing tool calls until the model responds with text
68 -while response.function_calls:
69 - parts = []
70 - for fc in response.function_calls:
71 - result = composio.provider.execute_tool_call(user_id="user_123", function_call=fc)
72 - parts.append(types.Part.from_function_response(name=fc.name, response=result))
73 - response = chat.send_message(parts)
65
66 +# Automatic Function Calling executes tool calls inside the chat loop
67 +response = chat.send_message(
68 + "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"
69 +)
70 print(response.text)
71 ```
72 </Tab>
docs/tests/static/content.test.ts
+14
@@ -11,6 +11,7 @@ import { join, relative } from "path";
11 const DOCS_DIR = join(import.meta.dir, "../../content/docs");
12 const EXAMPLES_DIR = join(import.meta.dir, "../../content/examples");
13 const CHANGELOG_DIR = join(import.meta.dir, "../../content/changelog");
14 +const GOOGLE_PROVIDER_DOC = join(DOCS_DIR, "providers/google.mdx");
15
16 /** Recursively find all .mdx files */
17 async function findMdxFiles(dir: string): Promise<string[]> {
@@ -100,6 +101,19 @@ describe("Content - no empty pages", () => {
101 });
102 });
103
104 +describe("Content - provider compatibility", () => {
105 + test("Gemini Python docs use the google-genai-compatible provider", async () => {
106 + const content = await readFile(GOOGLE_PROVIDER_DOC, "utf-8");
107 +
108 + expect(content).toContain(
109 + '<PackageInstall ecosystem="python" packages="composio composio_gemini google-genai" />',
110 + );
111 + expect(content).toContain("from composio_gemini import GeminiProvider");
112 + expect(content).toContain("Composio(provider=GeminiProvider())");
113 + expect(content).not.toContain("composio_google google-genai");
114 + });
115 +});
116 +
117 describe("Content - changelog validation", () => {
118 test("changelog files use MM-DD-YY naming pattern", async () => {
119 let entries;