mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔧 refactor: Optimize Agent Tool Loading and Fix Bedrock Tool Handling (#4641)
* fix: bedrock tool name regex * fix: pass args as single input, attempt json first. * refactor: remove toolMap from agent tool load as is not used * fix: update formatAgentMessages test to use strictEqual for args comparison, testing new behavior
This commit is contained in:
parent
3428c3c647
commit
0c2a583df8
9 changed files with 11 additions and 18 deletions
|
|
@ -14,6 +14,7 @@ const { getLogStores } = require('~/cache');
|
|||
const { logger } = require('~/config');
|
||||
|
||||
const toolNameRegex = /^[a-zA-Z0-9_-]+$/;
|
||||
const replaceSeparatorRegex = new RegExp(actionDomainSeparator, 'g');
|
||||
|
||||
/**
|
||||
* Validates tool name against regex pattern and updates if necessary.
|
||||
|
|
@ -83,8 +84,6 @@ async function domainParser(req, domain, inverse = false) {
|
|||
return key;
|
||||
}
|
||||
|
||||
const replaceSeparatorRegex = new RegExp(actionDomainSeparator, 'g');
|
||||
|
||||
if (!cachedDomain) {
|
||||
return domain.replace(replaceSeparatorRegex, '.');
|
||||
}
|
||||
|
|
@ -156,7 +155,7 @@ async function createActionTool({ action, requestBuilder, zodSchema, name, descr
|
|||
|
||||
if (name) {
|
||||
return tool(_call, {
|
||||
name,
|
||||
name: name.replace(replaceSeparatorRegex, '_'),
|
||||
description: description || '',
|
||||
schema: zodSchema,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue