Skip to content

fix(retain): unwrap Vertex AI Claude parameter envelope in fact extraction - #3029

Open
yossiovadia wants to merge 1 commit into
vectorize-io:mainfrom
yossiovadia:fix/vertex-ai-parameter-envelope-unwrap
Open

fix(retain): unwrap Vertex AI Claude parameter envelope in fact extraction#3029
yossiovadia wants to merge 1 commit into
vectorize-io:mainfrom
yossiovadia:fix/vertex-ai-parameter-envelope-unwrap

Conversation

@yossiovadia

Copy link
Copy Markdown

Summary

  • Fixes silent 0-fact extraction when using litellm with vertex_ai/claude-* models
  • Vertex AI Claude wraps tool-use structured output in {"parameter": {...}} — the parser now unwraps this envelope before extracting facts
  • Adds 6 unit tests for _coerce_fact_response() covering the envelope unwrap, normal passthrough, bare lists, and invalid inputs

Problem

Retains via litellm + vertex_ai/claude-* silently produce 0 facts. The LLM successfully extracts facts (visible in llm-requests with output_tokens > 0), but _coerce_fact_response() returns the full envelope {"parameter": {"facts": [...]}} and extraction_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 pass
  • Manual verification: retain with litellm + vertex_ai/claude-opus-4-6 now extracts facts (was 0, now 3 facts from same input)
  • Existing tests unaffected — normal {"facts": [...]} responses pass through unchanged

Fixes #3028

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: fact extraction returns 0 facts with litellm + Vertex AI Claude

1 participant