@output.ai/llm 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.d.ts +26 -6
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ import type {
|
|
|
4
4
|
GenerateObjectResult as AIGenerateObjectResult,
|
|
5
5
|
CallSettings,
|
|
6
6
|
ToolSet,
|
|
7
|
-
ToolChoice
|
|
7
|
+
ToolChoice,
|
|
8
|
+
StopCondition,
|
|
9
|
+
GenerateTextOnStepFinishCallback,
|
|
10
|
+
PrepareStepFunction
|
|
8
11
|
} from 'ai';
|
|
9
12
|
|
|
10
13
|
/**
|
|
@@ -100,12 +103,20 @@ export type {
|
|
|
100
103
|
CallSettings,
|
|
101
104
|
ToolSet,
|
|
102
105
|
ToolChoice,
|
|
103
|
-
Tool
|
|
106
|
+
Tool,
|
|
107
|
+
StopCondition,
|
|
108
|
+
StepResult,
|
|
109
|
+
GenerateTextOnStepFinishCallback,
|
|
110
|
+
PrepareStepFunction,
|
|
111
|
+
PrepareStepResult
|
|
104
112
|
} from 'ai';
|
|
105
113
|
|
|
106
114
|
// Re-export the tool helper function for creating tools
|
|
107
115
|
export { tool } from 'ai';
|
|
108
116
|
|
|
117
|
+
// Re-export stop condition helpers for multi-step workflows
|
|
118
|
+
export { stepCountIs, hasToolCall } from 'ai';
|
|
119
|
+
|
|
109
120
|
/**
|
|
110
121
|
* Common AI SDK options that can be passed through to all generate functions.
|
|
111
122
|
* These options are passed directly to the underlying AI SDK call.
|
|
@@ -113,7 +124,7 @@ export { tool } from 'ai';
|
|
|
113
124
|
type AiSdkOptions = Partial<Omit<CallSettings, 'maxOutputTokens'>>;
|
|
114
125
|
|
|
115
126
|
/**
|
|
116
|
-
* AI SDK options specific to generateText, including tool calling support.
|
|
127
|
+
* AI SDK options specific to generateText, including tool calling and multi-step support.
|
|
117
128
|
* @typeParam TOOLS - The tools available for the model to call
|
|
118
129
|
*/
|
|
119
130
|
type GenerateTextAiSdkOptions<TOOLS extends ToolSet = ToolSet> = AiSdkOptions & {
|
|
@@ -123,14 +134,23 @@ type GenerateTextAiSdkOptions<TOOLS extends ToolSet = ToolSet> = AiSdkOptions &
|
|
|
123
134
|
toolChoice?: ToolChoice<TOOLS>;
|
|
124
135
|
/** Limit which tools are active without changing types */
|
|
125
136
|
activeTools?: Array<keyof TOOLS>;
|
|
137
|
+
/** Maximum number of automatic tool execution rounds (multi-step) */
|
|
138
|
+
maxSteps?: number;
|
|
139
|
+
/** Custom stop conditions for multi-step execution */
|
|
140
|
+
stopWhen?: StopCondition<TOOLS> | StopCondition<TOOLS>[];
|
|
141
|
+
/** Callback after each step completes */
|
|
142
|
+
onStepFinish?: GenerateTextOnStepFinishCallback<TOOLS>;
|
|
143
|
+
/** Customize each step before execution */
|
|
144
|
+
prepareStep?: PrepareStepFunction<TOOLS>;
|
|
126
145
|
};
|
|
127
146
|
|
|
128
147
|
/**
|
|
129
148
|
* Result from generateText including full AI SDK response metadata.
|
|
130
149
|
* Extends AI SDK's GenerateTextResult with a unified `result` field.
|
|
150
|
+
* @typeParam TOOLS - The tools available for the model to call (preserves typing on steps)
|
|
131
151
|
*/
|
|
132
|
-
export type GenerateTextResult =
|
|
133
|
-
AIGenerateTextResult<
|
|
152
|
+
export type GenerateTextResult<TOOLS extends ToolSet = ToolSet> =
|
|
153
|
+
AIGenerateTextResult<TOOLS, unknown> & {
|
|
134
154
|
/** Unified field name alias for 'text' - provides consistency across all generate* functions */
|
|
135
155
|
result: string;
|
|
136
156
|
};
|
|
@@ -177,7 +197,7 @@ export function generateText<TOOLS extends ToolSet = ToolSet>(
|
|
|
177
197
|
prompt: string,
|
|
178
198
|
variables?: Record<string, string | number | boolean>
|
|
179
199
|
} & GenerateTextAiSdkOptions<TOOLS>
|
|
180
|
-
): Promise<GenerateTextResult
|
|
200
|
+
): Promise<GenerateTextResult<TOOLS>>;
|
|
181
201
|
|
|
182
202
|
/**
|
|
183
203
|
* Use an LLM model to generate an object with a fixed schema.
|