mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-08-26 12:24:44 -04:00
refactor(agent): changed regex for tool use extraction to look for optional "Input:" prefix to comply with Cohere command-r models (#1654)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"llamaindex": patch
|
||||
---
|
||||
|
||||
fix: Update react agent to support tool calls from Cohere command-r models
|
||||
@@ -100,7 +100,7 @@ function extractToolUse(
|
||||
inputText: string,
|
||||
): [thought: string, action: string, input: string] {
|
||||
const pattern =
|
||||
/\s*Thought: (.*?)\nAction: ([a-zA-Z0-9_]+).*?\.*Input: .*?(\{.*?\})/s;
|
||||
/\s*Thought: (.*?)\nAction: ([a-zA-Z0-9_]+).*?\.*[Input:]*.*?(\{.*?\})/s;
|
||||
|
||||
const match = inputText.match(pattern);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user