@quercle/ai-sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +100 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +131 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +97 -0
- package/dist/tools.js.map +1 -0
- package/dist/tools.test.d.ts +2 -0
- package/dist/tools.test.d.ts.map +1 -0
- package/dist/tools.test.js +53 -0
- package/dist/tools.test.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Quercle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# @quercle/ai-sdk
|
|
2
|
+
|
|
3
|
+
Quercle web tools for the [Vercel AI SDK](https://sdk.vercel.ai/).
|
|
4
|
+
|
|
5
|
+
Provides `quercleSearch` and `quercleFetch` tools that integrate seamlessly with AI applications built on the Vercel AI SDK.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @quercle/ai-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @quercle/ai-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
Set your Quercle API key as an environment variable:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
export QUERCLE_API_KEY=qk_...
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Get your API key at [quercle.dev](https://quercle.dev).
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### With generateText
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { quercleSearch, quercleFetch } from "@quercle/ai-sdk";
|
|
33
|
+
import { generateText } from "ai";
|
|
34
|
+
import { openai } from "@ai-sdk/openai";
|
|
35
|
+
|
|
36
|
+
const result = await generateText({
|
|
37
|
+
model: openai("gpt-4o"),
|
|
38
|
+
tools: { quercleSearch, quercleFetch },
|
|
39
|
+
prompt: "Search for the latest news about AI and summarize",
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With streamText
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { quercleSearch, quercleFetch } from "@quercle/ai-sdk";
|
|
47
|
+
import { streamText } from "ai";
|
|
48
|
+
import { openai } from "@ai-sdk/openai";
|
|
49
|
+
|
|
50
|
+
const stream = streamText({
|
|
51
|
+
model: openai("gpt-4o"),
|
|
52
|
+
tools: { quercleSearch, quercleFetch },
|
|
53
|
+
prompt: "Find information about TypeScript 5",
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
for await (const chunk of stream.textStream) {
|
|
57
|
+
console.log(chunk);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### With Custom API Key
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { createQuercleTools } from "@quercle/ai-sdk";
|
|
65
|
+
import { generateText } from "ai";
|
|
66
|
+
import { openai } from "@ai-sdk/openai";
|
|
67
|
+
|
|
68
|
+
const { quercleSearch, quercleFetch } = createQuercleTools({
|
|
69
|
+
apiKey: "qk_...",
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const result = await generateText({
|
|
73
|
+
model: openai("gpt-4o"),
|
|
74
|
+
tools: { quercleSearch, quercleFetch },
|
|
75
|
+
prompt: "Search for TypeScript best practices",
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Tools
|
|
80
|
+
|
|
81
|
+
### quercleSearch
|
|
82
|
+
|
|
83
|
+
Search the web and get AI-synthesized answers with citations.
|
|
84
|
+
|
|
85
|
+
**Parameters:**
|
|
86
|
+
- `query` (string, required): The search query
|
|
87
|
+
- `allowedDomains` (string[], optional): Only include results from these domains
|
|
88
|
+
- `blockedDomains` (string[], optional): Exclude results from these domains
|
|
89
|
+
|
|
90
|
+
### quercleFetch
|
|
91
|
+
|
|
92
|
+
Fetch a URL and analyze its content with AI.
|
|
93
|
+
|
|
94
|
+
**Parameters:**
|
|
95
|
+
- `url` (string, required): The URL to fetch
|
|
96
|
+
- `prompt` (string, required): Instructions for how to analyze the content
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG7E,YAAY,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type QuercleConfig } from "@quercle/sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Search the web using Quercle and get AI-synthesized answers with citations.
|
|
4
|
+
*
|
|
5
|
+
* Uses the QUERCLE_API_KEY environment variable for authentication.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { quercleSearch } from "@quercle/ai-sdk";
|
|
10
|
+
* import { generateText } from "ai";
|
|
11
|
+
* import { openai } from "@ai-sdk/openai";
|
|
12
|
+
*
|
|
13
|
+
* const result = await generateText({
|
|
14
|
+
* model: openai("gpt-4"),
|
|
15
|
+
* tools: { quercleSearch },
|
|
16
|
+
* prompt: "Search for the latest news about AI",
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const quercleSearch: import("ai").Tool<import("zod").ZodObject<{
|
|
21
|
+
query: import("zod").ZodString;
|
|
22
|
+
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
23
|
+
blockedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
24
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
25
|
+
query: string;
|
|
26
|
+
allowedDomains?: string[] | undefined;
|
|
27
|
+
blockedDomains?: string[] | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
query: string;
|
|
30
|
+
allowedDomains?: string[] | undefined;
|
|
31
|
+
blockedDomains?: string[] | undefined;
|
|
32
|
+
}>, string> & {
|
|
33
|
+
execute: (args: {
|
|
34
|
+
query: string;
|
|
35
|
+
allowedDomains?: string[] | undefined;
|
|
36
|
+
blockedDomains?: string[] | undefined;
|
|
37
|
+
}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Fetch a URL and analyze its content with AI using Quercle.
|
|
41
|
+
*
|
|
42
|
+
* Uses the QUERCLE_API_KEY environment variable for authentication.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* import { quercleFetch } from "@quercle/ai-sdk";
|
|
47
|
+
* import { generateText } from "ai";
|
|
48
|
+
* import { openai } from "@ai-sdk/openai";
|
|
49
|
+
*
|
|
50
|
+
* const result = await generateText({
|
|
51
|
+
* model: openai("gpt-4"),
|
|
52
|
+
* tools: { quercleFetch },
|
|
53
|
+
* prompt: "Fetch https://example.com and summarize its content",
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare const quercleFetch: import("ai").Tool<import("zod").ZodObject<{
|
|
58
|
+
url: import("zod").ZodString;
|
|
59
|
+
prompt: import("zod").ZodString;
|
|
60
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
61
|
+
url: string;
|
|
62
|
+
prompt: string;
|
|
63
|
+
}, {
|
|
64
|
+
url: string;
|
|
65
|
+
prompt: string;
|
|
66
|
+
}>, string> & {
|
|
67
|
+
execute: (args: {
|
|
68
|
+
url: string;
|
|
69
|
+
prompt: string;
|
|
70
|
+
}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Create Quercle tools with custom configuration.
|
|
74
|
+
*
|
|
75
|
+
* Use this when you need to provide a custom API key instead of
|
|
76
|
+
* using the QUERCLE_API_KEY environment variable.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* import { createQuercleTools } from "@quercle/ai-sdk";
|
|
81
|
+
* import { generateText } from "ai";
|
|
82
|
+
* import { openai } from "@ai-sdk/openai";
|
|
83
|
+
*
|
|
84
|
+
* const { quercleSearch, quercleFetch } = createQuercleTools({
|
|
85
|
+
* apiKey: "qk_...",
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* const result = await generateText({
|
|
89
|
+
* model: openai("gpt-4"),
|
|
90
|
+
* tools: { quercleSearch, quercleFetch },
|
|
91
|
+
* prompt: "Search for TypeScript best practices",
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function createQuercleTools(config?: QuercleConfig): {
|
|
96
|
+
quercleSearch: import("ai").Tool<import("zod").ZodObject<{
|
|
97
|
+
query: import("zod").ZodString;
|
|
98
|
+
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
99
|
+
blockedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
100
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
101
|
+
query: string;
|
|
102
|
+
allowedDomains?: string[] | undefined;
|
|
103
|
+
blockedDomains?: string[] | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
query: string;
|
|
106
|
+
allowedDomains?: string[] | undefined;
|
|
107
|
+
blockedDomains?: string[] | undefined;
|
|
108
|
+
}>, string> & {
|
|
109
|
+
execute: (args: {
|
|
110
|
+
query: string;
|
|
111
|
+
allowedDomains?: string[] | undefined;
|
|
112
|
+
blockedDomains?: string[] | undefined;
|
|
113
|
+
}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
|
|
114
|
+
};
|
|
115
|
+
quercleFetch: import("ai").Tool<import("zod").ZodObject<{
|
|
116
|
+
url: import("zod").ZodString;
|
|
117
|
+
prompt: import("zod").ZodString;
|
|
118
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
119
|
+
url: string;
|
|
120
|
+
prompt: string;
|
|
121
|
+
}, {
|
|
122
|
+
url: string;
|
|
123
|
+
prompt: string;
|
|
124
|
+
}>, string> & {
|
|
125
|
+
execute: (args: {
|
|
126
|
+
url: string;
|
|
127
|
+
prompt: string;
|
|
128
|
+
}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;CAOxB,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;CAOvB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBxD"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { tool } from "ai";
|
|
2
|
+
import { QuercleClient, TOOL_DESCRIPTIONS, searchToolSchema, fetchToolSchema, } from "@quercle/sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Search the web using Quercle and get AI-synthesized answers with citations.
|
|
5
|
+
*
|
|
6
|
+
* Uses the QUERCLE_API_KEY environment variable for authentication.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { quercleSearch } from "@quercle/ai-sdk";
|
|
11
|
+
* import { generateText } from "ai";
|
|
12
|
+
* import { openai } from "@ai-sdk/openai";
|
|
13
|
+
*
|
|
14
|
+
* const result = await generateText({
|
|
15
|
+
* model: openai("gpt-4"),
|
|
16
|
+
* tools: { quercleSearch },
|
|
17
|
+
* prompt: "Search for the latest news about AI",
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export const quercleSearch = tool({
|
|
22
|
+
description: TOOL_DESCRIPTIONS.SEARCH,
|
|
23
|
+
parameters: searchToolSchema,
|
|
24
|
+
execute: async ({ query, allowedDomains, blockedDomains }) => {
|
|
25
|
+
const client = new QuercleClient();
|
|
26
|
+
return await client.search(query, { allowedDomains, blockedDomains });
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Fetch a URL and analyze its content with AI using Quercle.
|
|
31
|
+
*
|
|
32
|
+
* Uses the QUERCLE_API_KEY environment variable for authentication.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { quercleFetch } from "@quercle/ai-sdk";
|
|
37
|
+
* import { generateText } from "ai";
|
|
38
|
+
* import { openai } from "@ai-sdk/openai";
|
|
39
|
+
*
|
|
40
|
+
* const result = await generateText({
|
|
41
|
+
* model: openai("gpt-4"),
|
|
42
|
+
* tools: { quercleFetch },
|
|
43
|
+
* prompt: "Fetch https://example.com and summarize its content",
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export const quercleFetch = tool({
|
|
48
|
+
description: TOOL_DESCRIPTIONS.FETCH,
|
|
49
|
+
parameters: fetchToolSchema,
|
|
50
|
+
execute: async ({ url, prompt }) => {
|
|
51
|
+
const client = new QuercleClient();
|
|
52
|
+
return await client.fetch(url, prompt);
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Create Quercle tools with custom configuration.
|
|
57
|
+
*
|
|
58
|
+
* Use this when you need to provide a custom API key instead of
|
|
59
|
+
* using the QUERCLE_API_KEY environment variable.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* import { createQuercleTools } from "@quercle/ai-sdk";
|
|
64
|
+
* import { generateText } from "ai";
|
|
65
|
+
* import { openai } from "@ai-sdk/openai";
|
|
66
|
+
*
|
|
67
|
+
* const { quercleSearch, quercleFetch } = createQuercleTools({
|
|
68
|
+
* apiKey: "qk_...",
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* const result = await generateText({
|
|
72
|
+
* model: openai("gpt-4"),
|
|
73
|
+
* tools: { quercleSearch, quercleFetch },
|
|
74
|
+
* prompt: "Search for TypeScript best practices",
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export function createQuercleTools(config) {
|
|
79
|
+
const client = new QuercleClient(config);
|
|
80
|
+
return {
|
|
81
|
+
quercleSearch: tool({
|
|
82
|
+
description: TOOL_DESCRIPTIONS.SEARCH,
|
|
83
|
+
parameters: searchToolSchema,
|
|
84
|
+
execute: async ({ query, allowedDomains, blockedDomains }) => {
|
|
85
|
+
return await client.search(query, { allowedDomains, blockedDomains });
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
quercleFetch: tool({
|
|
89
|
+
description: TOOL_DESCRIPTIONS.FETCH,
|
|
90
|
+
parameters: fetchToolSchema,
|
|
91
|
+
execute: async ({ url, prompt }) => {
|
|
92
|
+
return await client.fetch(url, prompt);
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,G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AC;SACF,CAAC;QACF,YAAY,EAAE,IAAI,CAAC;YACjB,WAAW,EAAE,iBAAiB,CAAC,KAAK;YACpC,UAAU,EAAE,eAAe;YAC3B,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;gBACjC,OAAO,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACzC,CAAC;SACF,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.test.d.ts","sourceRoot":"","sources":["../src/tools.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import { quercleSearch, quercleFetch, createQuercleTools } from "./tools.js";
|
|
3
|
+
describe("quercleSearch", () => {
|
|
4
|
+
it("should have a description", () => {
|
|
5
|
+
expect(quercleSearch.description).toBeDefined();
|
|
6
|
+
expect(typeof quercleSearch.description).toBe("string");
|
|
7
|
+
expect(quercleSearch.description.length).toBeGreaterThan(0);
|
|
8
|
+
});
|
|
9
|
+
it("should have parameters schema", () => {
|
|
10
|
+
expect(quercleSearch.parameters).toBeDefined();
|
|
11
|
+
});
|
|
12
|
+
it("should have execute function", () => {
|
|
13
|
+
expect(typeof quercleSearch.execute).toBe("function");
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
describe("quercleFetch", () => {
|
|
17
|
+
it("should have a description", () => {
|
|
18
|
+
expect(quercleFetch.description).toBeDefined();
|
|
19
|
+
expect(typeof quercleFetch.description).toBe("string");
|
|
20
|
+
expect(quercleFetch.description.length).toBeGreaterThan(0);
|
|
21
|
+
});
|
|
22
|
+
it("should have parameters schema", () => {
|
|
23
|
+
expect(quercleFetch.parameters).toBeDefined();
|
|
24
|
+
});
|
|
25
|
+
it("should have execute function", () => {
|
|
26
|
+
expect(typeof quercleFetch.execute).toBe("function");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe("createQuercleTools", () => {
|
|
30
|
+
// All tests use a test API key since QuercleClient requires one
|
|
31
|
+
const testConfig = { apiKey: "qk_test_key" };
|
|
32
|
+
it("should return quercleSearch and quercleFetch tools", () => {
|
|
33
|
+
const tools = createQuercleTools(testConfig);
|
|
34
|
+
expect(tools.quercleSearch).toBeDefined();
|
|
35
|
+
expect(tools.quercleFetch).toBeDefined();
|
|
36
|
+
});
|
|
37
|
+
it("should return tools with execute functions", () => {
|
|
38
|
+
const tools = createQuercleTools(testConfig);
|
|
39
|
+
expect(typeof tools.quercleSearch.execute).toBe("function");
|
|
40
|
+
expect(typeof tools.quercleFetch.execute).toBe("function");
|
|
41
|
+
});
|
|
42
|
+
it("should return tools with descriptions", () => {
|
|
43
|
+
const tools = createQuercleTools(testConfig);
|
|
44
|
+
expect(tools.quercleSearch.description).toBeDefined();
|
|
45
|
+
expect(tools.quercleFetch.description).toBeDefined();
|
|
46
|
+
});
|
|
47
|
+
it("should return tools with parameters", () => {
|
|
48
|
+
const tools = createQuercleTools(testConfig);
|
|
49
|
+
expect(tools.quercleSearch.parameters).toBeDefined();
|
|
50
|
+
expect(tools.quercleFetch.parameters).toBeDefined();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=tools.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.test.js","sourceRoot":"","sources":["../src/tools.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7E,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QAChD,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AAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quercle/ai-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Quercle web tools for Vercel AI SDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "bun test",
|
|
18
|
+
"lint": "eslint src/",
|
|
19
|
+
"prepublishOnly": "bun run build"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@quercle/sdk": "^0.2.1",
|
|
23
|
+
"ai": "^4.0.0",
|
|
24
|
+
"zod": "^3.24.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@eslint/js": "^9.39.1",
|
|
28
|
+
"@types/bun": "^1.3.3",
|
|
29
|
+
"@types/node": "^22.0.0",
|
|
30
|
+
"eslint": "^9.39.1",
|
|
31
|
+
"typescript": "^5.7.0",
|
|
32
|
+
"typescript-eslint": "^8.48.1"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"ai": ">=3.0.0"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
43
|
+
"keywords": [
|
|
44
|
+
"quercle",
|
|
45
|
+
"ai",
|
|
46
|
+
"vercel",
|
|
47
|
+
"sdk",
|
|
48
|
+
"search",
|
|
49
|
+
"fetch",
|
|
50
|
+
"web",
|
|
51
|
+
"tools"
|
|
52
|
+
],
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "https://github.com/quercledev/quercle-ai-sdk.git"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://quercle.dev"
|
|
59
|
+
}
|