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
Sushmithamallesh committed
Oct 7, 2025 at 16:12 UTC
f65482ee79b69d5dd4aa40b50593e454aa568ffa
2 files changed
+35
-66
fern/pages/src/providers/openai.mdx
+27
-60
@@ -13,44 +13,49 @@ By default, the OpenAI Provider is installed when you install the Composio SDK.
13
14
<CodeGroup>
15
```bash title="Python" for="python"
16
-pip install composio_openai==0.8.0
16
+pip install composio_openai
17
```
18
```bash title="TypeScript" for="typescript"
19
npm install @composio/openai
20
```
21
</CodeGroup>
22
-The OpenAI Provider is used by default when you initialize the Composio SDK but you can explicitly specify it.
22
+
23
+## Responses API
24
+The Responses API is the recommended way to build more agentic flows with the OpenAI API.
25
+Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/responses)
26
+
27
+<Note>
28
+Before executing any tools that require authentication (like Gmail), you'll need to:
29
+1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
30
+2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user
31
+This ensures proper authorization and access to the external service.
32
+</Note>
33
34
<CodeGroup>
35
<SnippetCode
26
- src="fern/snippets/providers/python/openai-provider.py"
27
- startLine={1}
28
- endLine={8}
36
+ src="fern/snippets/providers/python/openairesponses-provider.py"
37
+ startLine={9}
38
+ endLine={24}
39
/>
40
<SnippetCode
41
src="fern/snippets/providers/typescript/openai.ts"
32
- startLine={1}
33
- endLine={7}
42
+ startLine={26}
43
+ endLine={45}
44
/>
35
-</CodeGroup>
36
-
37
-{/* ## Responses API
38
-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)
39
-
40
-<CodeGroup>
41
-```python
45
43
-```
44
-<SnippetCode
45
- src="fern/snippets/providers/typescript/openai.ts"
46
- startLine={5}
47
- endLine={24}
48
-/>
49
-</CodeGroup> */}
46
+</CodeGroup>
47
48
## Chat Completion API
52
-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.
49
+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).
50
+The OpenAI Chat Provider is the default provider used by Composio SDK, but you can also explicitly initialise it.
51
52
+<Note>
53
+Before executing any tools that require authentication (like Gmail), you'll need to:
54
+1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
55
+2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user
56
+This ensures proper authorization and access to the external service.
57
+
58
+</Note>
59
<CodeGroup>
60
<SnippetCode
61
src="fern/snippets/providers/python/openai-provider.py"
@@ -65,44 +70,6 @@ Chat Completion API is the industry standard for building LLM-powered applicatio
70
71
</CodeGroup>
72
68
-{/* The tools can also be called manually:
69
-
70
-<CodeGroup>
71
-```typescript {20-27} maxLines={60}
72
-const userId = "your@example.com";
73
-const tools = await composio.tools.get(userId, {
74
- toolkits: ["HACKERNEWS"],
75
-});
76
-
77
-const completion = await openai.chat.completions.create({
78
- model: "gpt-4o",
79
- messages: [
80
- {
81
- role: "user",
82
- content: "What is the latest hackernews post about?",
83
- },
84
- ],
85
- tools: tools,
86
-});
87
-
88
-const toolCall = completion.choices[0]?.message.tool_calls?.[0];
89
-if (toolCall) {
90
- console.log(`✅ Calling tool ${toolCall.function.name}`);
91
- const result = await composio.tools.execute(
92
- toolCall.function.name,
93
- {
94
- userId,
95
- arguments: JSON.parse(toolCall.function.arguments),
96
- }
97
- );
98
- console.log(JSON.stringify(result, null, 2));
99
-}
100
-```
101
-
102
-```python
103
-
104
-```
105
-</CodeGroup> */}
73
74
## Modifiers
75
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.
fern/snippets/providers/python/openai-provider.py
+8
-6
@@ -6,18 +6,20 @@ from composio_openai import OpenAIProvider
6
composio = Composio(provider=OpenAIProvider())
7
openai = OpenAI()
8
9
-user_id = "user@acme.org"
10
-tools = composio.tools.get(user_id=user_id, toolkits=["HACKERNEWS"])
9
+# Make sure to create an auth config and a connected account for the user with gmail toolkit
10
+# Make sure to replace "your-user-id" with the actual user ID
11
+user_id = "your-user-id"
12
+
13
+tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
14
15
response = openai.chat.completions.create(
13
- model="gpt-4.1",
16
+ model="gpt-5",
17
tools=tools,
18
messages=[
16
- {"role": "user", "content": "What's the latest Hackernews post about?"},
19
+ {"role": "user", "content": "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"},
20
],
21
)
22
20
-# Execute the function calls.
23
+# Execute the function calls
24
result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
25
print(result)
23
-# will return the raw response from the HACKERNEWS API.
\ No newline at end of file