run-llama / LlamaIndexTS

LlamaIndex in TypeScript
https://ts.llamaindex.ai
MIT License
1.81k stars 346 forks source link

RegEx for extracting tool use is probably bogus #1019

Closed dhuebner closed 2 months ago

dhuebner commented 3 months ago

RegEx pattern defined in extractToolUse function here seem to be bogus to me.

A backslash is missing before the }.

Is: /\s*Thought: (.*?)\nAction: ([a-zA-Z0-9_]+).*?\.*Input: .*?(\{.*?})/s Should be: /\s*Thought: (.*?)\nAction: ([a-zA-Z0-9_]+).*?\.*Input: .*?(\{.*?\})/s

Example input to test with:

Thought: I need to rephrase the input.
Action: my_db
Input: {
  \\query\\: "What is LLamaIndex?"
}
dhuebner commented 3 months ago

Same in extractJsonStr(text) function?

ranjanmangla1 commented 2 months ago

hey @himself65 and @dhuebner , new to project, can I take this one?

himself65 commented 2 months ago

yeah