@yourgpt/llm-sdk 2.6.0-beta.0 → 2.6.0-beta.2
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 +189 -0
- package/dist/adapters/index.d.mts +11 -13
- package/dist/adapters/index.d.ts +11 -13
- package/dist/adapters/index.js +610 -186
- package/dist/adapters/index.mjs +610 -186
- package/dist/audio-BBSwnjo8.d.mts +92 -0
- package/dist/audio-BBSwnjo8.d.ts +92 -0
- package/dist/{base-tNgbBaSo.d.mts → base-BICaQaRS.d.mts} +8 -3
- package/dist/{base-C58Dsr9p.d.ts → base-CpRPB8u8.d.ts} +8 -3
- package/dist/fallback/index.d.mts +4 -4
- package/dist/fallback/index.d.ts +4 -4
- package/dist/fallback/index.js +75 -39
- package/dist/fallback/index.mjs +75 -39
- package/dist/index.d.mts +18 -35
- package/dist/index.d.ts +18 -35
- package/dist/index.js +304 -88
- package/dist/index.mjs +302 -89
- package/dist/providers/anthropic/index.d.mts +3 -3
- package/dist/providers/anthropic/index.d.ts +3 -3
- package/dist/providers/anthropic/index.js +123 -7
- package/dist/providers/anthropic/index.mjs +123 -7
- package/dist/providers/azure/index.d.mts +3 -3
- package/dist/providers/azure/index.d.ts +3 -3
- package/dist/providers/azure/index.js +101 -4
- package/dist/providers/azure/index.mjs +101 -4
- package/dist/providers/fireworks/index.d.mts +3 -3
- package/dist/providers/fireworks/index.d.ts +3 -3
- package/dist/providers/fireworks/index.js +559 -178
- package/dist/providers/fireworks/index.mjs +559 -178
- package/dist/providers/google/index.d.mts +3 -3
- package/dist/providers/google/index.d.ts +3 -3
- package/dist/providers/google/index.js +559 -178
- package/dist/providers/google/index.mjs +559 -178
- package/dist/providers/ollama/index.d.mts +4 -4
- package/dist/providers/ollama/index.d.ts +4 -4
- package/dist/providers/ollama/index.js +87 -2
- package/dist/providers/ollama/index.mjs +87 -2
- package/dist/providers/openai/index.d.mts +25 -23
- package/dist/providers/openai/index.d.ts +25 -23
- package/dist/providers/openai/index.js +1397 -481
- package/dist/providers/openai/index.mjs +1396 -482
- package/dist/providers/openrouter/index.d.mts +3 -3
- package/dist/providers/openrouter/index.d.ts +3 -3
- package/dist/providers/openrouter/index.js +559 -178
- package/dist/providers/openrouter/index.mjs +559 -178
- package/dist/providers/togetherai/index.d.mts +3 -3
- package/dist/providers/togetherai/index.d.ts +3 -3
- package/dist/providers/togetherai/index.js +559 -178
- package/dist/providers/togetherai/index.mjs +559 -178
- package/dist/providers/xai/index.d.mts +3 -3
- package/dist/providers/xai/index.d.ts +3 -3
- package/dist/providers/xai/index.js +559 -178
- package/dist/providers/xai/index.mjs +559 -178
- package/dist/{types-B6dhnguR.d.mts → types-C3RgRbEC.d.mts} +11 -4
- package/dist/{types-CCxPmkmK.d.ts → types-DCFqkJAy.d.ts} +11 -4
- package/dist/{types-BQ31QIsA.d.ts → types-DHQEMFHA.d.mts} +3 -11
- package/dist/{types-BkQCSiIt.d.mts → types-Dg1Bcg1k.d.mts} +127 -3
- package/dist/{types-BkQCSiIt.d.ts → types-Dg1Bcg1k.d.ts} +127 -3
- package/dist/{types-BSSiJW2o.d.mts → types-Dikj3En4.d.ts} +3 -11
- package/dist/yourgpt/index.d.mts +1 -1
- package/dist/yourgpt/index.d.ts +1 -1
- package/docs/multimodal-and-audio.md +170 -0
- package/package.json +117 -49
- package/LICENSE +0 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LLMAdapter } from './base-
|
|
1
|
+
import { L as LLMAdapter } from './base-BICaQaRS.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Fallback Chain & Routing Strategy Types
|
|
@@ -188,7 +188,14 @@ interface FallbackChainConfig {
|
|
|
188
188
|
*/
|
|
189
189
|
onFallback?: (info: FallbackInfo) => void;
|
|
190
190
|
/**
|
|
191
|
-
*
|
|
191
|
+
* Additional errors that may advance to the next model without retrying the
|
|
192
|
+
* current model. Use a narrow compatibility predicate (status/code/param).
|
|
193
|
+
* Transient retries/fallbacks retain their existing behavior. Cancellation
|
|
194
|
+
* and failures after stream output never retry or fall back.
|
|
195
|
+
*/
|
|
196
|
+
fallbackErrors?: (error: unknown) => boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Custom predicate controlling same-model retries and subsequent fallback.
|
|
192
199
|
*
|
|
193
200
|
* By default, the following trigger fallback:
|
|
194
201
|
* - HTTP 5xx server errors
|
|
@@ -202,8 +209,8 @@ interface FallbackChainConfig {
|
|
|
202
209
|
*
|
|
203
210
|
* @example
|
|
204
211
|
* ```typescript
|
|
205
|
-
* //
|
|
206
|
-
* retryableErrors: () =>
|
|
212
|
+
* // Retry only the transient failures your provider identifies.
|
|
213
|
+
* retryableErrors: (error) => isTransientProviderError(error),
|
|
207
214
|
* ```
|
|
208
215
|
*/
|
|
209
216
|
retryableErrors?: (error: unknown) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LLMAdapter } from './base-
|
|
1
|
+
import { L as LLMAdapter } from './base-CpRPB8u8.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Fallback Chain & Routing Strategy Types
|
|
@@ -188,7 +188,14 @@ interface FallbackChainConfig {
|
|
|
188
188
|
*/
|
|
189
189
|
onFallback?: (info: FallbackInfo) => void;
|
|
190
190
|
/**
|
|
191
|
-
*
|
|
191
|
+
* Additional errors that may advance to the next model without retrying the
|
|
192
|
+
* current model. Use a narrow compatibility predicate (status/code/param).
|
|
193
|
+
* Transient retries/fallbacks retain their existing behavior. Cancellation
|
|
194
|
+
* and failures after stream output never retry or fall back.
|
|
195
|
+
*/
|
|
196
|
+
fallbackErrors?: (error: unknown) => boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Custom predicate controlling same-model retries and subsequent fallback.
|
|
192
199
|
*
|
|
193
200
|
* By default, the following trigger fallback:
|
|
194
201
|
* - HTTP 5xx server errors
|
|
@@ -202,8 +209,8 @@ interface FallbackChainConfig {
|
|
|
202
209
|
*
|
|
203
210
|
* @example
|
|
204
211
|
* ```typescript
|
|
205
|
-
* //
|
|
206
|
-
* retryableErrors: () =>
|
|
212
|
+
* // Retry only the transient failures your provider identifies.
|
|
213
|
+
* retryableErrors: (error) => isTransientProviderError(error),
|
|
207
214
|
* ```
|
|
208
215
|
*/
|
|
209
216
|
retryableErrors?: (error: unknown) => boolean;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { L as LLMAdapter } from './base-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Provider Types
|
|
6
|
-
*
|
|
7
|
-
* Defines interfaces for:
|
|
8
|
-
* 1. Provider Formatters (for tool transformations in agent loop)
|
|
9
|
-
* 2. Multi-provider architecture (AIProvider, capabilities, configs)
|
|
10
|
-
*/
|
|
1
|
+
import { ae as OpenAIParameterOptions, O as OpenAITransportOptions, e as ToolDefinition, a1 as UnifiedToolCall, a2 as UnifiedToolResult } from './types-Dg1Bcg1k.mjs';
|
|
2
|
+
import { L as LLMAdapter } from './base-BICaQaRS.mjs';
|
|
11
3
|
|
|
12
4
|
/**
|
|
13
5
|
* Provider formatter interface
|
|
@@ -259,7 +251,7 @@ interface BaseProviderConfig {
|
|
|
259
251
|
/**
|
|
260
252
|
* OpenAI provider configuration
|
|
261
253
|
*/
|
|
262
|
-
interface OpenAIProviderConfig extends BaseProviderConfig {
|
|
254
|
+
interface OpenAIProviderConfig extends BaseProviderConfig, OpenAIParameterOptions, OpenAITransportOptions {
|
|
263
255
|
/** OpenAI organization ID */
|
|
264
256
|
organization?: string;
|
|
265
257
|
/** OpenAI project ID */
|
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
/** OpenAI reasoning controls. Omit to retain the model's default effort. */
|
|
4
|
+
type OpenAIReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
5
|
+
interface OpenAIParameterOptions {
|
|
6
|
+
reasoningEffort?: OpenAIReasoningEffort;
|
|
7
|
+
/** Use passthrough for compatible servers with different model rules. */
|
|
8
|
+
parameterPolicy?: "openai" | "passthrough";
|
|
9
|
+
/** Receives omitted-option warnings; defaults to console.warn. */
|
|
10
|
+
onWarning?: (message: string) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Responses-only options. Omitted values retain the API's defaults. */
|
|
14
|
+
interface OpenAIResponsesOptions {
|
|
15
|
+
store?: boolean;
|
|
16
|
+
/** Send only new input after this stored response; do not also resend its history. */
|
|
17
|
+
previousResponseId?: string;
|
|
18
|
+
include?: string[];
|
|
19
|
+
reasoningSummary?: "auto" | "concise" | "detailed";
|
|
20
|
+
promptCacheKey?: string;
|
|
21
|
+
/** Legacy retention option for models that support it. */
|
|
22
|
+
promptCacheRetention?: "in_memory" | "24h";
|
|
23
|
+
/** GPT-5.6+ cache mode and minimum lifetime; provider/model support varies. */
|
|
24
|
+
promptCacheOptions?: {
|
|
25
|
+
mode?: "implicit" | "explicit";
|
|
26
|
+
ttl?: "30m";
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface OpenAITransportOptions {
|
|
30
|
+
/** auto preserves existing routing; responses also works without function tools. */
|
|
31
|
+
api?: "auto" | "chat" | "responses";
|
|
32
|
+
responses?: OpenAIResponsesOptions;
|
|
33
|
+
}
|
|
34
|
+
/** Opaque provider items: retain their complete contents and order for replay. */
|
|
35
|
+
interface OpenAIResponseItem {
|
|
36
|
+
type: string;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
interface OpenAIResponseMetadata {
|
|
40
|
+
id?: string;
|
|
41
|
+
model?: string;
|
|
42
|
+
status?: string;
|
|
43
|
+
output: OpenAIResponseItem[];
|
|
44
|
+
usage?: Record<string, unknown>;
|
|
45
|
+
store?: boolean;
|
|
46
|
+
refusals: string[];
|
|
47
|
+
}
|
|
48
|
+
interface ProviderMetadata {
|
|
49
|
+
openai?: {
|
|
50
|
+
response?: OpenAIResponseMetadata;
|
|
51
|
+
};
|
|
52
|
+
[provider: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Explicit model-facing output; the application's raw tool result stays separate. */
|
|
56
|
+
type ToolOutputPart = {
|
|
57
|
+
type: "text";
|
|
58
|
+
text: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: "image";
|
|
61
|
+
data: string | Uint8Array;
|
|
62
|
+
mediaType: string;
|
|
63
|
+
} | {
|
|
64
|
+
type: "image";
|
|
65
|
+
url: string;
|
|
66
|
+
} | {
|
|
67
|
+
type: "image";
|
|
68
|
+
fileId: string;
|
|
69
|
+
provider: "openai";
|
|
70
|
+
};
|
|
71
|
+
interface ToolModelOutput {
|
|
72
|
+
type: "content";
|
|
73
|
+
content: ToolOutputPart[];
|
|
74
|
+
}
|
|
75
|
+
|
|
3
76
|
/**
|
|
4
77
|
* Stream event types for llm-sdk
|
|
5
78
|
* These types are used internally by the SDK for streaming responses
|
|
@@ -32,6 +105,7 @@ interface MessageDeltaEvent extends BaseEvent {
|
|
|
32
105
|
* Message finished streaming
|
|
33
106
|
*/
|
|
34
107
|
interface MessageEndEvent extends BaseEvent {
|
|
108
|
+
providerMetadata?: ProviderMetadata;
|
|
35
109
|
type: "message:end";
|
|
36
110
|
}
|
|
37
111
|
/**
|
|
@@ -77,6 +151,7 @@ interface ActionArgsEvent extends BaseEvent {
|
|
|
77
151
|
* Action execution completed
|
|
78
152
|
*/
|
|
79
153
|
interface ActionEndEvent extends BaseEvent {
|
|
154
|
+
modelOutput?: ToolModelOutput;
|
|
80
155
|
type: "action:end";
|
|
81
156
|
id: string;
|
|
82
157
|
name?: string;
|
|
@@ -90,6 +165,12 @@ interface ErrorEvent extends BaseEvent {
|
|
|
90
165
|
type: "error";
|
|
91
166
|
message: string;
|
|
92
167
|
code?: string;
|
|
168
|
+
status?: number;
|
|
169
|
+
providerCode?: string;
|
|
170
|
+
param?: string;
|
|
171
|
+
requestId?: string;
|
|
172
|
+
/** In-process cause, omitted from serialized error events. */
|
|
173
|
+
cause?: unknown;
|
|
93
174
|
}
|
|
94
175
|
/**
|
|
95
176
|
* Tool call information
|
|
@@ -107,6 +188,7 @@ interface ToolCallInfo {
|
|
|
107
188
|
* Assistant message with tool calls
|
|
108
189
|
*/
|
|
109
190
|
interface AssistantToolMessage {
|
|
191
|
+
providerMetadata?: ProviderMetadata;
|
|
110
192
|
role: "assistant";
|
|
111
193
|
content: string | null;
|
|
112
194
|
tool_calls: Array<{
|
|
@@ -182,6 +264,8 @@ interface CitationEvent extends BaseEvent {
|
|
|
182
264
|
* Message format for done event (API format with snake_case)
|
|
183
265
|
*/
|
|
184
266
|
interface DoneEventMessage {
|
|
267
|
+
modelOutput?: ToolModelOutput;
|
|
268
|
+
providerMetadata?: ProviderMetadata;
|
|
185
269
|
role: "assistant" | "tool";
|
|
186
270
|
content: string | null;
|
|
187
271
|
tool_calls?: Array<{
|
|
@@ -216,6 +300,7 @@ interface ThreadCreatedEvent extends BaseEvent {
|
|
|
216
300
|
* Stream completed
|
|
217
301
|
*/
|
|
218
302
|
interface DoneEvent extends BaseEvent {
|
|
303
|
+
providerMetadata?: ProviderMetadata;
|
|
219
304
|
type: "done";
|
|
220
305
|
requiresAction?: boolean;
|
|
221
306
|
messages?: DoneEventMessage[];
|
|
@@ -249,6 +334,7 @@ type ResponseFormat = {
|
|
|
249
334
|
* LLM configuration
|
|
250
335
|
*/
|
|
251
336
|
interface LLMConfig {
|
|
337
|
+
reasoningEffort?: OpenAIReasoningEffort;
|
|
252
338
|
temperature?: number;
|
|
253
339
|
maxTokens?: number;
|
|
254
340
|
responseFormat?: ResponseFormat;
|
|
@@ -293,6 +379,8 @@ interface MessageMetadata {
|
|
|
293
379
|
* Message type (simplified for llm-sdk)
|
|
294
380
|
*/
|
|
295
381
|
interface Message {
|
|
382
|
+
modelOutput?: ToolModelOutput;
|
|
383
|
+
providerMetadata?: ProviderMetadata;
|
|
296
384
|
id: string;
|
|
297
385
|
thread_id?: string;
|
|
298
386
|
role: MessageRole;
|
|
@@ -363,7 +451,10 @@ interface AIContent {
|
|
|
363
451
|
type?: "text" | "image";
|
|
364
452
|
text?: string;
|
|
365
453
|
mediaType?: string;
|
|
366
|
-
data?: string;
|
|
454
|
+
data?: string | Uint8Array;
|
|
455
|
+
url?: string;
|
|
456
|
+
fileId?: string;
|
|
457
|
+
provider?: "openai";
|
|
367
458
|
summary?: string;
|
|
368
459
|
details?: string;
|
|
369
460
|
}
|
|
@@ -379,6 +470,7 @@ interface ToolInputSchema {
|
|
|
379
470
|
* Tool definition
|
|
380
471
|
*/
|
|
381
472
|
interface ToolDefinition<TParams = Record<string, unknown>> {
|
|
473
|
+
toModelOutput?: (result: unknown) => ToolModelOutput | undefined;
|
|
382
474
|
name: string;
|
|
383
475
|
description: string;
|
|
384
476
|
location: ToolLocation;
|
|
@@ -608,11 +700,14 @@ interface UserMessage {
|
|
|
608
700
|
content: string | UserContentPart[];
|
|
609
701
|
}
|
|
610
702
|
interface AssistantMessage {
|
|
703
|
+
/** Provider state retained for continuation and inspection. */
|
|
704
|
+
providerMetadata?: ProviderMetadata;
|
|
611
705
|
role: "assistant";
|
|
612
706
|
content: string | null;
|
|
613
707
|
toolCalls?: ToolCall[];
|
|
614
708
|
}
|
|
615
709
|
interface ToolMessage {
|
|
710
|
+
modelOutput?: ToolModelOutput;
|
|
616
711
|
role: "tool";
|
|
617
712
|
toolCallId: string;
|
|
618
713
|
content: string;
|
|
@@ -633,6 +728,7 @@ interface ImagePart {
|
|
|
633
728
|
mimeType?: string;
|
|
634
729
|
}
|
|
635
730
|
interface FilePart {
|
|
731
|
+
filename?: string;
|
|
636
732
|
type: "file";
|
|
637
733
|
/** Base64 data or URL */
|
|
638
734
|
data: string;
|
|
@@ -649,6 +745,8 @@ interface Tool<TParams = unknown, TResult = unknown> {
|
|
|
649
745
|
parameters: z.ZodType<TParams>;
|
|
650
746
|
/** Execute function */
|
|
651
747
|
execute: (params: TParams, context: ToolContext) => Promise<TResult>;
|
|
748
|
+
/** Map the raw result to explicit text/image content for the model. */
|
|
749
|
+
toModelOutput?: (result: TResult) => ToolModelOutput | undefined;
|
|
652
750
|
/**
|
|
653
751
|
* Hide this tool's execution from the chat UI.
|
|
654
752
|
* When true, tool calls and results won't be displayed to the user,
|
|
@@ -683,6 +781,7 @@ interface ToolCall {
|
|
|
683
781
|
* Tool execution result
|
|
684
782
|
*/
|
|
685
783
|
interface ToolResult {
|
|
784
|
+
modelOutput?: ToolModelOutput;
|
|
686
785
|
/** Tool call ID this result corresponds to */
|
|
687
786
|
toolCallId: string;
|
|
688
787
|
/** Result data (will be JSON stringified for LLM) */
|
|
@@ -692,10 +791,14 @@ interface ToolResult {
|
|
|
692
791
|
* Parameters for model.doGenerate() and model.doStream()
|
|
693
792
|
*/
|
|
694
793
|
interface DoGenerateParams {
|
|
794
|
+
/** OpenAI endpoint and Responses options. */
|
|
795
|
+
openai?: OpenAITransportOptions;
|
|
695
796
|
/** Messages to send to LLM */
|
|
696
797
|
messages: CoreMessage[];
|
|
697
798
|
/** Tools available to the LLM (already formatted for provider) */
|
|
698
799
|
tools?: unknown[];
|
|
800
|
+
/** OpenAI reasoning effort. Omit to preserve the model default. */
|
|
801
|
+
reasoningEffort?: OpenAIReasoningEffort;
|
|
699
802
|
/** Temperature (0-2) */
|
|
700
803
|
temperature?: number;
|
|
701
804
|
/** Maximum tokens to generate */
|
|
@@ -709,6 +812,8 @@ interface DoGenerateParams {
|
|
|
709
812
|
* Result from model.doGenerate()
|
|
710
813
|
*/
|
|
711
814
|
interface DoGenerateResult {
|
|
815
|
+
/** Provider state retained for continuation and inspection. */
|
|
816
|
+
providerMetadata?: ProviderMetadata;
|
|
712
817
|
/** Generated text content */
|
|
713
818
|
text: string;
|
|
714
819
|
/** Tool calls requested by the LLM */
|
|
@@ -745,11 +850,14 @@ interface ToolCallChunk {
|
|
|
745
850
|
toolCall: ToolCall;
|
|
746
851
|
}
|
|
747
852
|
interface ToolResultChunk {
|
|
853
|
+
modelOutput?: ToolModelOutput;
|
|
748
854
|
type: "tool-result";
|
|
749
855
|
toolCallId: string;
|
|
750
856
|
result: unknown;
|
|
751
857
|
}
|
|
752
858
|
interface FinishChunk {
|
|
859
|
+
/** Provider state retained for continuation and inspection. */
|
|
860
|
+
providerMetadata?: ProviderMetadata;
|
|
753
861
|
type: "finish";
|
|
754
862
|
finishReason: FinishReason;
|
|
755
863
|
usage?: TokenUsage;
|
|
@@ -762,6 +870,8 @@ interface ErrorChunk {
|
|
|
762
870
|
* Parameters for generateText()
|
|
763
871
|
*/
|
|
764
872
|
interface GenerateTextParams {
|
|
873
|
+
/** OpenAI endpoint and Responses options. */
|
|
874
|
+
openai?: OpenAITransportOptions;
|
|
765
875
|
/** Language model to use */
|
|
766
876
|
model: LanguageModel;
|
|
767
877
|
/** Simple prompt (converted to user message) */
|
|
@@ -771,9 +881,11 @@ interface GenerateTextParams {
|
|
|
771
881
|
/** Full message history */
|
|
772
882
|
messages?: CoreMessage[];
|
|
773
883
|
/** Tools available to the LLM */
|
|
774
|
-
tools?: Record<string, Tool
|
|
884
|
+
tools?: Record<string, Tool<any, any>>;
|
|
775
885
|
/** Maximum agentic steps (tool call loops) */
|
|
776
886
|
maxSteps?: number;
|
|
887
|
+
/** OpenAI reasoning effort. Omit to preserve the model default. */
|
|
888
|
+
reasoningEffort?: OpenAIReasoningEffort;
|
|
777
889
|
/** Temperature (0-2) */
|
|
778
890
|
temperature?: number;
|
|
779
891
|
/** Maximum tokens to generate */
|
|
@@ -787,6 +899,8 @@ interface GenerateTextParams {
|
|
|
787
899
|
* Result from generateText()
|
|
788
900
|
*/
|
|
789
901
|
interface GenerateTextResult {
|
|
902
|
+
/** Provider state retained for continuation and inspection. */
|
|
903
|
+
providerMetadata?: ProviderMetadata;
|
|
790
904
|
/** Final text output */
|
|
791
905
|
text: string;
|
|
792
906
|
/** Token usage */
|
|
@@ -808,6 +922,8 @@ interface GenerateTextResult {
|
|
|
808
922
|
* A single step in the generation process
|
|
809
923
|
*/
|
|
810
924
|
interface GenerateStep {
|
|
925
|
+
/** Provider state retained for continuation and inspection. */
|
|
926
|
+
providerMetadata?: ProviderMetadata;
|
|
811
927
|
/** Text generated in this step */
|
|
812
928
|
text: string;
|
|
813
929
|
/** Tool calls made in this step */
|
|
@@ -827,6 +943,11 @@ type StreamTextParams = GenerateTextParams;
|
|
|
827
943
|
* Result from streamText()
|
|
828
944
|
*/
|
|
829
945
|
interface StreamTextResult {
|
|
946
|
+
/** Final conversation, including opaque provider state for replay. */
|
|
947
|
+
readonly response: Promise<{
|
|
948
|
+
messages: CoreMessage[];
|
|
949
|
+
}>;
|
|
950
|
+
readonly providerMetadata: Promise<ProviderMetadata | undefined>;
|
|
830
951
|
/** Async iterable of text chunks only */
|
|
831
952
|
textStream: AsyncIterable<string>;
|
|
832
953
|
/** Async iterable of all stream parts */
|
|
@@ -863,6 +984,7 @@ type StreamPart = {
|
|
|
863
984
|
type: "tool-result";
|
|
864
985
|
toolCallId: string;
|
|
865
986
|
result: unknown;
|
|
987
|
+
modelOutput?: ToolModelOutput;
|
|
866
988
|
} | {
|
|
867
989
|
type: "step-start";
|
|
868
990
|
step: number;
|
|
@@ -870,10 +992,12 @@ type StreamPart = {
|
|
|
870
992
|
type: "step-finish";
|
|
871
993
|
step: number;
|
|
872
994
|
finishReason: FinishReason;
|
|
995
|
+
providerMetadata?: ProviderMetadata;
|
|
873
996
|
} | {
|
|
874
997
|
type: "finish";
|
|
875
998
|
finishReason: FinishReason;
|
|
876
999
|
usage: TokenUsage;
|
|
1000
|
+
providerMetadata?: ProviderMetadata;
|
|
877
1001
|
} | {
|
|
878
1002
|
type: "error";
|
|
879
1003
|
error: Error;
|
|
@@ -960,4 +1084,4 @@ interface StorageFile {
|
|
|
960
1084
|
filename?: string;
|
|
961
1085
|
}
|
|
962
1086
|
|
|
963
|
-
export { type
|
|
1087
|
+
export { type LLMConfig as $, type ActionDefinition as A, type StreamChunk as B, type CoreMessage as C, type DoneEventMessage as D, type TextDeltaChunk as E, type FilePart as F, type GenerateTextParams as G, type ToolCallChunk as H, type ImagePart as I, type ToolResultChunk as J, type KnowledgeBaseConfig as K, type LanguageModel as L, type Message as M, type FinishChunk as N, type OpenAITransportOptions as O, type ProviderMetadata as P, type ErrorChunk as Q, type ResponseFormat as R, type StreamTextParams as S, type ToolContext as T, type UserMessage as U, type TokenUsage as V, type WebSearchConfig as W, type FinishReason as X, type ResponseOptions as Y, type StorageFile as Z, DEFAULT_CAPABILITIES as _, type GenerateTextResult as a, type ToolLocation as a0, type UnifiedToolCall as a1, type UnifiedToolResult as a2, type ToolExecution as a3, type OpenAIToolSelectionHints as a4, type AnthropicToolSelectionHints as a5, type ToolNativeProviderHints as a6, type OpenAIProviderToolOptions as a7, type AnthropicProviderToolOptions as a8, type Citation as a9, type OpenAIResponsesOptions as aa, type OpenAIResponseItem as ab, type OpenAIResponseMetadata as ac, type ToolOutputPart as ad, type OpenAIParameterOptions as ae, type MessageAttachment as af, type StreamTextResult as b, type ToolModelOutput as c, type Tool as d, type ToolDefinition as e, type ToolProfile as f, type StorageAdapter as g, type OpenAIReasoningEffort as h, type StreamEvent as i, type ToolCallInfo as j, type TokenUsageRaw as k, type ProviderToolRuntimeOptions as l, type ToolResponse as m, type StorageMessage as n, type ModelCapabilities as o, type DoGenerateParams as p, type DoGenerateResult as q, type SystemMessage as r, type AssistantMessage as s, type ToolMessage as t, type UserContentPart as u, type TextPart as v, type ToolCall as w, type ToolResult as x, type GenerateStep as y, type StreamPart as z };
|