SimpleChatTC: Trap any exception raised during tool call
and inform the GenAi/LLM about the same
This commit is contained in:
parent
17c5daa52c
commit
b4776da670
|
|
@ -536,8 +536,12 @@ class SimpleChat {
|
|||
}
|
||||
for (const fn in tools.tc_switch) {
|
||||
if (fn == toolname) {
|
||||
tools.tc_switch[fn]["handler"](JSON.parse(ar.response.toolargs))
|
||||
return tools.tc_switch[fn]["result"]
|
||||
try {
|
||||
tools.tc_switch[fn]["handler"](JSON.parse(ar.response.toolargs))
|
||||
return tools.tc_switch[fn]["result"]
|
||||
} catch (error) {
|
||||
return `Tool/Function call raised an exception:${error.name}:${error.message}`
|
||||
}
|
||||
}
|
||||
}
|
||||
return `Unknown Tool/Function Call:${toolname}`
|
||||
|
|
|
|||
|
|
@ -73,10 +73,12 @@ exit
|
|||
|
||||
"content": "what is your name."
|
||||
"content": "What and all tools you have access to"
|
||||
"content": "do you have access to any tools"
|
||||
"content": "Print a hello world message with python."
|
||||
"content": "Print a hello world message with javascript."
|
||||
"content": "Calculate the sum of 5 and 27."
|
||||
"content": "Can you get me todays date."
|
||||
"content": "Can you get me a summary of latest news from bbc world"
|
||||
"content": "Can you get todays date. And inturn add 10 to todays date"
|
||||
"content": "Who is known as father of the nation in India, also is there a similar figure for USA as well as UK"
|
||||
"content": "Who is known as father of the nation in India, Add 10 to double his year of birth and show me the results."
|
||||
|
|
|
|||
Loading…
Reference in New Issue