-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Labels
Description
I'm using a non-OpenAI model via Vercel's AI SDK as outlined on this page: https://openai.github.io/openai-agents-js/extensions/ai-sdk/
The issue is that it is impossible to force the model to use a tool because the toolChoice
setting is not passed to the model at all.
openai-agents-js/packages/agents-extensions/src/aiSdk.ts
Lines 423 to 439 in edf4c6b
const aiSdkRequest: LanguageModelV1CallOptions = { | |
inputFormat: 'messages', | |
mode: { | |
type: 'regular', | |
tools, | |
}, | |
prompt: input, | |
temperature: request.modelSettings.temperature, | |
topP: request.modelSettings.topP, | |
frequencyPenalty: request.modelSettings.frequencyPenalty, | |
presencePenalty: request.modelSettings.presencePenalty, | |
maxTokens: request.modelSettings.maxTokens, | |
responseFormat, | |
abortSignal: request.signal, | |
...(request.modelSettings.providerData ?? {}), | |
}; |
I believe it would need to be added to mode
. If I want toolChoice='required'
then the SDK is expecting something like
mode: {
...,
toolChoice: { type: 'required' }
}