fix(retain): unwrap Vertex AI Claude parameter envelope in fact extraction - #3029
Open
yossiovadia wants to merge 1 commit into
Open
fix(retain): unwrap Vertex AI Claude parameter envelope in fact extraction#3029yossiovadia wants to merge 1 commit into
yossiovadia wants to merge 1 commit into
Conversation
…ction
When using litellm with vertex_ai/claude-* models, structured output
responses are wrapped in a {"parameter": {...}} envelope. The fact
extraction parser expected {"facts": [...]} at the top level, silently
returning 0 facts for every retain operation.
Unwrap the parameter envelope in _coerce_fact_response() before
extracting facts.
Fixes vectorize-io#3028
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
litellmwithvertex_ai/claude-*models{"parameter": {...}}— the parser now unwraps this envelope before extracting facts_coerce_fact_response()covering the envelope unwrap, normal passthrough, bare lists, and invalid inputsProblem
Retains via
litellm+vertex_ai/claude-*silently produce 0 facts. The LLM successfully extracts facts (visible inllm-requestswithoutput_tokens > 0), but_coerce_fact_response()returns the full envelope{"parameter": {"facts": [...]}}andextraction_response_json.get("facts", [])returns[]because"facts"is nested one level deeper.Test plan
pytest tests/test_coerce_fact_response_parameter_wrapper.py -v— 6/6 passlitellm+vertex_ai/claude-opus-4-6now extracts facts (was 0, now 3 facts from same input){"facts": [...]}responses pass through unchangedFixes #3028