mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-11 04:58:51 +01:00
feat: enhance agent schema with per-tool options for configuration
- Added `tool_options` schema to support per-tool configurations, including `defer_loading` and `allowed_callers`. - Updated agent data model to incorporate new tool options, ensuring flexibility in tool behavior management. - Modified type definitions to reflect the new `tool_options` structure for agents.
This commit is contained in:
parent
4682f0e370
commit
2d4833b49e
3 changed files with 18 additions and 1 deletions
|
|
@ -51,6 +51,15 @@ export const graphEdgeSchema = z.object({
|
|||
promptKey: z.string().optional(),
|
||||
});
|
||||
|
||||
/** Per-tool options schema (defer_loading, allowed_callers) */
|
||||
export const toolOptionsSchema = z.object({
|
||||
defer_loading: z.boolean().optional(),
|
||||
allowed_callers: z.array(z.enum(['direct', 'code_execution'])).optional(),
|
||||
});
|
||||
|
||||
/** Agent tool options - map of tool_id to tool options */
|
||||
export const agentToolOptionsSchema = z.record(z.string(), toolOptionsSchema).optional();
|
||||
|
||||
/** Base agent schema with all common fields */
|
||||
export const agentBaseSchema = z.object({
|
||||
name: z.string().nullable().optional(),
|
||||
|
|
@ -68,6 +77,7 @@ export const agentBaseSchema = z.object({
|
|||
recursion_limit: z.number().optional(),
|
||||
conversation_starters: z.array(z.string()).optional(),
|
||||
tool_resources: agentToolResourcesSchema,
|
||||
tool_options: agentToolOptionsSchema,
|
||||
support_contact: agentSupportContactSchema,
|
||||
category: z.string().optional(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -118,6 +118,11 @@ const agentSchema = new Schema<IAgent>(
|
|||
default: [],
|
||||
index: true,
|
||||
},
|
||||
/** Per-tool configuration (defer_loading, allowed_callers) */
|
||||
tool_options: {
|
||||
type: Schema.Types.Mixed,
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Document, Types } from 'mongoose';
|
||||
import type { GraphEdge } from 'librechat-data-provider';
|
||||
import type { GraphEdge, AgentToolOptions } from 'librechat-data-provider';
|
||||
|
||||
export interface ISupportContact {
|
||||
name?: string;
|
||||
|
|
@ -42,4 +42,6 @@ export interface IAgent extends Omit<Document, 'model'> {
|
|||
is_promoted?: boolean;
|
||||
/** MCP server names extracted from tools for efficient querying */
|
||||
mcpServerNames?: string[];
|
||||
/** Per-tool configuration (defer_loading, allowed_callers) */
|
||||
tool_options?: AgentToolOptions;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue