Skip to content

feat(huggingface_hub): Set request parameters (#7993) - #8061

Open
ansh-rohilla wants to merge 2 commits into
getsentry:masterfrom
ansh-rohilla:feat/huggingface-hub-request-parameters-7993
Open

ansh-rohilla wants to merge 2 commits into
getsentry:masterfrom
ansh-rohilla:feat/huggingface-hub-request-parameters-7993

Conversation

@ansh-rohilla

Copy link
Copy Markdown

Description

Record gen_ai.request configuration attributes when available in huggingface_hub requests, as requested in issue #7993.

Key changes:

  • Added seed to attribute_mapping mapping to SPANDATA.GEN_AI_REQUEST_SEED.
  • Supported extracting max_new_tokens for SPANDATA.GEN_AI_REQUEST_MAX_TOKENS when max_tokens is not explicitly set (such as in InferenceClient.text_generation).
  • Supported reading parameters from extra_body dict when provided.
  • Added comprehensive unit tests in tests/integrations/huggingface_hub/test_huggingface_hub.py for both text_generation and chat_completion, covering provided attributes, zero-value attributes, and omitted/None attributes across streaming and static lifecycle configurations.

Issues

Record gen_ai.request configuration attributes when available in huggingface_hub.

- Add seed to attribute_mapping for gen_ai.request.seed
- Support max_new_tokens for gen_ai.request.max_tokens in text_generation
- Fall back to extra_body dict if parameters are provided there
- Add unit tests for request parameters in text_generation and chat_completion

Resolves getsentry#7993
Resolves PY-2977
@ansh-rohilla
ansh-rohilla requested a review from a team as a code owner October 19, 2026 11:16

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6e2a6a7. Configure here.

Comment thread tests/integrations/huggingface_hub/test_huggingface_hub.py Outdated
Only pass extra_body and assert top_k in chat_completion when HF_VERSION >= 0.29.0.

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.

huggingface_hub: Set request parameters

1 participant