Skip to content

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

chat changes

Sushmithamalleshf65482ee79b6
diff --git a/fern/pages/src/providers/openai.mdx b/fern/pages/src/providers/openai.mdx
index 88e38953d..3133eb279 100644
--- a/fern/pages/src/providers/openai.mdx
+++ b/fern/pages/src/providers/openai.mdx
@@ -13,44 +13,49 @@ By default, the OpenAI Provider is installed when you install the Composio SDK.
<CodeGroup>
```bash title="Python" for="python"
-pip install composio_openai==0.8.0
+pip install composio_openai
```
```bash title="TypeScript" for="typescript"
npm install @composio/openai
```
</CodeGroup>
-The OpenAI Provider is used by default when you initialize the Composio SDK but you can explicitly specify it.
+
+## Responses API
+The Responses API is the recommended way to build more agentic flows with the OpenAI API.
+Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/responses)
+
+<Note>
+Before executing any tools that require authentication (like Gmail), you'll need to:
+1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
+2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user
+This ensures proper authorization and access to the external service.
+</Note>
<CodeGroup>
<SnippetCode
- src="fern/snippets/providers/python/openai-provider.py"
- startLine={1}
- endLine={8}
+ src="fern/snippets/providers/python/openairesponses-provider.py"
+ startLine={9}
+ endLine={24}
/>
<SnippetCode
src="fern/snippets/providers/typescript/openai.ts"
- startLine={1}
- endLine={7}
+ startLine={26}
+ endLine={45}
/>
-</CodeGroup>
-
-{/* ## Responses API
-The Responses API is the recommended way to build more agentic flows with the OpenAI API. Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/guides/responses-vs-chat-completions)
-
-<CodeGroup>
-```python
-```
-<SnippetCode
- src="fern/snippets/providers/typescript/openai.ts"
- startLine={5}
- endLine={24}
-/>
-</CodeGroup> */}
+</CodeGroup>
## Chat Completion API
-Chat Completion API is the industry standard for building LLM-powered applications. Chat completions are also adopted and used by many other LLM providers apart from OpenAI.
+The Chat Completion API generates a model response from a list of messages. Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/chat).
+The OpenAI Chat Provider is the default provider used by Composio SDK, but you can also explicitly initialise it.
+<Note>
+Before executing any tools that require authentication (like Gmail), you'll need to:
+1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
+2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user
+This ensures proper authorization and access to the external service.
+
+</Note>
<CodeGroup>
<SnippetCode
src="fern/snippets/providers/python/openai-provider.py"
@@ -65,44 +70,6 @@ Chat Completion API is the industry standard for building LLM-powered applicatio
</CodeGroup>
-{/* The tools can also be called manually:
-
-<CodeGroup>
-```typescript {20-27} maxLines={60}
-const userId = "[email protected]";
-const tools = await composio.tools.get(userId, {
- toolkits: ["HACKERNEWS"],
-});
-
-const completion = await openai.chat.completions.create({
- model: "gpt-4o",
- messages: [
- {
- role: "user",
- content: "What is the latest hackernews post about?",
- },
- ],
- tools: tools,
-});
-
-const toolCall = completion.choices[0]?.message.tool_calls?.[0];
-if (toolCall) {
- console.log(`✅ Calling tool ${toolCall.function.name}`);
- const result = await composio.tools.execute(
- toolCall.function.name,
- {
- userId,
- arguments: JSON.parse(toolCall.function.arguments),
- }
- );
- console.log(JSON.stringify(result, null, 2));
-}
-```
-
-```python
-
-```
-</CodeGroup> */}
## Modifiers
Modifiers are functions that can be used to intercept and optionally **modify** the schema, the tool call request and the response from the tool call.
diff --git a/fern/snippets/providers/python/openai-provider.py b/fern/snippets/providers/python/openai-provider.py
index 90ab6c2eb..6081b9575 100644
--- a/fern/snippets/providers/python/openai-provider.py
+++ b/fern/snippets/providers/python/openai-provider.py
@@ -6,18 +6,20 @@ from composio_openai import OpenAIProvider
composio = Composio(provider=OpenAIProvider())
openai = OpenAI()
-user_id = "[email protected]"
-tools = composio.tools.get(user_id=user_id, toolkits=["HACKERNEWS"])
+# Make sure to create an auth config and a connected account for the user with gmail toolkit
+# Make sure to replace "your-user-id" with the actual user ID
+user_id = "your-user-id"
+
+tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
response = openai.chat.completions.create(
- model="gpt-4.1",
+ model="gpt-5",
tools=tools,
messages=[
- {"role": "user", "content": "What's the latest Hackernews post about?"},
+ {"role": "user", "content": "Send an email to [email protected] with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"},
],
)
-# Execute the function calls.
+# Execute the function calls
result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
print(result)
-# will return the raw response from the HACKERNEWS API.
\ No newline at end of file