Skip to content

fix(generative): return xAI and DeepSeek metadata in generative results - #2272

Open
MaiAditya wants to merge 1 commit into
weaviate:mainfrom
MaiAditya:fix/xai-deepseek-generative-metadata
Open

MaiAditya wants to merge 1 commit into
weaviate:mainfrom
MaiAditya:fix/xai-deepseek-generative-metadata

Conversation

@MaiAditya

Copy link
Copy Markdown

Fixes #2271

Generative queries using the xAI or DeepSeek provider with return_metadata=True always returned generative.metadata = None, even though Weaviate sends the token usage for both providers.

  • _BaseExecutor.__extract_generative_metadata now checks the deepseek and xai fields too.
  • GenerativeXAIMetadata and GenerativeDeepseekMetadata are added to the GenerativeMetadata union.
  • test/collection/test_generative_metadata.py gets xai and deepseek cases, covering both single and grouped results. All four new cases fail without the fix.

Tests: pytest test/collection gives 453 passed, 1 skipped. ruff check, ruff format --check and flake8 are clean on the changed files.

Weaviate sends usage metadata for the xai and deepseek providers when
return_metadata=True, but the result parser only checked the other
providers, so generative.metadata was always None for these two.
@MaiAditya

Copy link
Copy Markdown
Author

I agree to the Contributor License Agreement.

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

This branch has not been deployed

No deployments
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.

Generative metadata is always None for xAI and DeepSeek

2 participants