Skip to content
Snippets Groups Projects
Unverified Commit 6d37d440 authored by Savas Ziplies's avatar Savas Ziplies Committed by GitHub
Browse files

refactor(agent): changed regex for tool use extraction to look for optional...

refactor(agent): changed regex for tool use extraction to look for optional "Input:" prefix to comply with Cohere command-r models (#1654)
parent e724f7e9
No related branches found
No related tags found
No related merge requests found
---
"llamaindex": patch
---
fix: Update react agent to support tool calls from Cohere command-r models
...@@ -100,7 +100,7 @@ function extractToolUse( ...@@ -100,7 +100,7 @@ function extractToolUse(
inputText: string, inputText: string,
): [thought: string, action: string, input: string] { ): [thought: string, action: string, input: string] {
const pattern = 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); const match = inputText.match(pattern);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment