mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-04 00:31:50 +01:00
🗑️ chore: Remove Dev Artifacts for Deferred Tools Capability (#11601)
* chore: remove TOOL_CLASSIFICATION_AGENT_IDS env var blocking deferred tools The TOOL_CLASSIFICATION_AGENT_IDS environment variable was gating Tool Search creation even when agents had deferred tools configured via the UI (agent tool_options). This caused agents with all MCP tools set to defer_loading to have no tools available, since the Tool Search tool wasn't being created. - Remove isAgentAllowedForClassification function and its usage - Remove early return that blocked classification features - Update JSDoc comments to reflect current behavior - Remove related tests from classification.spec.ts Agent-level deferred_tools configuration now works correctly without requiring env var configuration. * chore: streamline classification tests and remove unused functions - Removed deprecated tests related to environment variable configurations for tool classification. - Simplified the classification.spec.ts file by retaining only relevant tests for the current functionality. - Updated imports and adjusted test cases to reflect the changes in the classification module. - Enhanced clarity in the classification utility functions by removing unnecessary comments and code. * refactor: update ToolService to use AgentConstants for tool identification - Replaced direct references to Constants with AgentConstants in ToolService.js for better consistency and maintainability. - Enhanced logging in loadToolsForExecution and initializeClient to include toolRegistry size, improving debugging capabilities. - Updated import statements in run.ts to include Constants, ensuring proper tool name checks during execution. * chore: reorganize imports and enhance classification tests - Updated import statements in classification.spec.ts for better clarity and organization. - Reintroduced the getServerNameFromTool function to improve tool classification logic. - Removed unused imports and functions to streamline the test file, enhancing maintainability. * feat: enhance tool registry creation with additional properties - Added toolType property to tool definitions in buildToolRegistryFromAgentOptions for improved classification. - Included serverName assignment in tool definitions to enhance tool identification and management.
This commit is contained in:
parent
9a38af5875
commit
40c5804ed6
5 changed files with 62 additions and 444 deletions
|
|
@ -4,6 +4,7 @@ const {
|
|||
StepTypes,
|
||||
GraphEvents,
|
||||
createToolSearch,
|
||||
Constants: AgentConstants,
|
||||
createProgrammaticToolCallingTool,
|
||||
} = require('@librechat/agents');
|
||||
const { logger } = require('@librechat/data-schemas');
|
||||
|
|
@ -1055,8 +1056,12 @@ async function loadToolsForExecution({
|
|||
const allLoadedTools = [];
|
||||
const configurable = { userMCPAuthMap };
|
||||
|
||||
const isToolSearch = toolNames.includes(Constants.TOOL_SEARCH);
|
||||
const isPTC = toolNames.includes(Constants.PROGRAMMATIC_TOOL_CALLING);
|
||||
const isToolSearch = toolNames.includes(AgentConstants.TOOL_SEARCH);
|
||||
const isPTC = toolNames.includes(AgentConstants.PROGRAMMATIC_TOOL_CALLING);
|
||||
|
||||
logger.debug(
|
||||
`[loadToolsForExecution] isToolSearch: ${isToolSearch}, toolRegistry: ${toolRegistry?.size ?? 'undefined'}`,
|
||||
);
|
||||
|
||||
if (isToolSearch && toolRegistry) {
|
||||
const toolSearchTool = createToolSearch({
|
||||
|
|
@ -1087,7 +1092,10 @@ async function loadToolsForExecution({
|
|||
}
|
||||
}
|
||||
|
||||
const specialToolNames = new Set([Constants.TOOL_SEARCH, Constants.PROGRAMMATIC_TOOL_CALLING]);
|
||||
const specialToolNames = new Set([
|
||||
AgentConstants.TOOL_SEARCH,
|
||||
AgentConstants.PROGRAMMATIC_TOOL_CALLING,
|
||||
]);
|
||||
|
||||
let ptcOrchestratedToolNames = [];
|
||||
if (isPTC && toolRegistry) {
|
||||
|
|
@ -1149,7 +1157,7 @@ async function loadToolsForExecution({
|
|||
if (isPTC && allLoadedTools.length > 0) {
|
||||
const ptcToolMap = new Map();
|
||||
for (const tool of allLoadedTools) {
|
||||
if (tool.name && tool.name !== Constants.PROGRAMMATIC_TOOL_CALLING) {
|
||||
if (tool.name && tool.name !== AgentConstants.PROGRAMMATIC_TOOL_CALLING) {
|
||||
ptcToolMap.set(tool.name, tool);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue