@composio/vercel 0.1.12-alpha.11 → 0.1.12-alpha.13
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/README.md +40 -40
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,13 +14,25 @@ The Vercel AI SDK provider for Composio SDK, providing seamless integration with
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npm install @composio/vercel
|
|
17
|
+
npm install @composio/vercel ai
|
|
18
18
|
# or
|
|
19
|
-
yarn add @composio/vercel
|
|
19
|
+
yarn add @composio/vercel ai
|
|
20
20
|
# or
|
|
21
|
-
pnpm add @composio/vercel
|
|
21
|
+
pnpm add @composio/vercel ai
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Environment Variables
|
|
25
|
+
|
|
26
|
+
Required environment variables:
|
|
27
|
+
|
|
28
|
+
- `COMPOSIO_API_KEY`: Your Composio API key
|
|
29
|
+
|
|
30
|
+
Optional environment variables (based on model choice):
|
|
31
|
+
|
|
32
|
+
- `OPENAI_API_KEY`: Your OpenAI API key (if using OpenAI)
|
|
33
|
+
- `ANTHROPIC_API_KEY`: Your Anthropic API key (if using Anthropic)
|
|
34
|
+
- `GEMINI_API_KEY`: Your Google AI API key (if using Gemini)
|
|
35
|
+
|
|
24
36
|
## Quick Start
|
|
25
37
|
|
|
26
38
|
```typescript
|
|
@@ -35,7 +47,7 @@ const composio = new Composio({
|
|
|
35
47
|
|
|
36
48
|
// Get available tools
|
|
37
49
|
const tools = await composio.tools.get('user123', {
|
|
38
|
-
|
|
50
|
+
toolkits: ['gmail', 'googlecalendar'],
|
|
39
51
|
limit: 10,
|
|
40
52
|
});
|
|
41
53
|
|
|
@@ -43,7 +55,11 @@ const tools = await composio.tools.get('user123', {
|
|
|
43
55
|
const sendEmailTool = await composio.tools.get('user123', 'GMAIL_SEND_EMAIL');
|
|
44
56
|
```
|
|
45
57
|
|
|
46
|
-
##
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
Check out our complete example implementations:
|
|
61
|
+
|
|
62
|
+
- [Basic Vercel Integration](../../examples/vercel/src/index.ts)
|
|
47
63
|
|
|
48
64
|
### Basic Chat Completion with Streaming
|
|
49
65
|
|
|
@@ -92,7 +108,7 @@ import { openai } from '@ai-sdk/openai';
|
|
|
92
108
|
export async function POST(req: Request) {
|
|
93
109
|
const { messages } = await req.json();
|
|
94
110
|
const tools = await composio.tools.get('user123', {
|
|
95
|
-
|
|
111
|
+
toolkits: ['gmail'],
|
|
96
112
|
});
|
|
97
113
|
|
|
98
114
|
const result = streamText({
|
|
@@ -121,7 +137,7 @@ const composio = new Composio({
|
|
|
121
137
|
export async function POST(req: Request) {
|
|
122
138
|
const { messages } = await req.json();
|
|
123
139
|
const tools = await composio.tools.get('user123', {
|
|
124
|
-
|
|
140
|
+
toolkits: ['gmail', 'googlecalendar'],
|
|
125
141
|
});
|
|
126
142
|
|
|
127
143
|
const stream = streamText({
|
|
@@ -140,42 +156,26 @@ export async function POST(req: Request) {
|
|
|
140
156
|
}
|
|
141
157
|
```
|
|
142
158
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
import { Composio } from '@composio/core';
|
|
147
|
-
import { VercelProvider } from '@composio/vercel';
|
|
148
|
-
import { streamObject } from 'ai';
|
|
159
|
+
## Provider Configuration
|
|
149
160
|
|
|
150
|
-
|
|
151
|
-
apiKey: process.env.COMPOSIO_API_KEY,
|
|
152
|
-
provider: new VercelProvider(),
|
|
153
|
-
});
|
|
161
|
+
The Vercel provider can be configured with various options:
|
|
154
162
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
messages,
|
|
165
|
-
tools,
|
|
166
|
-
schema: {
|
|
167
|
-
type: 'object',
|
|
168
|
-
properties: {
|
|
169
|
-
name: { type: 'string' },
|
|
170
|
-
age: { type: 'number' },
|
|
171
|
-
interests: { type: 'array', items: { type: 'string' } },
|
|
172
|
-
},
|
|
173
|
-
required: ['name', 'age', 'interests'],
|
|
163
|
+
```typescript
|
|
164
|
+
const provider = new VercelProvider({
|
|
165
|
+
// Default model configuration
|
|
166
|
+
model: openai('gpt-4'),
|
|
167
|
+
// Custom execution modifiers
|
|
168
|
+
modifiers: {
|
|
169
|
+
beforeExecute: params => {
|
|
170
|
+
// Transform parameters before execution
|
|
171
|
+
return params;
|
|
174
172
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
173
|
+
afterExecute: response => {
|
|
174
|
+
// Transform response after execution
|
|
175
|
+
return response;
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
## API Reference
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/vercel",
|
|
3
|
-
"version": "0.1.12-alpha.
|
|
3
|
+
"version": "0.1.12-alpha.13",
|
|
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.12-alpha.
|
|
25
|
+
"@composio/core": "0.1.12-alpha.13",
|
|
26
26
|
"ai": "^4.3.8"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsup": "^8.4.0",
|
|
30
30
|
"typescript": "^5.8.3",
|
|
31
|
-
"vitest": "^3.1.
|
|
32
|
-
"@composio/core": "0.1.12-alpha.
|
|
31
|
+
"vitest": "^3.1.4",
|
|
32
|
+
"@composio/core": "0.1.12-alpha.13"
|
|
33
33
|
},
|
|
34
34
|
"gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
|
|
35
35
|
"scripts": {
|