[AI] Collapse NativeToolBinder to a single bind() entry (#20051)
The binder doesnt need an agent or full tool context -- just a model and options. Single `bind(model, options)` entry! Builds on #20022.
This commit is contained in:
+4
-3
@@ -150,7 +150,6 @@ export class AgentAsyncExecutorService {
|
||||
rolePermissionConfig: effectiveRoleConfig ?? { unionOf: [] },
|
||||
authContext,
|
||||
actorContext,
|
||||
agent: agent as unknown as ToolProviderContext['agent'],
|
||||
userId:
|
||||
isDefined(authContext) && isUserAuthContext(authContext)
|
||||
? authContext.user.id
|
||||
@@ -169,8 +168,10 @@ export class AgentAsyncExecutorService {
|
||||
},
|
||||
);
|
||||
|
||||
const nativeTools =
|
||||
await this.nativeToolBinder.bind(toolProviderContext);
|
||||
const nativeTools = this.nativeToolBinder.bind(registeredModel, {
|
||||
webSearchEnabled:
|
||||
agent.modelConfiguration?.webSearch?.enabled === true,
|
||||
});
|
||||
|
||||
tools = {
|
||||
...registryTools,
|
||||
|
||||
+3
-4
@@ -157,10 +157,9 @@ export class ChatExecutionService {
|
||||
registeredModel.modelId,
|
||||
);
|
||||
|
||||
const nativeModelTools = this.nativeToolBinder.bindForModel(
|
||||
registeredModel,
|
||||
{ webSearchEnabled: true },
|
||||
);
|
||||
const nativeModelTools = this.nativeToolBinder.bind(registeredModel, {
|
||||
webSearchEnabled: true,
|
||||
});
|
||||
|
||||
// Tools the model can call directly: preloaded registry tools (already
|
||||
// serialized by the hydrator) plus SDK-native tools (opaque, never
|
||||
|
||||
-9
@@ -79,15 +79,6 @@ export class AiModelConfigService {
|
||||
return tools;
|
||||
}
|
||||
|
||||
getNativeModelToolsForAgent(
|
||||
model: RegisteredAiModel,
|
||||
agent: FlatAgentWithRoleId,
|
||||
): ToolSet {
|
||||
return this.getNativeModelTools(model, {
|
||||
webSearchEnabled: agent.modelConfiguration?.webSearch?.enabled === true,
|
||||
});
|
||||
}
|
||||
|
||||
private getXaiProviderOptions(agent: FlatAgentWithRoleId): ProviderOptions {
|
||||
if (
|
||||
!agent.modelConfiguration ||
|
||||
|
||||
Reference in New Issue
Block a user