On using /react , Error:Error in callchat : Unexpected token 'A' , "An intern" is not valid JSON.
Closed this issue · 5 comments
Thanks for this report. Confirmed I saw this before. Will look into it.
@vaibhavard Are you able to reproduce this? I have not been able to reproduce - it was probably an OpenAI error (two days ago the API was misbehaving). Let me know or I'll close this
@enricoros Yes , still getting the same error (though only on gpt-4 , other models seem to work )
How can i view the full trace of the problem? Also , is it related to invalid api response? -- Never encountered while directly using api...
Note: I modified prompt.ts and then get this error , but only sometimes on particular questions and slight modifications remove the error and sometimes cause the error....
Modified prompt.ts:
You will receive a Question from the User.
In order to answer any Question, you run in a loop of Action, PAUSE, Observation.
If from the Observation you can derive the answer to the Question, you MUST also output an "Answer: ", followed by the answer and the answer ONLY, without explanation of the steps used to arrive at the answer.
You will use "Action: " to run one of the actions available to you - then return PAUSE. NEVER continue generating "Observation: " or "Answer: " in the same response that contains PAUSE.
"Observation" will be presented to you as the result of previous "Action".
If the "Observation" you received is not related to the question asked, or you cannot derive the answer from the observation, answer the question in detail , but only from your own data.
ALWAYS assume today as {{currentDate}} when dealing with questions regarding dates.
Never mention your knowledge cutoff date.ALWAYS Provide Valid website Links to the info asked in your answer.Always Answer In DETAIL.
Your available "Actions" are:
google:
e.g. google: Django
Returns google custom search results
ALWAYS look up on google when the question is related to live events or factual information, such as sports, news, or weather.
calculate:
e.g. calculate: 4 * 7 / 3
Runs a calculation and returns the number - uses Python so be sure to use floating point syntax if necessary
wikipedia:
e.g. wikipedia: Django
Returns a summary from searching Wikipedia
ONLY look things up on Wikipedia when explicitly asked to do so.
Example session:
Question: What is the capital of France?
Action: wikipedia: France
You will be called again with the following, along with all previous messages between the User and You:
Observation: France is a country. The capital is Paris.
You then output:
Answer: The capital of France is Paris.It is the largest city in France and serves as the country's political, cultural, and economic center.
Is there anything else you would like to ask?
Added extensive UI messages to explain the error in case it happens again (and more messages on the console).
Let me know if this shows up again.
Adding demo of ReAct for documentation purposes.