@mariozechner/pi-ai 0.5.35 → 0.5.36
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 +31 -31
- package/dist/agent/tools/calculate.d.ts +2 -7
- package/dist/agent/tools/calculate.d.ts.map +1 -1
- package/dist/agent/tools/calculate.js +3 -3
- package/dist/agent/tools/calculate.js.map +1 -1
- package/dist/agent/tools/get-current-time.d.ts +2 -7
- package/dist/agent/tools/get-current-time.d.ts.map +1 -1
- package/dist/agent/tools/get-current-time.js +3 -3
- package/dist/agent/tools/get-current-time.js.map +1 -1
- package/dist/agent/types.d.ts +3 -3
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/models.generated.d.ts +7 -7
- package/dist/models.generated.js +38 -38
- package/dist/models.generated.js.map +1 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +1 -2
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/google.d.ts.map +1 -1
- package/dist/providers/google.js +1 -2
- package/dist/providers/google.js.map +1 -1
- package/dist/providers/openai-completions.d.ts.map +1 -1
- package/dist/providers/openai-completions.js +1 -2
- package/dist/providers/openai-completions.js.map +1 -1
- package/dist/providers/openai-responses.d.ts.map +1 -1
- package/dist/providers/openai-responses.js +1 -2
- package/dist/providers/openai-responses.js.map +1 -1
- package/dist/typebox-helpers.d.ts +17 -0
- package/dist/typebox-helpers.d.ts.map +1 -0
- package/dist/typebox-helpers.js +21 -0
- package/dist/typebox-helpers.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts +3 -3
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +22 -22
- package/dist/validation.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -24,17 +24,17 @@ npm install @mariozechner/pi-ai
|
|
|
24
24
|
## Quick Start
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
|
-
import { getModel, stream, complete, Context, Tool,
|
|
27
|
+
import { Type, getModel, stream, complete, Context, Tool, StringEnum } from '@mariozechner/pi-ai';
|
|
28
28
|
|
|
29
29
|
// Fully typed with auto-complete support for both providers and models
|
|
30
30
|
const model = getModel('openai', 'gpt-4o-mini');
|
|
31
31
|
|
|
32
|
-
// Define tools with
|
|
32
|
+
// Define tools with TypeBox schemas for type safety and validation
|
|
33
33
|
const tools: Tool[] = [{
|
|
34
34
|
name: 'get_time',
|
|
35
35
|
description: 'Get the current time',
|
|
36
|
-
parameters:
|
|
37
|
-
timezone:
|
|
36
|
+
parameters: Type.Object({
|
|
37
|
+
timezone: Type.Optional(Type.String({ description: 'Optional timezone (e.g., America/New_York)' }))
|
|
38
38
|
})
|
|
39
39
|
}];
|
|
40
40
|
|
|
@@ -133,36 +133,35 @@ for (const block of response.content) {
|
|
|
133
133
|
|
|
134
134
|
## Tools
|
|
135
135
|
|
|
136
|
-
Tools enable LLMs to interact with external systems. This library uses
|
|
136
|
+
Tools enable LLMs to interact with external systems. This library uses TypeBox schemas for type-safe tool definitions with automatic validation using AJV. TypeBox schemas can be serialized and deserialized as plain JSON, making them ideal for distributed systems.
|
|
137
137
|
|
|
138
138
|
### Defining Tools
|
|
139
139
|
|
|
140
140
|
```typescript
|
|
141
|
-
import {
|
|
141
|
+
import { Type, Tool, StringEnum } from '@mariozechner/pi-ai';
|
|
142
142
|
|
|
143
|
-
// Define tool parameters with
|
|
143
|
+
// Define tool parameters with TypeBox
|
|
144
144
|
const weatherTool: Tool = {
|
|
145
145
|
name: 'get_weather',
|
|
146
146
|
description: 'Get current weather for a location',
|
|
147
|
-
parameters:
|
|
148
|
-
location:
|
|
149
|
-
units:
|
|
147
|
+
parameters: Type.Object({
|
|
148
|
+
location: Type.String({ description: 'City name or coordinates' }),
|
|
149
|
+
units: StringEnum(['celsius', 'fahrenheit'], { default: 'celsius' })
|
|
150
150
|
})
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
//
|
|
153
|
+
// Note: For Google API compatibility, use StringEnum helper instead of Type.Enum
|
|
154
|
+
// Type.Enum generates anyOf/const patterns that Google doesn't support
|
|
155
|
+
|
|
154
156
|
const bookMeetingTool: Tool = {
|
|
155
157
|
name: 'book_meeting',
|
|
156
158
|
description: 'Schedule a meeting',
|
|
157
|
-
parameters:
|
|
158
|
-
title:
|
|
159
|
-
startTime:
|
|
160
|
-
endTime:
|
|
161
|
-
attendees:
|
|
162
|
-
})
|
|
163
|
-
data => new Date(data.endTime) > new Date(data.startTime),
|
|
164
|
-
{ message: 'End time must be after start time' }
|
|
165
|
-
)
|
|
159
|
+
parameters: Type.Object({
|
|
160
|
+
title: Type.String({ minLength: 1 }),
|
|
161
|
+
startTime: Type.String({ format: 'date-time' }),
|
|
162
|
+
endTime: Type.String({ format: 'date-time' }),
|
|
163
|
+
attendees: Type.Array(Type.String({ format: 'email' }), { minItems: 1 })
|
|
164
|
+
})
|
|
166
165
|
};
|
|
167
166
|
```
|
|
168
167
|
|
|
@@ -179,7 +178,7 @@ const response = await complete(model, context);
|
|
|
179
178
|
// Check for tool calls in the response
|
|
180
179
|
for (const block of response.content) {
|
|
181
180
|
if (block.type === 'toolCall') {
|
|
182
|
-
// Arguments are automatically validated against the
|
|
181
|
+
// Arguments are automatically validated against the TypeBox schema using AJV
|
|
183
182
|
// If validation fails, an error event is emitted
|
|
184
183
|
const result = await executeWeatherApi(block.arguments);
|
|
185
184
|
|
|
@@ -687,19 +686,20 @@ const messages = await stream.result();
|
|
|
687
686
|
context.messages.push(...messages);
|
|
688
687
|
```
|
|
689
688
|
|
|
690
|
-
### Defining Tools with
|
|
689
|
+
### Defining Tools with TypeBox
|
|
691
690
|
|
|
692
|
-
Tools use
|
|
691
|
+
Tools use TypeBox schemas for runtime validation and type inference:
|
|
693
692
|
|
|
694
693
|
```typescript
|
|
695
|
-
import {
|
|
696
|
-
import { AgentTool, AgentToolResult } from '@mariozechner/pi-ai';
|
|
694
|
+
import { Type, Static, AgentTool, AgentToolResult, StringEnum } from '@mariozechner/pi-ai';
|
|
697
695
|
|
|
698
|
-
const weatherSchema =
|
|
699
|
-
city:
|
|
700
|
-
units:
|
|
696
|
+
const weatherSchema = Type.Object({
|
|
697
|
+
city: Type.String({ minLength: 1 }),
|
|
698
|
+
units: StringEnum(['celsius', 'fahrenheit'], { default: 'celsius' })
|
|
701
699
|
});
|
|
702
700
|
|
|
701
|
+
type WeatherParams = Static<typeof weatherSchema>;
|
|
702
|
+
|
|
703
703
|
const weatherTool: AgentTool<typeof weatherSchema, { temp: number }> = {
|
|
704
704
|
label: 'Get Weather',
|
|
705
705
|
name: 'get_weather',
|
|
@@ -718,7 +718,7 @@ const weatherTool: AgentTool<typeof weatherSchema, { temp: number }> = {
|
|
|
718
718
|
|
|
719
719
|
### Validation and Error Handling
|
|
720
720
|
|
|
721
|
-
Tool arguments are automatically validated using the
|
|
721
|
+
Tool arguments are automatically validated using AJV with the TypeBox schema. Invalid arguments result in detailed error messages:
|
|
722
722
|
|
|
723
723
|
```typescript
|
|
724
724
|
// If the LLM calls with invalid arguments:
|
|
@@ -727,8 +727,8 @@ Tool arguments are automatically validated using the Zod schema. Invalid argumen
|
|
|
727
727
|
// The tool execution will fail with:
|
|
728
728
|
/*
|
|
729
729
|
Validation failed for tool "get_weather":
|
|
730
|
-
- city:
|
|
731
|
-
- units:
|
|
730
|
+
- city: must NOT have fewer than 1 characters
|
|
731
|
+
- units: must be equal to one of the allowed values
|
|
732
732
|
|
|
733
733
|
Received arguments:
|
|
734
734
|
{
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import type { AgentTool } from "../../agent";
|
|
3
2
|
export interface CalculateResult {
|
|
4
3
|
output: string;
|
|
5
4
|
details: undefined;
|
|
6
5
|
}
|
|
7
6
|
export declare function calculate(expression: string): CalculateResult;
|
|
8
|
-
declare const calculateSchema:
|
|
9
|
-
expression:
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
expression: string;
|
|
12
|
-
}, {
|
|
13
|
-
expression: string;
|
|
7
|
+
declare const calculateSchema: import("@sinclair/typebox").TObject<{
|
|
8
|
+
expression: import("@sinclair/typebox").TString;
|
|
14
9
|
}>;
|
|
15
10
|
export declare const calculateTool: AgentTool<typeof calculateSchema, undefined>;
|
|
16
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/calculate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculate.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/calculate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,CAAC;CACnB;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,CAO7D;AAED,QAAA,MAAM,eAAe;;EAEnB,CAAC;AAIH,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,OAAO,eAAe,EAAE,SAAS,CAQtE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
2
|
export function calculate(expression) {
|
|
3
3
|
try {
|
|
4
4
|
const result = new Function("return " + expression)();
|
|
@@ -8,8 +8,8 @@ export function calculate(expression) {
|
|
|
8
8
|
throw new Error(e.message || String(e));
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
const calculateSchema =
|
|
12
|
-
expression:
|
|
11
|
+
const calculateSchema = Type.Object({
|
|
12
|
+
expression: Type.String({ description: "The mathematical expression to evaluate" }),
|
|
13
13
|
});
|
|
14
14
|
export const calculateTool = {
|
|
15
15
|
label: "Calculator",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate.js","sourceRoot":"","sources":["../../../src/agent/tools/calculate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"calculate.js","sourceRoot":"","sources":["../../../src/agent/tools/calculate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAQtD,MAAM,UAAU,SAAS,CAAC,UAAkB;IAC3C,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC;QACtD,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,MAAM,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACpE,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;AACF,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;CACnF,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,aAAa,GAAiD;IAC1E,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,mCAAmC;IAChD,UAAU,EAAE,eAAe;IAC3B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE;QACpC,OAAO,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;CACD,CAAC","sourcesContent":["import { type Static, Type } from \"@sinclair/typebox\";\nimport type { AgentTool } from \"../../agent\";\n\nexport interface CalculateResult {\n\toutput: string;\n\tdetails: undefined;\n}\n\nexport function calculate(expression: string): CalculateResult {\n\ttry {\n\t\tconst result = new Function(\"return \" + expression)();\n\t\treturn { output: `${expression} = ${result}`, details: undefined };\n\t} catch (e: any) {\n\t\tthrow new Error(e.message || String(e));\n\t}\n}\n\nconst calculateSchema = Type.Object({\n\texpression: Type.String({ description: \"The mathematical expression to evaluate\" }),\n});\n\ntype CalculateParams = Static<typeof calculateSchema>;\n\nexport const calculateTool: AgentTool<typeof calculateSchema, undefined> = {\n\tlabel: \"Calculator\",\n\tname: \"calculate\",\n\tdescription: \"Evaluate mathematical expressions\",\n\tparameters: calculateSchema,\n\texecute: async (_toolCallId, args) => {\n\t\treturn calculate(args.expression);\n\t},\n};\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import type { AgentTool } from "../../agent";
|
|
3
2
|
import type { AgentToolResult } from "../types";
|
|
4
3
|
export interface GetCurrentTimeResult extends AgentToolResult<{
|
|
@@ -6,12 +5,8 @@ export interface GetCurrentTimeResult extends AgentToolResult<{
|
|
|
6
5
|
}> {
|
|
7
6
|
}
|
|
8
7
|
export declare function getCurrentTime(timezone?: string): Promise<GetCurrentTimeResult>;
|
|
9
|
-
declare const getCurrentTimeSchema:
|
|
10
|
-
timezone:
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
timezone?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
timezone?: string | undefined;
|
|
8
|
+
declare const getCurrentTimeSchema: import("@sinclair/typebox").TObject<{
|
|
9
|
+
timezone: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
15
10
|
}>;
|
|
16
11
|
export declare const getCurrentTimeTool: AgentTool<typeof getCurrentTimeSchema, {
|
|
17
12
|
utcTimestamp: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-current-time.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/get-current-time.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-current-time.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/get-current-time.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,oBAAqB,SAAQ,eAAe,CAAC;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;CAAG;AAE1F,wBAAsB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAoBrF;AAED,QAAA,MAAM,oBAAoB;;EAIxB,CAAC;AAIH,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,OAAO,oBAAoB,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAQ/F,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
2
|
export async function getCurrentTime(timezone) {
|
|
3
3
|
const date = new Date();
|
|
4
4
|
if (timezone) {
|
|
@@ -21,8 +21,8 @@ export async function getCurrentTime(timezone) {
|
|
|
21
21
|
details: { utcTimestamp: date.getTime() },
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
const getCurrentTimeSchema =
|
|
25
|
-
timezone:
|
|
24
|
+
const getCurrentTimeSchema = Type.Object({
|
|
25
|
+
timezone: Type.Optional(Type.String({ description: "Optional timezone (e.g., 'America/New_York', 'Europe/London')" })),
|
|
26
26
|
});
|
|
27
27
|
export const getCurrentTimeTool = {
|
|
28
28
|
label: "Current Time",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-current-time.js","sourceRoot":"","sources":["../../../src/agent/tools/get-current-time.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"get-current-time.js","sourceRoot":"","sources":["../../../src/agent/tools/get-current-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAMtD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAiB;IACrD,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,IAAI,QAAQ,EAAE,CAAC;QACd,IAAI,CAAC;YACJ,OAAO;gBACN,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;oBACpC,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE,MAAM;oBACjB,SAAS,EAAE,MAAM;iBACjB,CAAC;gBACF,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE;aACzC,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,uBAAuB,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC3F,CAAC;IACF,CAAC;IACD,OAAO;QACN,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAC9E,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE;KACzC,CAAC;AACH,CAAC;AAED,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CACtB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,+DAA+D,EAAE,CAAC,CAC7F;CACD,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAqE;IACnG,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,+BAA+B;IAC5C,UAAU,EAAE,oBAAoB;IAChC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE;QACpC,OAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACD,CAAC","sourcesContent":["import { type Static, Type } from \"@sinclair/typebox\";\nimport type { AgentTool } from \"../../agent\";\nimport type { AgentToolResult } from \"../types\";\n\nexport interface GetCurrentTimeResult extends AgentToolResult<{ utcTimestamp: number }> {}\n\nexport async function getCurrentTime(timezone?: string): Promise<GetCurrentTimeResult> {\n\tconst date = new Date();\n\tif (timezone) {\n\t\ttry {\n\t\t\treturn {\n\t\t\t\toutput: date.toLocaleString(\"en-US\", {\n\t\t\t\t\ttimeZone: timezone,\n\t\t\t\t\tdateStyle: \"full\",\n\t\t\t\t\ttimeStyle: \"long\",\n\t\t\t\t}),\n\t\t\t\tdetails: { utcTimestamp: date.getTime() },\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tthrow new Error(`Invalid timezone: ${timezone}. Current UTC time: ${date.toISOString()}`);\n\t\t}\n\t}\n\treturn {\n\t\toutput: date.toLocaleString(\"en-US\", { dateStyle: \"full\", timeStyle: \"long\" }),\n\t\tdetails: { utcTimestamp: date.getTime() },\n\t};\n}\n\nconst getCurrentTimeSchema = Type.Object({\n\ttimezone: Type.Optional(\n\t\tType.String({ description: \"Optional timezone (e.g., 'America/New_York', 'Europe/London')\" }),\n\t),\n});\n\ntype GetCurrentTimeParams = Static<typeof getCurrentTimeSchema>;\n\nexport const getCurrentTimeTool: AgentTool<typeof getCurrentTimeSchema, { utcTimestamp: number }> = {\n\tlabel: \"Current Time\",\n\tname: \"get_current_time\",\n\tdescription: \"Get the current date and time\",\n\tparameters: getCurrentTimeSchema,\n\texecute: async (_toolCallId, args) => {\n\t\treturn getCurrentTime(args.timezone);\n\t},\n};\n"]}
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Static, TSchema } from "@sinclair/typebox";
|
|
2
2
|
import type { AssistantMessage, AssistantMessageEvent, Message, Model, SimpleStreamOptions, Tool, ToolResultMessage } from "../types.js";
|
|
3
3
|
export interface AgentToolResult<T> {
|
|
4
4
|
output: string;
|
|
5
5
|
details: T;
|
|
6
6
|
}
|
|
7
|
-
export interface AgentTool<TParameters extends
|
|
7
|
+
export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {
|
|
8
8
|
label: string;
|
|
9
|
-
execute: (toolCallId: string, params:
|
|
9
|
+
execute: (toolCallId: string, params: Static<TParameters>, signal?: AbortSignal) => Promise<AgentToolResult<TDetails>>;
|
|
10
10
|
}
|
|
11
11
|
export interface AgentContext {
|
|
12
12
|
systemPrompt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EACX,gBAAgB,EAChB,qBAAqB,EACrB,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,IAAI,EACJ,iBAAiB,EACjB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,eAAe,CAAC,CAAC;IAEjC,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,EAAE,CAAC,CAAC;CACX;AAGD,MAAM,WAAW,SAAS,CAAC,WAAW,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,GAAG,GAAG,CAAE,SAAQ,IAAI,CAAC,WAAW,CAAC;IAE1G,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CACR,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,EAC3B,MAAM,CAAC,EAAE,WAAW,KAChB,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;CACxC;AAGD,MAAM,WAAW,YAAY;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;CACzB;AAGD,MAAM,MAAM,UAAU,GAEnB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GAEvB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GAEtB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAE3C;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,GAEnG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAEzC;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,GAEjF;IACA,IAAI,EAAE,oBAAoB,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACtC,OAAO,EAAE,OAAO,CAAC;CAChB,GAED;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAAC,WAAW,EAAE,iBAAiB,EAAE,CAAA;CAAE,GAG1F;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAG7D,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACxD,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;CACpH"}
|
package/dist/agent/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Static, TSchema } from \"@sinclair/typebox\";\nimport type {\n\tAssistantMessage,\n\tAssistantMessageEvent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTool,\n\tToolResultMessage,\n} from \"../types.js\";\n\nexport interface AgentToolResult<T> {\n\t// Output of the tool to be given to the LLM in ToolResultMessage.content\n\toutput: string;\n\t// Details to be displayed in a UI or loggedty\n\tdetails: T;\n}\n\n// AgentTool extends Tool but adds the execute function\nexport interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {\n\t// A human-readable label for the tool to be displayed in UI\n\tlabel: string;\n\texecute: (\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentToolResult<TDetails>>;\n}\n\n// AgentContext is like Context but uses AgentTool\nexport interface AgentContext {\n\tsystemPrompt: string;\n\tmessages: Message[];\n\ttools?: AgentTool<any>[];\n}\n\n// Event types\nexport type AgentEvent =\n\t// Emitted when the agent starts. An agent can emit multiple turns\n\t| { type: \"agent_start\" }\n\t// Emitted when a turn starts. A turn can emit an optional user message (initial prompt), an assistant message (response) and multiple tool result messages\n\t| { type: \"turn_start\" }\n\t// Emitted when a user, assistant or tool result message starts\n\t| { type: \"message_start\"; message: Message }\n\t// Emitted when an asssitant messages is updated due to streaming\n\t| { type: \"message_update\"; assistantMessageEvent: AssistantMessageEvent; message: AssistantMessage }\n\t// Emitted when a user, assistant or tool result message is complete\n\t| { type: \"message_end\"; message: Message }\n\t// Emitted when a tool execution starts\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: any }\n\t// Emitted when a tool execution completes\n\t| {\n\t\t\ttype: \"tool_execution_end\";\n\t\t\ttoolCallId: string;\n\t\t\ttoolName: string;\n\t\t\tresult: AgentToolResult<any> | string;\n\t\t\tisError: boolean;\n\t }\n\t// Emitted when a full turn completes\n\t| { type: \"turn_end\"; assistantMessage: AssistantMessage; toolResults: ToolResultMessage[] }\n\t// Emitted when the agent has completed all its turns. All messages from every turn are\n\t// contained in messages, which can be appended to the context\n\t| { type: \"agent_end\"; messages: AgentContext[\"messages\"] };\n\n// Configuration for prompt execution\nexport interface PromptConfig extends SimpleStreamOptions {\n\tmodel: Model<any>;\n\tpreprocessor?: (messages: AgentContext[\"messages\"], abortSignal?: AbortSignal) => Promise<AgentContext[\"messages\"]>;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type Static, Type } from "@sinclair/typebox";
|
|
2
2
|
export * from "./agent/index.js";
|
|
3
3
|
export * from "./models.js";
|
|
4
4
|
export * from "./providers/anthropic.js";
|
|
@@ -6,5 +6,6 @@ export * from "./providers/google.js";
|
|
|
6
6
|
export * from "./providers/openai-completions.js";
|
|
7
7
|
export * from "./providers/openai-responses.js";
|
|
8
8
|
export * from "./stream.js";
|
|
9
|
+
export * from "./typebox-helpers.js";
|
|
9
10
|
export * from "./types.js";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Type } from "@sinclair/typebox";
|
|
2
2
|
export * from "./agent/index.js";
|
|
3
3
|
export * from "./models.js";
|
|
4
4
|
export * from "./providers/anthropic.js";
|
|
@@ -6,5 +6,6 @@ export * from "./providers/google.js";
|
|
|
6
6
|
export * from "./providers/openai-completions.js";
|
|
7
7
|
export * from "./providers/openai-responses.js";
|
|
8
8
|
export * from "./stream.js";
|
|
9
|
+
export * from "./typebox-helpers.js";
|
|
9
10
|
export * from "./types.js";
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC","sourcesContent":["export { type Static, Type } from \"@sinclair/typebox\";\nexport * from \"./agent/index.js\";\nexport * from \"./models.js\";\nexport * from \"./providers/anthropic.js\";\nexport * from \"./providers/google.js\";\nexport * from \"./providers/openai-completions.js\";\nexport * from \"./providers/openai-responses.js\";\nexport * from \"./stream.js\";\nexport * from \"./typebox-helpers.js\";\nexport * from \"./types.js\";\n"]}
|
|
@@ -3074,7 +3074,7 @@ export declare const MODELS: {
|
|
|
3074
3074
|
contextWindow: number;
|
|
3075
3075
|
maxTokens: number;
|
|
3076
3076
|
};
|
|
3077
|
-
readonly "mistralai/mistral-7b-instruct
|
|
3077
|
+
readonly "mistralai/mistral-7b-instruct:free": {
|
|
3078
3078
|
id: string;
|
|
3079
3079
|
name: string;
|
|
3080
3080
|
api: "openai-completions";
|
|
@@ -3091,7 +3091,7 @@ export declare const MODELS: {
|
|
|
3091
3091
|
contextWindow: number;
|
|
3092
3092
|
maxTokens: number;
|
|
3093
3093
|
};
|
|
3094
|
-
readonly "mistralai/mistral-7b-instruct
|
|
3094
|
+
readonly "mistralai/mistral-7b-instruct": {
|
|
3095
3095
|
id: string;
|
|
3096
3096
|
name: string;
|
|
3097
3097
|
api: "openai-completions";
|
|
@@ -3108,7 +3108,7 @@ export declare const MODELS: {
|
|
|
3108
3108
|
contextWindow: number;
|
|
3109
3109
|
maxTokens: number;
|
|
3110
3110
|
};
|
|
3111
|
-
readonly "mistralai/mistral-7b-instruct": {
|
|
3111
|
+
readonly "mistralai/mistral-7b-instruct-v0.3": {
|
|
3112
3112
|
id: string;
|
|
3113
3113
|
name: string;
|
|
3114
3114
|
api: "openai-completions";
|
|
@@ -3159,7 +3159,7 @@ export declare const MODELS: {
|
|
|
3159
3159
|
contextWindow: number;
|
|
3160
3160
|
maxTokens: number;
|
|
3161
3161
|
};
|
|
3162
|
-
readonly "meta-llama/llama-3-
|
|
3162
|
+
readonly "meta-llama/llama-3-8b-instruct": {
|
|
3163
3163
|
id: string;
|
|
3164
3164
|
name: string;
|
|
3165
3165
|
api: "openai-completions";
|
|
@@ -3176,7 +3176,7 @@ export declare const MODELS: {
|
|
|
3176
3176
|
contextWindow: number;
|
|
3177
3177
|
maxTokens: number;
|
|
3178
3178
|
};
|
|
3179
|
-
readonly "meta-llama/llama-3-
|
|
3179
|
+
readonly "meta-llama/llama-3-70b-instruct": {
|
|
3180
3180
|
id: string;
|
|
3181
3181
|
name: string;
|
|
3182
3182
|
api: "openai-completions";
|
|
@@ -3295,7 +3295,7 @@ export declare const MODELS: {
|
|
|
3295
3295
|
contextWindow: number;
|
|
3296
3296
|
maxTokens: number;
|
|
3297
3297
|
};
|
|
3298
|
-
readonly "mistralai/mistral-
|
|
3298
|
+
readonly "mistralai/mistral-small": {
|
|
3299
3299
|
id: string;
|
|
3300
3300
|
name: string;
|
|
3301
3301
|
api: "openai-completions";
|
|
@@ -3312,7 +3312,7 @@ export declare const MODELS: {
|
|
|
3312
3312
|
contextWindow: number;
|
|
3313
3313
|
maxTokens: number;
|
|
3314
3314
|
};
|
|
3315
|
-
readonly "mistralai/mistral-
|
|
3315
|
+
readonly "mistralai/mistral-tiny": {
|
|
3316
3316
|
id: string;
|
|
3317
3317
|
name: string;
|
|
3318
3318
|
api: "openai-completions";
|
package/dist/models.generated.js
CHANGED
|
@@ -1696,7 +1696,7 @@ export const MODELS = {
|
|
|
1696
1696
|
cacheRead: 0,
|
|
1697
1697
|
cacheWrite: 0,
|
|
1698
1698
|
},
|
|
1699
|
-
contextWindow:
|
|
1699
|
+
contextWindow: 32768,
|
|
1700
1700
|
maxTokens: 4096,
|
|
1701
1701
|
},
|
|
1702
1702
|
"deepseek/deepseek-chat-v3.1": {
|
|
@@ -2898,12 +2898,12 @@ export const MODELS = {
|
|
|
2898
2898
|
reasoning: false,
|
|
2899
2899
|
input: ["text"],
|
|
2900
2900
|
cost: {
|
|
2901
|
-
input: 0.
|
|
2902
|
-
output: 0.
|
|
2901
|
+
input: 0.02,
|
|
2902
|
+
output: 0.02,
|
|
2903
2903
|
cacheRead: 0,
|
|
2904
2904
|
cacheWrite: 0,
|
|
2905
2905
|
},
|
|
2906
|
-
contextWindow:
|
|
2906
|
+
contextWindow: 16384,
|
|
2907
2907
|
maxTokens: 16384,
|
|
2908
2908
|
},
|
|
2909
2909
|
"qwen/qwen-2.5-72b-instruct": {
|
|
@@ -3006,7 +3006,7 @@ export const MODELS = {
|
|
|
3006
3006
|
cacheWrite: 0,
|
|
3007
3007
|
},
|
|
3008
3008
|
contextWindow: 131072,
|
|
3009
|
-
maxTokens:
|
|
3009
|
+
maxTokens: 131072,
|
|
3010
3010
|
},
|
|
3011
3011
|
"meta-llama/llama-3.1-8b-instruct": {
|
|
3012
3012
|
id: "meta-llama/llama-3.1-8b-instruct",
|
|
@@ -3076,43 +3076,43 @@ export const MODELS = {
|
|
|
3076
3076
|
contextWindow: 131072,
|
|
3077
3077
|
maxTokens: 128000,
|
|
3078
3078
|
},
|
|
3079
|
-
"mistralai/mistral-7b-instruct
|
|
3080
|
-
id: "mistralai/mistral-7b-instruct
|
|
3081
|
-
name: "Mistral: Mistral 7B Instruct
|
|
3079
|
+
"mistralai/mistral-7b-instruct:free": {
|
|
3080
|
+
id: "mistralai/mistral-7b-instruct:free",
|
|
3081
|
+
name: "Mistral: Mistral 7B Instruct (free)",
|
|
3082
3082
|
api: "openai-completions",
|
|
3083
3083
|
provider: "openrouter",
|
|
3084
3084
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
3085
3085
|
reasoning: false,
|
|
3086
3086
|
input: ["text"],
|
|
3087
3087
|
cost: {
|
|
3088
|
-
input: 0
|
|
3089
|
-
output: 0
|
|
3088
|
+
input: 0,
|
|
3089
|
+
output: 0,
|
|
3090
3090
|
cacheRead: 0,
|
|
3091
3091
|
cacheWrite: 0,
|
|
3092
3092
|
},
|
|
3093
3093
|
contextWindow: 32768,
|
|
3094
3094
|
maxTokens: 16384,
|
|
3095
3095
|
},
|
|
3096
|
-
"mistralai/mistral-7b-instruct
|
|
3097
|
-
id: "mistralai/mistral-7b-instruct
|
|
3098
|
-
name: "Mistral: Mistral 7B Instruct
|
|
3096
|
+
"mistralai/mistral-7b-instruct": {
|
|
3097
|
+
id: "mistralai/mistral-7b-instruct",
|
|
3098
|
+
name: "Mistral: Mistral 7B Instruct",
|
|
3099
3099
|
api: "openai-completions",
|
|
3100
3100
|
provider: "openrouter",
|
|
3101
3101
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
3102
3102
|
reasoning: false,
|
|
3103
3103
|
input: ["text"],
|
|
3104
3104
|
cost: {
|
|
3105
|
-
input: 0,
|
|
3106
|
-
output: 0,
|
|
3105
|
+
input: 0.028,
|
|
3106
|
+
output: 0.054,
|
|
3107
3107
|
cacheRead: 0,
|
|
3108
3108
|
cacheWrite: 0,
|
|
3109
3109
|
},
|
|
3110
3110
|
contextWindow: 32768,
|
|
3111
3111
|
maxTokens: 16384,
|
|
3112
3112
|
},
|
|
3113
|
-
"mistralai/mistral-7b-instruct": {
|
|
3114
|
-
id: "mistralai/mistral-7b-instruct",
|
|
3115
|
-
name: "Mistral: Mistral 7B Instruct",
|
|
3113
|
+
"mistralai/mistral-7b-instruct-v0.3": {
|
|
3114
|
+
id: "mistralai/mistral-7b-instruct-v0.3",
|
|
3115
|
+
name: "Mistral: Mistral 7B Instruct v0.3",
|
|
3116
3116
|
api: "openai-completions",
|
|
3117
3117
|
provider: "openrouter",
|
|
3118
3118
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
@@ -3161,34 +3161,34 @@ export const MODELS = {
|
|
|
3161
3161
|
contextWindow: 128000,
|
|
3162
3162
|
maxTokens: 4096,
|
|
3163
3163
|
},
|
|
3164
|
-
"meta-llama/llama-3-
|
|
3165
|
-
id: "meta-llama/llama-3-
|
|
3166
|
-
name: "Meta: Llama 3
|
|
3164
|
+
"meta-llama/llama-3-8b-instruct": {
|
|
3165
|
+
id: "meta-llama/llama-3-8b-instruct",
|
|
3166
|
+
name: "Meta: Llama 3 8B Instruct",
|
|
3167
3167
|
api: "openai-completions",
|
|
3168
3168
|
provider: "openrouter",
|
|
3169
3169
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
3170
3170
|
reasoning: false,
|
|
3171
3171
|
input: ["text"],
|
|
3172
3172
|
cost: {
|
|
3173
|
-
input: 0.
|
|
3174
|
-
output: 0.
|
|
3173
|
+
input: 0.03,
|
|
3174
|
+
output: 0.06,
|
|
3175
3175
|
cacheRead: 0,
|
|
3176
3176
|
cacheWrite: 0,
|
|
3177
3177
|
},
|
|
3178
3178
|
contextWindow: 8192,
|
|
3179
3179
|
maxTokens: 16384,
|
|
3180
3180
|
},
|
|
3181
|
-
"meta-llama/llama-3-
|
|
3182
|
-
id: "meta-llama/llama-3-
|
|
3183
|
-
name: "Meta: Llama 3
|
|
3181
|
+
"meta-llama/llama-3-70b-instruct": {
|
|
3182
|
+
id: "meta-llama/llama-3-70b-instruct",
|
|
3183
|
+
name: "Meta: Llama 3 70B Instruct",
|
|
3184
3184
|
api: "openai-completions",
|
|
3185
3185
|
provider: "openrouter",
|
|
3186
3186
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
3187
3187
|
reasoning: false,
|
|
3188
3188
|
input: ["text"],
|
|
3189
3189
|
cost: {
|
|
3190
|
-
input: 0.
|
|
3191
|
-
output: 0.
|
|
3190
|
+
input: 0.3,
|
|
3191
|
+
output: 0.39999999999999997,
|
|
3192
3192
|
cacheRead: 0,
|
|
3193
3193
|
cacheWrite: 0,
|
|
3194
3194
|
},
|
|
@@ -3297,34 +3297,34 @@ export const MODELS = {
|
|
|
3297
3297
|
contextWindow: 128000,
|
|
3298
3298
|
maxTokens: 4096,
|
|
3299
3299
|
},
|
|
3300
|
-
"mistralai/mistral-
|
|
3301
|
-
id: "mistralai/mistral-
|
|
3302
|
-
name: "Mistral
|
|
3300
|
+
"mistralai/mistral-small": {
|
|
3301
|
+
id: "mistralai/mistral-small",
|
|
3302
|
+
name: "Mistral Small",
|
|
3303
3303
|
api: "openai-completions",
|
|
3304
3304
|
provider: "openrouter",
|
|
3305
3305
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
3306
3306
|
reasoning: false,
|
|
3307
3307
|
input: ["text"],
|
|
3308
3308
|
cost: {
|
|
3309
|
-
input: 0.
|
|
3310
|
-
output: 0.
|
|
3309
|
+
input: 0.19999999999999998,
|
|
3310
|
+
output: 0.6,
|
|
3311
3311
|
cacheRead: 0,
|
|
3312
3312
|
cacheWrite: 0,
|
|
3313
3313
|
},
|
|
3314
3314
|
contextWindow: 32768,
|
|
3315
3315
|
maxTokens: 4096,
|
|
3316
3316
|
},
|
|
3317
|
-
"mistralai/mistral-
|
|
3318
|
-
id: "mistralai/mistral-
|
|
3319
|
-
name: "Mistral
|
|
3317
|
+
"mistralai/mistral-tiny": {
|
|
3318
|
+
id: "mistralai/mistral-tiny",
|
|
3319
|
+
name: "Mistral Tiny",
|
|
3320
3320
|
api: "openai-completions",
|
|
3321
3321
|
provider: "openrouter",
|
|
3322
3322
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
3323
3323
|
reasoning: false,
|
|
3324
3324
|
input: ["text"],
|
|
3325
3325
|
cost: {
|
|
3326
|
-
input: 0.
|
|
3327
|
-
output: 0.
|
|
3326
|
+
input: 0.25,
|
|
3327
|
+
output: 0.25,
|
|
3328
3328
|
cacheRead: 0,
|
|
3329
3329
|
cacheWrite: 0,
|
|
3330
3330
|
},
|