@effect/ai 0.26.0 → 0.27.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/Chat/package.json +6 -0
- package/EmbeddingModel/package.json +6 -0
- package/IdGenerator/package.json +6 -0
- package/LanguageModel/package.json +6 -0
- package/Model/package.json +6 -0
- package/Prompt/package.json +6 -0
- package/Response/package.json +6 -0
- package/Telemetry/package.json +6 -0
- package/Tool/package.json +6 -0
- package/Toolkit/package.json +6 -0
- package/dist/cjs/AiError.js +575 -11
- package/dist/cjs/AiError.js.map +1 -1
- package/dist/cjs/Chat.js +302 -0
- package/dist/cjs/Chat.js.map +1 -0
- package/dist/cjs/EmbeddingModel.js +184 -0
- package/dist/cjs/EmbeddingModel.js.map +1 -0
- package/dist/cjs/IdGenerator.js +255 -0
- package/dist/cjs/IdGenerator.js.map +1 -0
- package/dist/cjs/LanguageModel.js +584 -0
- package/dist/cjs/LanguageModel.js.map +1 -0
- package/dist/cjs/McpServer.js +12 -4
- package/dist/cjs/McpServer.js.map +1 -1
- package/dist/cjs/Model.js +118 -0
- package/dist/cjs/Model.js.map +1 -0
- package/dist/cjs/Prompt.js +649 -0
- package/dist/cjs/Prompt.js.map +1 -0
- package/dist/cjs/Response.js +635 -0
- package/dist/cjs/Response.js.map +1 -0
- package/dist/cjs/Telemetry.js +176 -0
- package/dist/cjs/Telemetry.js.map +1 -0
- package/dist/cjs/Tokenizer.js +87 -8
- package/dist/cjs/Tokenizer.js.map +1 -1
- package/dist/cjs/Tool.js +556 -0
- package/dist/cjs/Tool.js.map +1 -0
- package/dist/cjs/Toolkit.js +279 -0
- package/dist/cjs/Toolkit.js.map +1 -0
- package/dist/cjs/index.js +21 -19
- package/dist/dts/AiError.d.ts +577 -9
- package/dist/dts/AiError.d.ts.map +1 -1
- package/dist/dts/Chat.d.ts +356 -0
- package/dist/dts/Chat.d.ts.map +1 -0
- package/dist/dts/EmbeddingModel.d.ts +153 -0
- package/dist/dts/EmbeddingModel.d.ts.map +1 -0
- package/dist/dts/IdGenerator.d.ts +272 -0
- package/dist/dts/IdGenerator.d.ts.map +1 -0
- package/dist/dts/LanguageModel.d.ts +458 -0
- package/dist/dts/LanguageModel.d.ts.map +1 -0
- package/dist/dts/McpSchema.d.ts +25 -25
- package/dist/dts/McpServer.d.ts +6 -4
- package/dist/dts/McpServer.d.ts.map +1 -1
- package/dist/dts/Model.d.ts +124 -0
- package/dist/dts/Model.d.ts.map +1 -0
- package/dist/dts/Prompt.d.ts +1119 -0
- package/dist/dts/Prompt.d.ts.map +1 -0
- package/dist/dts/Response.d.ts +1519 -0
- package/dist/dts/Response.d.ts.map +1 -0
- package/dist/dts/Telemetry.d.ts +520 -0
- package/dist/dts/Telemetry.d.ts.map +1 -0
- package/dist/dts/Tokenizer.d.ts +131 -13
- package/dist/dts/Tokenizer.d.ts.map +1 -1
- package/dist/dts/Tool.d.ts +876 -0
- package/dist/dts/Tool.d.ts.map +1 -0
- package/dist/dts/Toolkit.d.ts +310 -0
- package/dist/dts/Toolkit.d.ts.map +1 -0
- package/dist/dts/index.d.ts +498 -13
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/AiError.js +570 -10
- package/dist/esm/AiError.js.map +1 -1
- package/dist/esm/Chat.js +291 -0
- package/dist/esm/Chat.js.map +1 -0
- package/dist/esm/EmbeddingModel.js +173 -0
- package/dist/esm/EmbeddingModel.js.map +1 -0
- package/dist/esm/IdGenerator.js +245 -0
- package/dist/esm/IdGenerator.js.map +1 -0
- package/dist/esm/LanguageModel.js +572 -0
- package/dist/esm/LanguageModel.js.map +1 -0
- package/dist/esm/McpServer.js +12 -4
- package/dist/esm/McpServer.js.map +1 -1
- package/dist/esm/Model.js +108 -0
- package/dist/esm/Model.js.map +1 -0
- package/dist/esm/Prompt.js +633 -0
- package/dist/esm/Prompt.js.map +1 -0
- package/dist/esm/Response.js +619 -0
- package/dist/esm/Response.js.map +1 -0
- package/dist/esm/Telemetry.js +166 -0
- package/dist/esm/Telemetry.js.map +1 -0
- package/dist/esm/Tokenizer.js +87 -8
- package/dist/esm/Tokenizer.js.map +1 -1
- package/dist/esm/Tool.js +534 -0
- package/dist/esm/Tool.js.map +1 -0
- package/dist/esm/Toolkit.js +269 -0
- package/dist/esm/Toolkit.js.map +1 -0
- package/dist/esm/index.js +498 -13
- package/dist/esm/index.js.map +1 -1
- package/package.json +76 -68
- package/src/AiError.ts +739 -9
- package/src/Chat.ts +546 -0
- package/src/EmbeddingModel.ts +311 -0
- package/src/IdGenerator.ts +320 -0
- package/src/LanguageModel.ts +1074 -0
- package/src/McpServer.ts +337 -194
- package/src/Model.ts +155 -0
- package/src/Prompt.ts +1616 -0
- package/src/Response.ts +2131 -0
- package/src/Telemetry.ts +655 -0
- package/src/Tokenizer.ts +145 -24
- package/src/Tool.ts +1267 -0
- package/src/Toolkit.ts +516 -0
- package/src/index.ts +499 -13
- package/AiChat/package.json +0 -6
- package/AiEmbeddingModel/package.json +0 -6
- package/AiInput/package.json +0 -6
- package/AiLanguageModel/package.json +0 -6
- package/AiModel/package.json +0 -6
- package/AiResponse/package.json +0 -6
- package/AiTelemetry/package.json +0 -6
- package/AiTool/package.json +0 -6
- package/AiToolkit/package.json +0 -6
- package/dist/cjs/AiChat.js +0 -122
- package/dist/cjs/AiChat.js.map +0 -1
- package/dist/cjs/AiEmbeddingModel.js +0 -109
- package/dist/cjs/AiEmbeddingModel.js.map +0 -1
- package/dist/cjs/AiInput.js +0 -458
- package/dist/cjs/AiInput.js.map +0 -1
- package/dist/cjs/AiLanguageModel.js +0 -351
- package/dist/cjs/AiLanguageModel.js.map +0 -1
- package/dist/cjs/AiModel.js +0 -37
- package/dist/cjs/AiModel.js.map +0 -1
- package/dist/cjs/AiResponse.js +0 -681
- package/dist/cjs/AiResponse.js.map +0 -1
- package/dist/cjs/AiTelemetry.js +0 -58
- package/dist/cjs/AiTelemetry.js.map +0 -1
- package/dist/cjs/AiTool.js +0 -150
- package/dist/cjs/AiTool.js.map +0 -1
- package/dist/cjs/AiToolkit.js +0 -157
- package/dist/cjs/AiToolkit.js.map +0 -1
- package/dist/cjs/internal/common.js +0 -21
- package/dist/cjs/internal/common.js.map +0 -1
- package/dist/dts/AiChat.d.ts +0 -101
- package/dist/dts/AiChat.d.ts.map +0 -1
- package/dist/dts/AiEmbeddingModel.d.ts +0 -65
- package/dist/dts/AiEmbeddingModel.d.ts.map +0 -1
- package/dist/dts/AiInput.d.ts +0 -590
- package/dist/dts/AiInput.d.ts.map +0 -1
- package/dist/dts/AiLanguageModel.d.ts +0 -302
- package/dist/dts/AiLanguageModel.d.ts.map +0 -1
- package/dist/dts/AiModel.d.ts +0 -25
- package/dist/dts/AiModel.d.ts.map +0 -1
- package/dist/dts/AiResponse.d.ts +0 -863
- package/dist/dts/AiResponse.d.ts.map +0 -1
- package/dist/dts/AiTelemetry.d.ts +0 -242
- package/dist/dts/AiTelemetry.d.ts.map +0 -1
- package/dist/dts/AiTool.d.ts +0 -334
- package/dist/dts/AiTool.d.ts.map +0 -1
- package/dist/dts/AiToolkit.d.ts +0 -96
- package/dist/dts/AiToolkit.d.ts.map +0 -1
- package/dist/dts/internal/common.d.ts +0 -2
- package/dist/dts/internal/common.d.ts.map +0 -1
- package/dist/esm/AiChat.js +0 -111
- package/dist/esm/AiChat.js.map +0 -1
- package/dist/esm/AiEmbeddingModel.js +0 -98
- package/dist/esm/AiEmbeddingModel.js.map +0 -1
- package/dist/esm/AiInput.js +0 -433
- package/dist/esm/AiInput.js.map +0 -1
- package/dist/esm/AiLanguageModel.js +0 -340
- package/dist/esm/AiLanguageModel.js.map +0 -1
- package/dist/esm/AiModel.js +0 -29
- package/dist/esm/AiModel.js.map +0 -1
- package/dist/esm/AiResponse.js +0 -657
- package/dist/esm/AiResponse.js.map +0 -1
- package/dist/esm/AiTelemetry.js +0 -48
- package/dist/esm/AiTelemetry.js.map +0 -1
- package/dist/esm/AiTool.js +0 -134
- package/dist/esm/AiTool.js.map +0 -1
- package/dist/esm/AiToolkit.js +0 -147
- package/dist/esm/AiToolkit.js.map +0 -1
- package/dist/esm/internal/common.js +0 -14
- package/dist/esm/internal/common.js.map +0 -1
- package/src/AiChat.ts +0 -251
- package/src/AiEmbeddingModel.ts +0 -169
- package/src/AiInput.ts +0 -602
- package/src/AiLanguageModel.ts +0 -685
- package/src/AiModel.ts +0 -53
- package/src/AiResponse.ts +0 -986
- package/src/AiTelemetry.ts +0 -333
- package/src/AiTool.ts +0 -579
- package/src/AiToolkit.ts +0 -265
- package/src/internal/common.ts +0 -12
package/dist/dts/AiResponse.d.ts
DELETED
|
@@ -1,863 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @since 1.0.0
|
|
3
|
-
*/
|
|
4
|
-
import type * as Context from "effect/Context";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
|
-
import * as Option from "effect/Option";
|
|
7
|
-
import * as Schema from "effect/Schema";
|
|
8
|
-
import { AiError } from "./AiError.js";
|
|
9
|
-
import type * as AiTool from "./AiTool.js";
|
|
10
|
-
/**
|
|
11
|
-
* @since 1.0.0
|
|
12
|
-
* @category Type Ids
|
|
13
|
-
*/
|
|
14
|
-
export declare const TypeId: unique symbol;
|
|
15
|
-
/**
|
|
16
|
-
* @since 1.0.0
|
|
17
|
-
* @category Type Ids
|
|
18
|
-
*/
|
|
19
|
-
export type TypeId = typeof TypeId;
|
|
20
|
-
declare const AiResponse_base: Schema.Class<AiResponse, {
|
|
21
|
-
/**
|
|
22
|
-
* The parts of the response.
|
|
23
|
-
*/
|
|
24
|
-
parts: Schema.Array$<Schema.suspend<TextPart | ReasoningPart | RedactedReasoningPart | ToolCallPart | MetadataPart | FinishPart, {
|
|
25
|
-
readonly _tag: "TextPart";
|
|
26
|
-
readonly text: string;
|
|
27
|
-
readonly annotations?: readonly ({
|
|
28
|
-
readonly _tag: "ContentSourceAnnotation";
|
|
29
|
-
readonly id: string;
|
|
30
|
-
readonly index: number;
|
|
31
|
-
readonly type: string;
|
|
32
|
-
readonly referencedContent: string;
|
|
33
|
-
readonly startIndex: number;
|
|
34
|
-
readonly endIndex: number;
|
|
35
|
-
} | {
|
|
36
|
-
readonly _tag: "FileAnnotation";
|
|
37
|
-
readonly id: string;
|
|
38
|
-
readonly index: number;
|
|
39
|
-
readonly type: string;
|
|
40
|
-
} | {
|
|
41
|
-
readonly _tag: "UrlAnnotation";
|
|
42
|
-
readonly startIndex: number;
|
|
43
|
-
readonly endIndex: number;
|
|
44
|
-
readonly url: string;
|
|
45
|
-
readonly title: string;
|
|
46
|
-
})[] | undefined;
|
|
47
|
-
} | {
|
|
48
|
-
readonly _tag: "ReasoningPart";
|
|
49
|
-
readonly reasoningText: string;
|
|
50
|
-
readonly signature?: string | undefined;
|
|
51
|
-
} | {
|
|
52
|
-
readonly _tag: "RedactedReasoningPart";
|
|
53
|
-
readonly redactedText: string;
|
|
54
|
-
} | {
|
|
55
|
-
readonly _tag: "ToolCallPart";
|
|
56
|
-
readonly name: string;
|
|
57
|
-
readonly id: string;
|
|
58
|
-
readonly params: unknown;
|
|
59
|
-
} | {
|
|
60
|
-
readonly _tag: "MetadataPart";
|
|
61
|
-
readonly model: string;
|
|
62
|
-
readonly id?: string | undefined;
|
|
63
|
-
readonly timestamp?: number | undefined;
|
|
64
|
-
} | {
|
|
65
|
-
readonly _tag: "FinishPart";
|
|
66
|
-
readonly usage: {
|
|
67
|
-
readonly inputTokens: number;
|
|
68
|
-
readonly outputTokens: number;
|
|
69
|
-
readonly totalTokens: number;
|
|
70
|
-
readonly reasoningTokens: number;
|
|
71
|
-
readonly cacheReadInputTokens: number;
|
|
72
|
-
readonly cacheWriteInputTokens: number;
|
|
73
|
-
};
|
|
74
|
-
readonly reason: "length" | "stop" | "content-filter" | "tool-calls" | "error" | "other" | "unknown";
|
|
75
|
-
readonly providerMetadata?: {
|
|
76
|
-
readonly [x: string]: {
|
|
77
|
-
readonly [x: string]: unknown;
|
|
78
|
-
};
|
|
79
|
-
} | undefined;
|
|
80
|
-
}, never>>;
|
|
81
|
-
}, Schema.Struct.Encoded<{
|
|
82
|
-
/**
|
|
83
|
-
* The parts of the response.
|
|
84
|
-
*/
|
|
85
|
-
parts: Schema.Array$<Schema.suspend<TextPart | ReasoningPart | RedactedReasoningPart | ToolCallPart | MetadataPart | FinishPart, {
|
|
86
|
-
readonly _tag: "TextPart";
|
|
87
|
-
readonly text: string;
|
|
88
|
-
readonly annotations?: readonly ({
|
|
89
|
-
readonly _tag: "ContentSourceAnnotation";
|
|
90
|
-
readonly id: string;
|
|
91
|
-
readonly index: number;
|
|
92
|
-
readonly type: string;
|
|
93
|
-
readonly referencedContent: string;
|
|
94
|
-
readonly startIndex: number;
|
|
95
|
-
readonly endIndex: number;
|
|
96
|
-
} | {
|
|
97
|
-
readonly _tag: "FileAnnotation";
|
|
98
|
-
readonly id: string;
|
|
99
|
-
readonly index: number;
|
|
100
|
-
readonly type: string;
|
|
101
|
-
} | {
|
|
102
|
-
readonly _tag: "UrlAnnotation";
|
|
103
|
-
readonly startIndex: number;
|
|
104
|
-
readonly endIndex: number;
|
|
105
|
-
readonly url: string;
|
|
106
|
-
readonly title: string;
|
|
107
|
-
})[] | undefined;
|
|
108
|
-
} | {
|
|
109
|
-
readonly _tag: "ReasoningPart";
|
|
110
|
-
readonly reasoningText: string;
|
|
111
|
-
readonly signature?: string | undefined;
|
|
112
|
-
} | {
|
|
113
|
-
readonly _tag: "RedactedReasoningPart";
|
|
114
|
-
readonly redactedText: string;
|
|
115
|
-
} | {
|
|
116
|
-
readonly _tag: "ToolCallPart";
|
|
117
|
-
readonly name: string;
|
|
118
|
-
readonly id: string;
|
|
119
|
-
readonly params: unknown;
|
|
120
|
-
} | {
|
|
121
|
-
readonly _tag: "MetadataPart";
|
|
122
|
-
readonly model: string;
|
|
123
|
-
readonly id?: string | undefined;
|
|
124
|
-
readonly timestamp?: number | undefined;
|
|
125
|
-
} | {
|
|
126
|
-
readonly _tag: "FinishPart";
|
|
127
|
-
readonly usage: {
|
|
128
|
-
readonly inputTokens: number;
|
|
129
|
-
readonly outputTokens: number;
|
|
130
|
-
readonly totalTokens: number;
|
|
131
|
-
readonly reasoningTokens: number;
|
|
132
|
-
readonly cacheReadInputTokens: number;
|
|
133
|
-
readonly cacheWriteInputTokens: number;
|
|
134
|
-
};
|
|
135
|
-
readonly reason: "length" | "stop" | "content-filter" | "tool-calls" | "error" | "other" | "unknown";
|
|
136
|
-
readonly providerMetadata?: {
|
|
137
|
-
readonly [x: string]: {
|
|
138
|
-
readonly [x: string]: unknown;
|
|
139
|
-
};
|
|
140
|
-
} | undefined;
|
|
141
|
-
}, never>>;
|
|
142
|
-
}>, never, {
|
|
143
|
-
readonly parts: readonly (TextPart | ReasoningPart | RedactedReasoningPart | ToolCallPart | MetadataPart | FinishPart)[];
|
|
144
|
-
}, {}, {}>;
|
|
145
|
-
/**
|
|
146
|
-
* Represents a response received from a large language model.
|
|
147
|
-
*
|
|
148
|
-
* @since 1.0.0
|
|
149
|
-
* @category Models
|
|
150
|
-
*/
|
|
151
|
-
export declare class AiResponse extends AiResponse_base {
|
|
152
|
-
/**
|
|
153
|
-
* @since 1.0.0
|
|
154
|
-
*/
|
|
155
|
-
readonly [TypeId]: TypeId;
|
|
156
|
-
/**
|
|
157
|
-
* Returns the generated text content of the response.
|
|
158
|
-
*/
|
|
159
|
-
get text(): string;
|
|
160
|
-
/**
|
|
161
|
-
* Returns the finish reason for the response, or `"unknown"` if the finish
|
|
162
|
-
* reason is not known.
|
|
163
|
-
*/
|
|
164
|
-
get finishReason(): FinishReason;
|
|
165
|
-
/**
|
|
166
|
-
* Returns all tool calls contained within the response.
|
|
167
|
-
*/
|
|
168
|
-
get toolCalls(): ReadonlyArray<ToolCallPart>;
|
|
169
|
-
/**
|
|
170
|
-
* Attempts to retrieve provider-specific response metadata.
|
|
171
|
-
*/
|
|
172
|
-
getProviderMetadata<I, S>(tag: Context.Tag<I, S>): Option.Option<S>;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* @since 1.0.0
|
|
176
|
-
* @category Models
|
|
177
|
-
*/
|
|
178
|
-
export declare const FromJson: Schema.transform<Schema.SchemaClass<unknown, string, never>, typeof AiResponse>;
|
|
179
|
-
/**
|
|
180
|
-
* @since 1.0.0
|
|
181
|
-
* @category Type Ids
|
|
182
|
-
*/
|
|
183
|
-
export declare const StructuredResponseTypeId: unique symbol;
|
|
184
|
-
/**
|
|
185
|
-
* @since 1.0.0
|
|
186
|
-
* @category Type Ids
|
|
187
|
-
*/
|
|
188
|
-
export type StructuredResponseTypeId = typeof StructuredResponseTypeId;
|
|
189
|
-
/**
|
|
190
|
-
* Represents a response generated by a large language model that includes
|
|
191
|
-
* structured output.
|
|
192
|
-
*
|
|
193
|
-
* @since 1.0.0
|
|
194
|
-
* @category Models
|
|
195
|
-
*/
|
|
196
|
-
export declare class WithStructuredOutput<A> extends AiResponse {
|
|
197
|
-
/**
|
|
198
|
-
* @since 1.0.0
|
|
199
|
-
*/
|
|
200
|
-
readonly [StructuredResponseTypeId]: StructuredResponseTypeId;
|
|
201
|
-
/**
|
|
202
|
-
* The identifier of the tool which generated the structured output.
|
|
203
|
-
*/
|
|
204
|
-
readonly id: ToolCallId;
|
|
205
|
-
/**
|
|
206
|
-
* The name of the tool which generated the structured output.
|
|
207
|
-
*/
|
|
208
|
-
readonly name: string;
|
|
209
|
-
/**
|
|
210
|
-
* The structured output generated by the model.
|
|
211
|
-
*/
|
|
212
|
-
readonly value: A;
|
|
213
|
-
constructor(props: {
|
|
214
|
-
/**
|
|
215
|
-
* The identifier of the tool which generated the structured output.
|
|
216
|
-
*/
|
|
217
|
-
readonly id: ToolCallId;
|
|
218
|
-
/**
|
|
219
|
-
* The name of the tool which generated the structured output.
|
|
220
|
-
*/
|
|
221
|
-
readonly name: string;
|
|
222
|
-
/**
|
|
223
|
-
* The structured output generated by the model.
|
|
224
|
-
*/
|
|
225
|
-
readonly value: A;
|
|
226
|
-
/**
|
|
227
|
-
* The parts of the response.
|
|
228
|
-
*/
|
|
229
|
-
readonly parts: ReadonlyArray<Part>;
|
|
230
|
-
}, options?: Schema.MakeOptions);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* @since 1.0.0
|
|
234
|
-
* @category Type Ids
|
|
235
|
-
*/
|
|
236
|
-
export declare const WithToolCallResultsTypeId: unique symbol;
|
|
237
|
-
/**
|
|
238
|
-
* @since 1.0.0
|
|
239
|
-
* @category Type Ids
|
|
240
|
-
*/
|
|
241
|
-
export type WithToolCallResultsTypeId = typeof WithToolCallResultsTypeId;
|
|
242
|
-
/**
|
|
243
|
-
* Represents a response generated by a large language model that includes
|
|
244
|
-
* tool call results.
|
|
245
|
-
*
|
|
246
|
-
* @since 1.0.0
|
|
247
|
-
* @category Models
|
|
248
|
-
*/
|
|
249
|
-
export declare class WithToolCallResults<Tools extends AiTool.Any> extends AiResponse {
|
|
250
|
-
/**
|
|
251
|
-
* @since 1.0.0
|
|
252
|
-
*/
|
|
253
|
-
readonly [WithToolCallResultsTypeId]: WithToolCallResultsTypeId;
|
|
254
|
-
/**
|
|
255
|
-
* The tool call results, represented as a mapping between the tool call
|
|
256
|
-
* identifier and the result of the tool call handler.
|
|
257
|
-
*/
|
|
258
|
-
readonly results: ReadonlyMap<ToolCallId, {
|
|
259
|
-
readonly name: string;
|
|
260
|
-
readonly result: AiTool.Success<Tools>;
|
|
261
|
-
}>;
|
|
262
|
-
/**
|
|
263
|
-
* The encoded tool call results, suitable for incorporation into subsequent
|
|
264
|
-
* requests to the large language model.
|
|
265
|
-
*/
|
|
266
|
-
readonly encodedResults: ReadonlyMap<ToolCallId, {
|
|
267
|
-
readonly name: string;
|
|
268
|
-
readonly result: unknown;
|
|
269
|
-
}>;
|
|
270
|
-
constructor(props: {
|
|
271
|
-
/**
|
|
272
|
-
* The tool call results, represented as a mapping between the tool call
|
|
273
|
-
* identifier and the result of the tool call handler.
|
|
274
|
-
*/
|
|
275
|
-
readonly results: ReadonlyMap<ToolCallId, {
|
|
276
|
-
readonly name: string;
|
|
277
|
-
readonly result: AiTool.Success<Tools>;
|
|
278
|
-
}>;
|
|
279
|
-
/**
|
|
280
|
-
* The encoded tool call results, suitable for incorporation into subsequent
|
|
281
|
-
* requests to the large language model.
|
|
282
|
-
*/
|
|
283
|
-
readonly encodedResults: ReadonlyMap<ToolCallId, {
|
|
284
|
-
readonly name: string;
|
|
285
|
-
readonly result: unknown;
|
|
286
|
-
}>;
|
|
287
|
-
/**
|
|
288
|
-
* The parts of the response.
|
|
289
|
-
*/
|
|
290
|
-
readonly parts: ReadonlyArray<Part>;
|
|
291
|
-
}, options?: Schema.MakeOptions);
|
|
292
|
-
getToolCallResult(toolName: AiTool.Name<Tools>): Option.Option<AiTool.Success<Tools>>;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* @since 1.0.0
|
|
296
|
-
* @category Type Ids
|
|
297
|
-
*/
|
|
298
|
-
export declare const PartTypeId: unique symbol;
|
|
299
|
-
/**
|
|
300
|
-
* @since 1.0.0
|
|
301
|
-
* @category Type Ids
|
|
302
|
-
*/
|
|
303
|
-
export type PartTypeId = typeof PartTypeId;
|
|
304
|
-
declare const ContentSourceAnnotation_base: Schema.TaggedClass<ContentSourceAnnotation, "ContentSourceAnnotation", {
|
|
305
|
-
readonly _tag: Schema.tag<"ContentSourceAnnotation">;
|
|
306
|
-
} & {
|
|
307
|
-
/**
|
|
308
|
-
* The identifier for the content source.
|
|
309
|
-
*/
|
|
310
|
-
id: typeof Schema.String;
|
|
311
|
-
/**
|
|
312
|
-
* The index of the content source in the list of sources provided in the
|
|
313
|
-
* model request parameters.
|
|
314
|
-
*/
|
|
315
|
-
index: typeof Schema.Int;
|
|
316
|
-
/**
|
|
317
|
-
* The provider-specific type of the file annotation.
|
|
318
|
-
*
|
|
319
|
-
* For example, when using Anthropic the type may be `char_location`,
|
|
320
|
-
* `page_location`, or `content_block_location`.
|
|
321
|
-
*/
|
|
322
|
-
type: typeof Schema.String;
|
|
323
|
-
/**
|
|
324
|
-
* The content used from the content source in the message generated by the
|
|
325
|
-
* model.
|
|
326
|
-
*/
|
|
327
|
-
referencedContent: typeof Schema.String;
|
|
328
|
-
/**
|
|
329
|
-
* The index of the first character of the content referenced by the content
|
|
330
|
-
* source in the message generated by the model.
|
|
331
|
-
*/
|
|
332
|
-
startIndex: typeof Schema.Int;
|
|
333
|
-
/**
|
|
334
|
-
* The index of the last character of the content referenced by the content
|
|
335
|
-
* source in the message generated by the model.
|
|
336
|
-
*/
|
|
337
|
-
endIndex: typeof Schema.Int;
|
|
338
|
-
}>;
|
|
339
|
-
/**
|
|
340
|
-
* Represents a content source that was used to generate a model response.
|
|
341
|
-
*
|
|
342
|
-
* @since 1.0.0
|
|
343
|
-
* @category Models
|
|
344
|
-
*/
|
|
345
|
-
export declare class ContentSourceAnnotation extends ContentSourceAnnotation_base {
|
|
346
|
-
}
|
|
347
|
-
declare const FileAnnotation_base: Schema.TaggedClass<FileAnnotation, "FileAnnotation", {
|
|
348
|
-
readonly _tag: Schema.tag<"FileAnnotation">;
|
|
349
|
-
} & {
|
|
350
|
-
/**
|
|
351
|
-
* The identifier for the file.
|
|
352
|
-
*/
|
|
353
|
-
id: typeof Schema.String;
|
|
354
|
-
/**
|
|
355
|
-
* The provider-specific type of the file annotation.
|
|
356
|
-
*
|
|
357
|
-
* For example, when using OpenAi the type may be `file_citation` or
|
|
358
|
-
* `file_path`.
|
|
359
|
-
*/
|
|
360
|
-
type: typeof Schema.String;
|
|
361
|
-
/**
|
|
362
|
-
* The index of the file in the list of files provided in the model request
|
|
363
|
-
* parameters.
|
|
364
|
-
*/
|
|
365
|
-
index: typeof Schema.Int;
|
|
366
|
-
}>;
|
|
367
|
-
/**
|
|
368
|
-
* Represents a file that was used to generate a model response.
|
|
369
|
-
*
|
|
370
|
-
* @since 1.0.0
|
|
371
|
-
* @category Models
|
|
372
|
-
*/
|
|
373
|
-
export declare class FileAnnotation extends FileAnnotation_base {
|
|
374
|
-
}
|
|
375
|
-
declare const UrlAnnotation_base: Schema.TaggedClass<UrlAnnotation, "UrlAnnotation", {
|
|
376
|
-
readonly _tag: Schema.tag<"UrlAnnotation">;
|
|
377
|
-
} & {
|
|
378
|
-
/**
|
|
379
|
-
* The URL of the web resource.
|
|
380
|
-
*/
|
|
381
|
-
url: typeof Schema.String;
|
|
382
|
-
/**
|
|
383
|
-
* The title of the web resource.
|
|
384
|
-
*/
|
|
385
|
-
title: typeof Schema.String;
|
|
386
|
-
/**
|
|
387
|
-
* The index of the first character of the content referenced by the web
|
|
388
|
-
* resource in the message generated by the model.
|
|
389
|
-
*/
|
|
390
|
-
startIndex: typeof Schema.Int;
|
|
391
|
-
/**
|
|
392
|
-
* The index of the last character of the content referenced by the web
|
|
393
|
-
* resource in the message generated by the model.
|
|
394
|
-
*/
|
|
395
|
-
endIndex: typeof Schema.Int;
|
|
396
|
-
}>;
|
|
397
|
-
/**
|
|
398
|
-
* Represents a web resource that was used to generate a model response.
|
|
399
|
-
*
|
|
400
|
-
* @since 1.0.0
|
|
401
|
-
* @category Models
|
|
402
|
-
*/
|
|
403
|
-
export declare class UrlAnnotation extends UrlAnnotation_base {
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Represents annotations that were used to support the message generated by
|
|
407
|
-
* a model.
|
|
408
|
-
*
|
|
409
|
-
* @since 1.0.0
|
|
410
|
-
* @category Models
|
|
411
|
-
*/
|
|
412
|
-
export declare const Annotation: Schema.Union<[
|
|
413
|
-
typeof ContentSourceAnnotation,
|
|
414
|
-
typeof FileAnnotation,
|
|
415
|
-
typeof UrlAnnotation
|
|
416
|
-
]>;
|
|
417
|
-
/**
|
|
418
|
-
* @since 1.0.0
|
|
419
|
-
* @category Models
|
|
420
|
-
*/
|
|
421
|
-
export type Annotation = typeof Annotation.Type;
|
|
422
|
-
declare const TextPart_base: Schema.TaggedClass<TextPart, "TextPart", {
|
|
423
|
-
readonly _tag: Schema.tag<"TextPart">;
|
|
424
|
-
} & {
|
|
425
|
-
/**
|
|
426
|
-
* The text content generated by the model.
|
|
427
|
-
*/
|
|
428
|
-
text: typeof Schema.String;
|
|
429
|
-
/**
|
|
430
|
-
* The annotations used to support the text generated by the model.
|
|
431
|
-
*/
|
|
432
|
-
annotations: Schema.optionalWith<Schema.Array$<Schema.Union<[typeof ContentSourceAnnotation, typeof FileAnnotation, typeof UrlAnnotation]>>, {
|
|
433
|
-
default: () => never[];
|
|
434
|
-
}>;
|
|
435
|
-
}>;
|
|
436
|
-
/**
|
|
437
|
-
* Represents part of the text generated by the model.
|
|
438
|
-
*
|
|
439
|
-
* @since 1.0.0
|
|
440
|
-
* @category Models
|
|
441
|
-
*/
|
|
442
|
-
export declare class TextPart extends TextPart_base {
|
|
443
|
-
/**
|
|
444
|
-
* @since 1.0.0
|
|
445
|
-
*/
|
|
446
|
-
readonly [PartTypeId]: PartTypeId;
|
|
447
|
-
}
|
|
448
|
-
declare const ReasoningPart_base: Schema.TaggedClass<ReasoningPart, "ReasoningPart", {
|
|
449
|
-
readonly _tag: Schema.tag<"ReasoningPart">;
|
|
450
|
-
} & {
|
|
451
|
-
/**
|
|
452
|
-
* The reasoning content that the model used to return the output.
|
|
453
|
-
*/
|
|
454
|
-
reasoningText: typeof Schema.String;
|
|
455
|
-
/**
|
|
456
|
-
* An optional signature which verifies that the reasoning text was generated
|
|
457
|
-
* by the model.
|
|
458
|
-
*/
|
|
459
|
-
signature: Schema.optional<typeof Schema.String>;
|
|
460
|
-
}>;
|
|
461
|
-
/**
|
|
462
|
-
* Represents part of the reasoning carried out by the model to generate a
|
|
463
|
-
* response.
|
|
464
|
-
*
|
|
465
|
-
* @since 1.0.0
|
|
466
|
-
* @category Models
|
|
467
|
-
*/
|
|
468
|
-
export declare class ReasoningPart extends ReasoningPart_base {
|
|
469
|
-
/**
|
|
470
|
-
* @since 1.0.0
|
|
471
|
-
*/
|
|
472
|
-
readonly [PartTypeId]: PartTypeId;
|
|
473
|
-
}
|
|
474
|
-
declare const RedactedReasoningPart_base: Schema.TaggedClass<RedactedReasoningPart, "RedactedReasoningPart", {
|
|
475
|
-
readonly _tag: Schema.tag<"RedactedReasoningPart">;
|
|
476
|
-
} & {
|
|
477
|
-
/**
|
|
478
|
-
* The content in the reasoning that was encrypted by the model provider for
|
|
479
|
-
* safety reasons.
|
|
480
|
-
*/
|
|
481
|
-
redactedText: typeof Schema.String;
|
|
482
|
-
}>;
|
|
483
|
-
/**
|
|
484
|
-
* Represents part of the reasoning carried out by the model to generate a
|
|
485
|
-
* response which needed to be encrypted by the model provider for safety
|
|
486
|
-
* reasons.
|
|
487
|
-
*
|
|
488
|
-
* @since 1.0.0
|
|
489
|
-
* @category Models
|
|
490
|
-
*/
|
|
491
|
-
export declare class RedactedReasoningPart extends RedactedReasoningPart_base {
|
|
492
|
-
/**
|
|
493
|
-
* @since 1.0.0
|
|
494
|
-
*/
|
|
495
|
-
readonly [PartTypeId]: PartTypeId;
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* Represents the identifier generated by a model when a tool call is requested.
|
|
499
|
-
*
|
|
500
|
-
* @since 1.0.0
|
|
501
|
-
* @category Models
|
|
502
|
-
*/
|
|
503
|
-
export declare const ToolCallId: Schema.brand<typeof Schema.String, "@effect/ai/ToolCallId">;
|
|
504
|
-
/**
|
|
505
|
-
* @since 1.0.0
|
|
506
|
-
* @category Models
|
|
507
|
-
*/
|
|
508
|
-
export type ToolCallId = typeof ToolCallId.Type;
|
|
509
|
-
declare const ToolCallPart_base: Schema.TaggedClass<ToolCallPart, "ToolCallPart", {
|
|
510
|
-
readonly _tag: Schema.tag<"ToolCallPart">;
|
|
511
|
-
} & {
|
|
512
|
-
/**
|
|
513
|
-
* The identifier generated by a model when requesting a tool call.
|
|
514
|
-
*/
|
|
515
|
-
id: Schema.brand<typeof Schema.String, "@effect/ai/ToolCallId">;
|
|
516
|
-
/**
|
|
517
|
-
* The name of the tool to call.
|
|
518
|
-
*/
|
|
519
|
-
name: typeof Schema.String;
|
|
520
|
-
/**
|
|
521
|
-
* The arguments to call the tool with as a JSON-serializable object that
|
|
522
|
-
* matches the tool call input schema.
|
|
523
|
-
*/
|
|
524
|
-
params: typeof Schema.Unknown;
|
|
525
|
-
}>;
|
|
526
|
-
/**
|
|
527
|
-
* Represents a request by a model to call a specific tool that it has been
|
|
528
|
-
* provided with.
|
|
529
|
-
*
|
|
530
|
-
* @since 1.0.0
|
|
531
|
-
* @category Models
|
|
532
|
-
*/
|
|
533
|
-
export declare class ToolCallPart extends ToolCallPart_base {
|
|
534
|
-
/**
|
|
535
|
-
* @since 1.0.0
|
|
536
|
-
*/
|
|
537
|
-
readonly [PartTypeId]: PartTypeId;
|
|
538
|
-
/**
|
|
539
|
-
* Converts a raw tool call into a `ToolCallPart` by parsing tool call
|
|
540
|
-
* parameters as a JSON string. If your tool call parameters are already
|
|
541
|
-
* parsed, use `ToolCallPart.fromUnknown`.
|
|
542
|
-
*
|
|
543
|
-
* @since 1.0.0
|
|
544
|
-
*/
|
|
545
|
-
static fromJson({ id, name, params }: {
|
|
546
|
-
readonly id: string;
|
|
547
|
-
readonly name: string;
|
|
548
|
-
readonly params: string;
|
|
549
|
-
}): Effect.Effect<ToolCallPart, AiError>;
|
|
550
|
-
/**
|
|
551
|
-
* Converts a raw tool call into a `ToolCallPart` assuming that the tool call
|
|
552
|
-
* parameters have already been parsed. If your tool call parameters have not
|
|
553
|
-
* already been parsed, use `ToolCallPart.fromJson`.
|
|
554
|
-
*
|
|
555
|
-
* @since 1.0.0
|
|
556
|
-
*/
|
|
557
|
-
static fromUnknown({ id, name, params }: {
|
|
558
|
-
readonly id: string;
|
|
559
|
-
readonly name: string;
|
|
560
|
-
readonly params: unknown;
|
|
561
|
-
}): ToolCallPart;
|
|
562
|
-
}
|
|
563
|
-
declare const MetadataPart_base: Schema.TaggedClass<MetadataPart, "MetadataPart", {
|
|
564
|
-
readonly _tag: Schema.tag<"MetadataPart">;
|
|
565
|
-
} & {
|
|
566
|
-
/**
|
|
567
|
-
* The unique identifier for the response. Each chunk of the response should
|
|
568
|
-
* have the same identifier.
|
|
569
|
-
*/
|
|
570
|
-
id: Schema.optional<typeof Schema.String>;
|
|
571
|
-
/**
|
|
572
|
-
* The model that was used to generate the response.
|
|
573
|
-
*/
|
|
574
|
-
model: typeof Schema.String;
|
|
575
|
-
/**
|
|
576
|
-
* The Unix timestamp of when the model began generated the response.
|
|
577
|
-
*/
|
|
578
|
-
timestamp: Schema.optional<typeof Schema.DateFromNumber>;
|
|
579
|
-
}>;
|
|
580
|
-
/**
|
|
581
|
-
* Represents the initial response metadata generated by a model when responding
|
|
582
|
-
* to a request.
|
|
583
|
-
*
|
|
584
|
-
* @since 1.0.0
|
|
585
|
-
* @categor Models
|
|
586
|
-
*/
|
|
587
|
-
export declare class MetadataPart extends MetadataPart_base {
|
|
588
|
-
/**
|
|
589
|
-
* @since 1.0.0
|
|
590
|
-
*/
|
|
591
|
-
readonly [PartTypeId]: PartTypeId;
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Represents the reason why a model finished generation of a response.
|
|
595
|
-
*
|
|
596
|
-
* Possible finish reasons:
|
|
597
|
-
* - `"stop"`: The model generated a stop sequence.
|
|
598
|
-
* - `"length"`: The model exceeded its token budget.
|
|
599
|
-
* - `"content-filter"`: The model generated content which violated a content filter.
|
|
600
|
-
* - `"tool-calls"`: The model triggered a tool call.
|
|
601
|
-
* - `"error"`: The model encountered an error.
|
|
602
|
-
* - `"other"`: The model stopped for a reason not supported by this protocol.
|
|
603
|
-
* - `"unknown"`: The model did not specify a finish reason.
|
|
604
|
-
*
|
|
605
|
-
* @since 1.0.0
|
|
606
|
-
* @category Models
|
|
607
|
-
*/
|
|
608
|
-
export declare const FinishReason: Schema.Literal<[
|
|
609
|
-
"stop",
|
|
610
|
-
"length",
|
|
611
|
-
"content-filter",
|
|
612
|
-
"tool-calls",
|
|
613
|
-
"error",
|
|
614
|
-
"other",
|
|
615
|
-
"unknown"
|
|
616
|
-
]>;
|
|
617
|
-
/**
|
|
618
|
-
* @since 1.0.0
|
|
619
|
-
* @category Models
|
|
620
|
-
*/
|
|
621
|
-
export type FinishReason = typeof FinishReason.Type;
|
|
622
|
-
declare const Usage_base: Schema.Class<Usage, {
|
|
623
|
-
/**
|
|
624
|
-
* The number of tokens sent in the request to the model.
|
|
625
|
-
*/
|
|
626
|
-
inputTokens: typeof Schema.Number;
|
|
627
|
-
/**
|
|
628
|
-
* The number of tokens that the model generated for the request.
|
|
629
|
-
*/
|
|
630
|
-
outputTokens: typeof Schema.Number;
|
|
631
|
-
/**
|
|
632
|
-
* The total of number of input tokens and output tokens generated by the
|
|
633
|
-
* model.
|
|
634
|
-
*/
|
|
635
|
-
totalTokens: typeof Schema.Number;
|
|
636
|
-
/**
|
|
637
|
-
* The number of reasoning tokens that the model used to generate the output
|
|
638
|
-
* for the request.
|
|
639
|
-
*/
|
|
640
|
-
reasoningTokens: typeof Schema.Number;
|
|
641
|
-
/**
|
|
642
|
-
* The number of input tokens read from the prompt cache for the request.
|
|
643
|
-
*/
|
|
644
|
-
cacheReadInputTokens: typeof Schema.Number;
|
|
645
|
-
/**
|
|
646
|
-
* The number of input tokens written to the prompt cache for the request.
|
|
647
|
-
*/
|
|
648
|
-
cacheWriteInputTokens: typeof Schema.Number;
|
|
649
|
-
}, Schema.Struct.Encoded<{
|
|
650
|
-
/**
|
|
651
|
-
* The number of tokens sent in the request to the model.
|
|
652
|
-
*/
|
|
653
|
-
inputTokens: typeof Schema.Number;
|
|
654
|
-
/**
|
|
655
|
-
* The number of tokens that the model generated for the request.
|
|
656
|
-
*/
|
|
657
|
-
outputTokens: typeof Schema.Number;
|
|
658
|
-
/**
|
|
659
|
-
* The total of number of input tokens and output tokens generated by the
|
|
660
|
-
* model.
|
|
661
|
-
*/
|
|
662
|
-
totalTokens: typeof Schema.Number;
|
|
663
|
-
/**
|
|
664
|
-
* The number of reasoning tokens that the model used to generate the output
|
|
665
|
-
* for the request.
|
|
666
|
-
*/
|
|
667
|
-
reasoningTokens: typeof Schema.Number;
|
|
668
|
-
/**
|
|
669
|
-
* The number of input tokens read from the prompt cache for the request.
|
|
670
|
-
*/
|
|
671
|
-
cacheReadInputTokens: typeof Schema.Number;
|
|
672
|
-
/**
|
|
673
|
-
* The number of input tokens written to the prompt cache for the request.
|
|
674
|
-
*/
|
|
675
|
-
cacheWriteInputTokens: typeof Schema.Number;
|
|
676
|
-
}>, never, {
|
|
677
|
-
readonly inputTokens: number;
|
|
678
|
-
} & {
|
|
679
|
-
readonly outputTokens: number;
|
|
680
|
-
} & {
|
|
681
|
-
readonly totalTokens: number;
|
|
682
|
-
} & {
|
|
683
|
-
readonly reasoningTokens: number;
|
|
684
|
-
} & {
|
|
685
|
-
readonly cacheReadInputTokens: number;
|
|
686
|
-
} & {
|
|
687
|
-
readonly cacheWriteInputTokens: number;
|
|
688
|
-
}, {}, {}>;
|
|
689
|
-
/**
|
|
690
|
-
* Represents information about the number of tokens used by the model to
|
|
691
|
-
* generate a response.
|
|
692
|
-
*
|
|
693
|
-
* @since 1.0.0
|
|
694
|
-
* @category Models
|
|
695
|
-
*/
|
|
696
|
-
export declare class Usage extends Usage_base {
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Represents additional provider-specific metadata that was returned by the
|
|
700
|
-
* model. Specific providers will use module augmentation to add their own
|
|
701
|
-
* specific provider metadata.
|
|
702
|
-
*
|
|
703
|
-
* The outer record is keyed by provider name, while the inner record is keyed
|
|
704
|
-
* by the names of the provider-specific metadata properties.
|
|
705
|
-
*
|
|
706
|
-
* For example:
|
|
707
|
-
*
|
|
708
|
-
* ```ts
|
|
709
|
-
* const providerMeta = {
|
|
710
|
-
* "amazon-bedrock": {
|
|
711
|
-
* // Provider specific metadata
|
|
712
|
-
* }
|
|
713
|
-
* }
|
|
714
|
-
* ```
|
|
715
|
-
*
|
|
716
|
-
* @since 1.0.0
|
|
717
|
-
* @category Models
|
|
718
|
-
*/
|
|
719
|
-
export interface ProviderMetadata {
|
|
720
|
-
}
|
|
721
|
-
declare const FinishPart_base: Schema.TaggedClass<FinishPart, "FinishPart", {
|
|
722
|
-
readonly _tag: Schema.tag<"FinishPart">;
|
|
723
|
-
} & {
|
|
724
|
-
/**
|
|
725
|
-
* The usage information for the response.
|
|
726
|
-
*/
|
|
727
|
-
usage: typeof Usage;
|
|
728
|
-
/**
|
|
729
|
-
* The reason the model finished generating a response.
|
|
730
|
-
*/
|
|
731
|
-
reason: Schema.Literal<["stop", "length", "content-filter", "tool-calls", "error", "other", "unknown"]>;
|
|
732
|
-
/**
|
|
733
|
-
* Provider-specific metadata associated with the response.
|
|
734
|
-
*/
|
|
735
|
-
providerMetadata: Schema.optionalWith<Schema.Record$<typeof Schema.String, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>, {
|
|
736
|
-
default: () => {};
|
|
737
|
-
}>;
|
|
738
|
-
}>;
|
|
739
|
-
/**
|
|
740
|
-
* Represents the final part of a response generated by a large language model.
|
|
741
|
-
*
|
|
742
|
-
* Contains useful information such as tokens used as part of the interaction
|
|
743
|
-
* with the model.
|
|
744
|
-
*
|
|
745
|
-
* @since 1.0.0
|
|
746
|
-
* @category Models
|
|
747
|
-
*/
|
|
748
|
-
export declare class FinishPart extends FinishPart_base {
|
|
749
|
-
/**
|
|
750
|
-
* @since 1.0.0
|
|
751
|
-
*/
|
|
752
|
-
readonly [PartTypeId]: PartTypeId;
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
* Represents an single part of a response received from a large language model.
|
|
756
|
-
*
|
|
757
|
-
* @since 1.0.0
|
|
758
|
-
* @category Models
|
|
759
|
-
*/
|
|
760
|
-
export declare const Part: Schema.Union<[
|
|
761
|
-
typeof TextPart,
|
|
762
|
-
typeof ReasoningPart,
|
|
763
|
-
typeof RedactedReasoningPart,
|
|
764
|
-
typeof ToolCallPart,
|
|
765
|
-
typeof MetadataPart,
|
|
766
|
-
typeof FinishPart
|
|
767
|
-
]>;
|
|
768
|
-
/**
|
|
769
|
-
* @since 1.0.0
|
|
770
|
-
* @category Models
|
|
771
|
-
*/
|
|
772
|
-
export type Part = typeof Part.Type;
|
|
773
|
-
/**
|
|
774
|
-
* @since 1.0.0
|
|
775
|
-
* @category Guards
|
|
776
|
-
*/
|
|
777
|
-
export declare const is: (u: unknown) => u is AiResponse;
|
|
778
|
-
/**
|
|
779
|
-
* @since 1.0.0
|
|
780
|
-
* @category Guards
|
|
781
|
-
*/
|
|
782
|
-
export declare const isPart: (u: unknown) => u is Part;
|
|
783
|
-
/**
|
|
784
|
-
* @since 1.0.0
|
|
785
|
-
* @category Guards
|
|
786
|
-
*/
|
|
787
|
-
export declare const isStructured: (u: unknown) => u is WithStructuredOutput<any>;
|
|
788
|
-
/**
|
|
789
|
-
* @since 1.0.0
|
|
790
|
-
* @category Guards
|
|
791
|
-
*/
|
|
792
|
-
export declare const hasToolCallResults: (u: unknown) => u is WithToolCallResults<any>;
|
|
793
|
-
/**
|
|
794
|
-
* @since 1.0.0
|
|
795
|
-
* @category Constructors
|
|
796
|
-
*/
|
|
797
|
-
export declare const empty: AiResponse;
|
|
798
|
-
/**
|
|
799
|
-
* Combines two responses into a single response.
|
|
800
|
-
*
|
|
801
|
-
* @since 1.0.0
|
|
802
|
-
* @category Combination
|
|
803
|
-
*/
|
|
804
|
-
export declare const merge: {
|
|
805
|
-
/**
|
|
806
|
-
* Combines two responses into a single response.
|
|
807
|
-
*
|
|
808
|
-
* @since 1.0.0
|
|
809
|
-
* @category Combination
|
|
810
|
-
*/
|
|
811
|
-
(other: AiResponse): (self: AiResponse) => AiResponse;
|
|
812
|
-
/**
|
|
813
|
-
* Combines two responses into a single response.
|
|
814
|
-
*
|
|
815
|
-
* @since 1.0.0
|
|
816
|
-
* @category Combination
|
|
817
|
-
*/
|
|
818
|
-
(self: AiResponse, other: AiResponse): AiResponse;
|
|
819
|
-
};
|
|
820
|
-
/**
|
|
821
|
-
* Adds the specified tool calls to the provided `AiResponse`.
|
|
822
|
-
*
|
|
823
|
-
* **NOTE**: With this method, the tool call parameters will be parsed as a
|
|
824
|
-
* JSON string. If your tool call parameters are already parsed, use
|
|
825
|
-
* `AiResponse.withToolCallsUnknown`.
|
|
826
|
-
*
|
|
827
|
-
* @since 1.0.0
|
|
828
|
-
* @category Combination
|
|
829
|
-
*/
|
|
830
|
-
export declare const withToolCallsJson: {
|
|
831
|
-
/**
|
|
832
|
-
* Adds the specified tool calls to the provided `AiResponse`.
|
|
833
|
-
*
|
|
834
|
-
* **NOTE**: With this method, the tool call parameters will be parsed as a
|
|
835
|
-
* JSON string. If your tool call parameters are already parsed, use
|
|
836
|
-
* `AiResponse.withToolCallsUnknown`.
|
|
837
|
-
*
|
|
838
|
-
* @since 1.0.0
|
|
839
|
-
* @category Combination
|
|
840
|
-
*/
|
|
841
|
-
(toolCalls: Iterable<{
|
|
842
|
-
readonly id: string;
|
|
843
|
-
readonly name: string;
|
|
844
|
-
readonly params: string;
|
|
845
|
-
}>): (self: AiResponse) => Effect.Effect<AiResponse, AiError>;
|
|
846
|
-
/**
|
|
847
|
-
* Adds the specified tool calls to the provided `AiResponse`.
|
|
848
|
-
*
|
|
849
|
-
* **NOTE**: With this method, the tool call parameters will be parsed as a
|
|
850
|
-
* JSON string. If your tool call parameters are already parsed, use
|
|
851
|
-
* `AiResponse.withToolCallsUnknown`.
|
|
852
|
-
*
|
|
853
|
-
* @since 1.0.0
|
|
854
|
-
* @category Combination
|
|
855
|
-
*/
|
|
856
|
-
(self: AiResponse, toolCalls: Iterable<{
|
|
857
|
-
readonly id: string;
|
|
858
|
-
readonly name: string;
|
|
859
|
-
readonly params: string;
|
|
860
|
-
}>): Effect.Effect<AiResponse, AiError>;
|
|
861
|
-
};
|
|
862
|
-
export {};
|
|
863
|
-
//# sourceMappingURL=AiResponse.d.ts.map
|