autoflow icon indicating copy to clipboard operation
autoflow copied to clipboard

Too many retries trying to get the correct output format. Try simplifying the requirements.', {'subquestions': "ValueError('json output should start and end with { and }')"})

Open javanan opened this issue 9 months ago • 3 comments

backend-1 | 2025-02-20 02:34:46,913 - app.rag.chat:215 - ERROR - ('Too many retries trying to get the correct output format. Try simplifying the requirements.', {'subquestions': "ValueError('json output should start and end with { and }')"}) backend-1 | Traceback (most recent call last): backend-1 | File "/app/app/rag/chat.py", line 212, in chat backend-1 | for event in self._chat(): backend-1 | File "/app/app/rag/chat.py", line 700, in _chat backend-1 | ) = yield from self._search_kg( backend-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-1 | File "/app/app/rag/chat.py", line 278, in _search_kg backend-1 | sub_queries = graph_index.intent_analyze( backend-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-1 | File "/app/app/rag/knowledge_graph/base.py", line 237, in intent_analyze backend-1 | intents = self._intents.analyze(chat_content) backend-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-1 | File "/app/app/rag/knowledge_graph/intent.py", line 77, in analyze backend-1 | return self.intent_anlysis_prog(query=query).subquestions backend-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-1 | File "/usr/local/lib/python3.11/site-packages/dspy/primitives/program.py", line 26, in call backend-1 | return self.forward(*args, **kwargs) backend-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-1 | File "/app/app/rag/knowledge_graph/intent.py", line 67, in forward backend-1 | return self.prog(query=query) backend-1 | ^^^^^^^^^^^^^^^^^^^^^^ backend-1 | File "/usr/local/lib/python3.11/site-packages/dspy/primitives/program.py", line 26, in call backend-1 | return self.forward(*args, **kwargs) backend-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ backend-1 | File "/usr/local/lib/python3.11/site-packages/dspy/functional/functional.py", line 369, in forward backend-1 | raise ValueError( backend-1 | ValueError: ('Too many retries trying to get the correct output format. Try simplifying the requirements.', {'subquestions': "ValueError('json output should start and end with { and }')"})

Not finished Sources Empty Answer This chatbot is in Beta. All generated information should be verified prior to use. Failed to generate response Encountered an error while processing the chat. Please try again later.

Image

javanan avatar Feb 20 '25 02:02 javanan

Which model are you currently using?

Mini256 avatar Feb 28 '25 02:02 Mini256

I have encountered the same problem. May I ask if there is any solution to it?

leeyuxxuan avatar Mar 20 '25 05:03 leeyuxxuan

@javanan @leeyuxxuan Thanks for your feedback! I am trying to solve this kind of compatibility issue. Could you mind tell me the llm model you used? I may add it to the integration tests.

For workaround:

Maybe you can add some few-shot exampels for this module by specifing the following environment vairbale in the .env file to resolve it:

COMPLIED_INTENT_ANALYSIS_PROGRAM_PATH=./dspy_compiled_program/decompose_query_program

Mini256 avatar Apr 28 '25 06:04 Mini256