Skip to content

[Python] Fix Hugging Face API error and token handling - #40779

Draft
bvolpato wants to merge 1 commit into
apache:masterfrom
bvolpato:bvolpato/huggingface-api-error-reporting
Draft

bvolpato wants to merge 1 commit into
apache:masterfrom
bvolpato:bvolpato/huggingface-api-error-reporting

Conversation

@bvolpato

Copy link
Copy Markdown
Contributor

Related #30799.

Raise HTTP errors before decoding Hugging Face responses as embeddings, so a failed request reports its status and endpoint instead of failing later in NumPy.

Reuse the authorization established when loading the session. The redundant request header currently replaces a valid HF_TOKEN fallback with Bearer None.

Regression checks fail before the fix and pass afterward using real prepared requests and response objects. The local module tests, Ruff, and YAPF pass. The provider rejection seen in CI still needs separate diagnosis.

@github-actions github-actions Bot added python size/s S: 10-49 lines changed labels Oct 25, 2026
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.85%. Comparing base (12bbb17) to head (657faba).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40779      +/-   ##
==========================================
+ Coverage   79.83%   79.85%   +0.02%     
==========================================
  Files         494      494              
  Lines       83575    83582       +7     
==========================================
+ Hits        66722    66747      +25     
+ Misses      16853    16835      -18     
Flag Coverage Δ
python 79.85% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bvolpato
bvolpato force-pushed the bvolpato/huggingface-api-error-reporting branch from a82805d to 657faba Compare October 30, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python size/s S: 10-49 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant