Resolver Failing at: Extraction text must be a string, integer, or float. #330
Unanswered
JoshuaSayagh
asked this question in
Q&A
Replies: 1 comment
-
|
This usually happens when the LLM returns malformed JSON or unexpected types. A few things to try: Quick fix: from tenacity import retry, stop_after_attempt, wait_exponential
@retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=2, max=10))
def extract_with_retry():
return your_extraction_call()Root cause: try:
result = extract(...)
except Exception as e:
print(f"Raw LLM output: {raw_output}")
raiseOften it's:
Better prompt: "Return ONLY a valid JSON object. All values must be strings, numbers, or booleans. Never return null."What model are you using? Some are flakier with structured outputs than others. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, once every 20 runs i would say, i get this error:
Extraction text must be a string, integer, or float.i looked it up and it seems it comes from the LLM output being invalid? is there any known fix for this? or the only solution is to retry?I saw a similar discussion about this unanswered.
Thanks for the help
Beta Was this translation helpful? Give feedback.
All reactions