Skip to content

Commit 8f553df

Browse files
committed
fix: tools were being stripped from API requests
- resolveAsyncFunctions was skipping 'tools' key, removing API-formatted tools - ModelResult was also stripping 'tools' when building baseRequest - Tools are now preserved through the async resolution pipeline - Both tests now pass: tools are sent to API and model calls them correctly
1 parent 61ecacd commit 8f553df

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/lib/async-params.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ export async function resolveAsyncFunctions(
7979

8080
// Iterate over all keys in the input
8181
for (const [key, value] of Object.entries(input)) {
82-
// Skip stopWhen and tools - they're handled separately
83-
if (key === 'stopWhen' || key === 'tools') {
82+
// Skip stopWhen - it's handled separately in ModelResult
83+
// Note: tools are already in API format at this point (converted in callModel()), so we include them
84+
if (key === 'stopWhen') {
8485
continue;
8586
}
8687

src/lib/model-result.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ export class ModelResult {
175175
);
176176
} else {
177177
// Already resolved, extract non-function fields
178-
// Since request is CallModelInput, we need to filter out tools/stopWhen
178+
// Since request is CallModelInput, we need to filter out stopWhen
179+
// Note: tools are already in API format at this point (converted in callModel())
179180
// eslint-disable-next-line @typescript-eslint/no-unused-vars
180-
const { tools, stopWhen, ...rest } = this.options.request;
181+
const { stopWhen, ...rest } = this.options.request;
181182
// Cast to ResolvedCallModelInput - we know it's resolved if hasAsyncFunctions returned false
182183
baseRequest = rest as ResolvedCallModelInput;
183184
}

0 commit comments

Comments
 (0)