@composio/vercel 0.1.20 → 0.1.22
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.
- package/dist/index.cjs +20 -20
- package/dist/index.js +20 -20
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -29,21 +29,21 @@ var VercelProvider = class extends import_core.BaseAgenticProvider {
|
|
|
29
29
|
name = "vercel";
|
|
30
30
|
/**
|
|
31
31
|
* Creates a new instance of the VercelProvider.
|
|
32
|
-
*
|
|
32
|
+
*
|
|
33
33
|
* This provider enables integration with the Vercel AI SDK,
|
|
34
34
|
* allowing Composio tools to be used with Vercel AI applications.
|
|
35
|
-
*
|
|
35
|
+
*
|
|
36
36
|
* @example
|
|
37
37
|
* ```typescript
|
|
38
38
|
* // Initialize the Vercel provider
|
|
39
39
|
* const provider = new VercelProvider();
|
|
40
|
-
*
|
|
40
|
+
*
|
|
41
41
|
* // Use with Composio
|
|
42
42
|
* const composio = new Composio({
|
|
43
43
|
* apiKey: 'your-api-key',
|
|
44
44
|
* provider: new VercelProvider()
|
|
45
45
|
* });
|
|
46
|
-
*
|
|
46
|
+
*
|
|
47
47
|
* // Use the provider to wrap tools for Vercel AI SDK
|
|
48
48
|
* const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
|
|
49
49
|
* ```
|
|
@@ -53,14 +53,14 @@ var VercelProvider = class extends import_core.BaseAgenticProvider {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Wraps a Composio tool in a Vercel AI SDK tool format.
|
|
56
|
-
*
|
|
56
|
+
*
|
|
57
57
|
* This method transforms a Composio tool definition into the format
|
|
58
58
|
* expected by Vercel's AI SDK for function calling.
|
|
59
|
-
*
|
|
59
|
+
*
|
|
60
60
|
* @param {ComposioTool} composioTool - The Composio tool to wrap
|
|
61
61
|
* @param {ExecuteToolFn} executeTool - Function to execute the tool
|
|
62
62
|
* @returns {VercelTool} The wrapped Vercel tool
|
|
63
|
-
*
|
|
63
|
+
*
|
|
64
64
|
* @example
|
|
65
65
|
* ```typescript
|
|
66
66
|
* // Wrap a single tool for use with Vercel AI SDK
|
|
@@ -75,27 +75,27 @@ var VercelProvider = class extends import_core.BaseAgenticProvider {
|
|
|
75
75
|
* required: ['query']
|
|
76
76
|
* }
|
|
77
77
|
* };
|
|
78
|
-
*
|
|
78
|
+
*
|
|
79
79
|
* // Create a Vercel tool using the provider
|
|
80
80
|
* const vercelTool = provider.wrapTool(
|
|
81
81
|
* composioTool,
|
|
82
82
|
* composio.tools.execute
|
|
83
83
|
* );
|
|
84
|
-
*
|
|
84
|
+
*
|
|
85
85
|
* // Use with Vercel AI SDK
|
|
86
86
|
* import { StreamingTextResponse, Message } from 'ai';
|
|
87
87
|
* import { OpenAI } from 'openai';
|
|
88
|
-
*
|
|
88
|
+
*
|
|
89
89
|
* export async function POST(req: Request) {
|
|
90
90
|
* const { messages } = await req.json();
|
|
91
91
|
* const openai = new OpenAI();
|
|
92
|
-
*
|
|
92
|
+
*
|
|
93
93
|
* const response = await openai.chat.completions.create({
|
|
94
94
|
* model: 'gpt-4',
|
|
95
95
|
* messages,
|
|
96
96
|
* tools: [vercelTool]
|
|
97
97
|
* });
|
|
98
|
-
*
|
|
98
|
+
*
|
|
99
99
|
* return new StreamingTextResponse(response.choices[0].message);
|
|
100
100
|
* }
|
|
101
101
|
* ```
|
|
@@ -112,15 +112,15 @@ var VercelProvider = class extends import_core.BaseAgenticProvider {
|
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* Wraps a list of Composio tools as a Vercel AI SDK tool collection.
|
|
115
|
-
*
|
|
115
|
+
*
|
|
116
116
|
* This method transforms multiple Composio tool definitions into the format
|
|
117
117
|
* expected by Vercel's AI SDK for function calling, organizing them
|
|
118
118
|
* into a dictionary keyed by tool slug.
|
|
119
|
-
*
|
|
119
|
+
*
|
|
120
120
|
* @param {ComposioTool[]} tools - Array of Composio tools to wrap
|
|
121
121
|
* @param {ExecuteToolFn} executeTool - Function to execute the tools
|
|
122
122
|
* @returns {VercelToolCollection} Dictionary of wrapped tools in Vercel AI SDK format
|
|
123
|
-
*
|
|
123
|
+
*
|
|
124
124
|
* @example
|
|
125
125
|
* ```typescript
|
|
126
126
|
* // Wrap multiple tools for use with Vercel AI SDK
|
|
@@ -148,27 +148,27 @@ var VercelProvider = class extends import_core.BaseAgenticProvider {
|
|
|
148
148
|
* }
|
|
149
149
|
* }
|
|
150
150
|
* ];
|
|
151
|
-
*
|
|
151
|
+
*
|
|
152
152
|
* // Create Vercel tools using the provider
|
|
153
153
|
* const vercelTools = provider.wrapTools(
|
|
154
154
|
* composioTools,
|
|
155
155
|
* composio.tools.execute
|
|
156
156
|
* );
|
|
157
|
-
*
|
|
157
|
+
*
|
|
158
158
|
* // Use with Vercel AI SDK in a Next.js API route
|
|
159
159
|
* import { StreamingTextResponse } from 'ai';
|
|
160
160
|
* import { OpenAI } from 'openai';
|
|
161
|
-
*
|
|
161
|
+
*
|
|
162
162
|
* export async function POST(req: Request) {
|
|
163
163
|
* const { messages } = await req.json();
|
|
164
164
|
* const openai = new OpenAI();
|
|
165
|
-
*
|
|
165
|
+
*
|
|
166
166
|
* const response = await openai.chat.completions.create({
|
|
167
167
|
* model: 'gpt-4',
|
|
168
168
|
* messages,
|
|
169
169
|
* tools: Object.values(vercelTools)
|
|
170
170
|
* });
|
|
171
|
-
*
|
|
171
|
+
*
|
|
172
172
|
* return new StreamingTextResponse(response.choices[0].message);
|
|
173
173
|
* }
|
|
174
174
|
* ```
|
package/dist/index.js
CHANGED
|
@@ -5,21 +5,21 @@ var VercelProvider = class extends BaseAgenticProvider {
|
|
|
5
5
|
name = "vercel";
|
|
6
6
|
/**
|
|
7
7
|
* Creates a new instance of the VercelProvider.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* This provider enables integration with the Vercel AI SDK,
|
|
10
10
|
* allowing Composio tools to be used with Vercel AI applications.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```typescript
|
|
14
14
|
* // Initialize the Vercel provider
|
|
15
15
|
* const provider = new VercelProvider();
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
17
|
* // Use with Composio
|
|
18
18
|
* const composio = new Composio({
|
|
19
19
|
* apiKey: 'your-api-key',
|
|
20
20
|
* provider: new VercelProvider()
|
|
21
21
|
* });
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
23
|
* // Use the provider to wrap tools for Vercel AI SDK
|
|
24
24
|
* const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
|
|
25
25
|
* ```
|
|
@@ -29,14 +29,14 @@ var VercelProvider = class extends BaseAgenticProvider {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Wraps a Composio tool in a Vercel AI SDK tool format.
|
|
32
|
-
*
|
|
32
|
+
*
|
|
33
33
|
* This method transforms a Composio tool definition into the format
|
|
34
34
|
* expected by Vercel's AI SDK for function calling.
|
|
35
|
-
*
|
|
35
|
+
*
|
|
36
36
|
* @param {ComposioTool} composioTool - The Composio tool to wrap
|
|
37
37
|
* @param {ExecuteToolFn} executeTool - Function to execute the tool
|
|
38
38
|
* @returns {VercelTool} The wrapped Vercel tool
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```typescript
|
|
42
42
|
* // Wrap a single tool for use with Vercel AI SDK
|
|
@@ -51,27 +51,27 @@ var VercelProvider = class extends BaseAgenticProvider {
|
|
|
51
51
|
* required: ['query']
|
|
52
52
|
* }
|
|
53
53
|
* };
|
|
54
|
-
*
|
|
54
|
+
*
|
|
55
55
|
* // Create a Vercel tool using the provider
|
|
56
56
|
* const vercelTool = provider.wrapTool(
|
|
57
57
|
* composioTool,
|
|
58
58
|
* composio.tools.execute
|
|
59
59
|
* );
|
|
60
|
-
*
|
|
60
|
+
*
|
|
61
61
|
* // Use with Vercel AI SDK
|
|
62
62
|
* import { StreamingTextResponse, Message } from 'ai';
|
|
63
63
|
* import { OpenAI } from 'openai';
|
|
64
|
-
*
|
|
64
|
+
*
|
|
65
65
|
* export async function POST(req: Request) {
|
|
66
66
|
* const { messages } = await req.json();
|
|
67
67
|
* const openai = new OpenAI();
|
|
68
|
-
*
|
|
68
|
+
*
|
|
69
69
|
* const response = await openai.chat.completions.create({
|
|
70
70
|
* model: 'gpt-4',
|
|
71
71
|
* messages,
|
|
72
72
|
* tools: [vercelTool]
|
|
73
73
|
* });
|
|
74
|
-
*
|
|
74
|
+
*
|
|
75
75
|
* return new StreamingTextResponse(response.choices[0].message);
|
|
76
76
|
* }
|
|
77
77
|
* ```
|
|
@@ -88,15 +88,15 @@ var VercelProvider = class extends BaseAgenticProvider {
|
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Wraps a list of Composio tools as a Vercel AI SDK tool collection.
|
|
91
|
-
*
|
|
91
|
+
*
|
|
92
92
|
* This method transforms multiple Composio tool definitions into the format
|
|
93
93
|
* expected by Vercel's AI SDK for function calling, organizing them
|
|
94
94
|
* into a dictionary keyed by tool slug.
|
|
95
|
-
*
|
|
95
|
+
*
|
|
96
96
|
* @param {ComposioTool[]} tools - Array of Composio tools to wrap
|
|
97
97
|
* @param {ExecuteToolFn} executeTool - Function to execute the tools
|
|
98
98
|
* @returns {VercelToolCollection} Dictionary of wrapped tools in Vercel AI SDK format
|
|
99
|
-
*
|
|
99
|
+
*
|
|
100
100
|
* @example
|
|
101
101
|
* ```typescript
|
|
102
102
|
* // Wrap multiple tools for use with Vercel AI SDK
|
|
@@ -124,27 +124,27 @@ var VercelProvider = class extends BaseAgenticProvider {
|
|
|
124
124
|
* }
|
|
125
125
|
* }
|
|
126
126
|
* ];
|
|
127
|
-
*
|
|
127
|
+
*
|
|
128
128
|
* // Create Vercel tools using the provider
|
|
129
129
|
* const vercelTools = provider.wrapTools(
|
|
130
130
|
* composioTools,
|
|
131
131
|
* composio.tools.execute
|
|
132
132
|
* );
|
|
133
|
-
*
|
|
133
|
+
*
|
|
134
134
|
* // Use with Vercel AI SDK in a Next.js API route
|
|
135
135
|
* import { StreamingTextResponse } from 'ai';
|
|
136
136
|
* import { OpenAI } from 'openai';
|
|
137
|
-
*
|
|
137
|
+
*
|
|
138
138
|
* export async function POST(req: Request) {
|
|
139
139
|
* const { messages } = await req.json();
|
|
140
140
|
* const openai = new OpenAI();
|
|
141
|
-
*
|
|
141
|
+
*
|
|
142
142
|
* const response = await openai.chat.completions.create({
|
|
143
143
|
* model: 'gpt-4',
|
|
144
144
|
* messages,
|
|
145
145
|
* tools: Object.values(vercelTools)
|
|
146
146
|
* });
|
|
147
|
-
*
|
|
147
|
+
*
|
|
148
148
|
* return new StreamingTextResponse(response.choices[0].message);
|
|
149
149
|
* }
|
|
150
150
|
* ```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/vercel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "ISC",
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@composio/core": "0.1.
|
|
25
|
+
"@composio/core": "0.1.22",
|
|
26
26
|
"ai": "^4.3.8"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsup": "^8.4.0",
|
|
30
30
|
"typescript": "^5.8.3",
|
|
31
31
|
"vitest": "^3.1.4",
|
|
32
|
-
"@composio/core": "0.1.
|
|
32
|
+
"@composio/core": "0.1.22"
|
|
33
33
|
},
|
|
34
34
|
"gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
|
|
35
35
|
"scripts": {
|