Skip to content

Conversation

@Pratham-Mishra04
Copy link
Collaborator

Summary

Improve error handling for HTML responses from providers and enable batch API support for HuggingFace.

Changes

  • Updated error messages for HTML responses to be more descriptive and consistent, changing from specific HTTP status messages to a generic "HTML response received from provider"
  • Added UseForBatchAPI flag to HuggingFace API key configuration to enable batch processing capabilities

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (Next.js)
  • Docs

How to test

Test HTML error handling:

go test ./core/providers/utils/html_response_handler_test.go

Test HuggingFace batch API functionality:

# Set HUGGING_FACE_API_KEY environment variable
export HUGGING_FACE_API_KEY=your_key_here
# Run tests that utilize the batch API functionality
go test ./core/providers/huggingface/...

Breaking changes

  • Yes
  • No

Related issues

N/A

Security considerations

No security implications as this only affects error handling and API functionality configuration.

Checklist

  • I added/updated tests where appropriate
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Updated test configurations for HuggingFace provider batch API functionality.
    • Updated test expectations for HTML error response handling to align with provider API behavior detection.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Two test-related changes: adding a UseForBatchAPI field to HuggingFace provider key configuration in test utilities, and updating HTML error response handler test expectations to verify generic error messages instead of provider-specific ones.

Changes

Cohort / File(s) Change Summary
HuggingFace batch API configuration
core/internal/testutil/account.go
Added UseForBatchAPI field set to true for HuggingFace provider key configuration in GetKeysForProvider function.
HTML response handler test expectations
core/providers/utils/html_response_handler_test.go
Updated test expectations in TestHandleProviderAPIErrorWithHTML: changed expected error messages for HTML 500 and 403 error cases from provider-specific messages ("Internal Server Error", "Forbidden") to generic "HTML response received from provider" message.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Both changes are isolated to test code and test configuration
  • No production code modifications
  • Changes are straightforward field additions and test assertion updates with clear intent

Poem

🐰 A field hops into HuggingFace's bright parade,
UseForBatchAPI in the test plans made,
HTML messages now speak with one voice,
Generic and clean—the testing choice!
Batch calls bound, expectations aligned, hooray! 🎉

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 12-19-chore_test_fixes

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 986471a and c5388a8.

📒 Files selected for processing (2)
  • core/internal/testutil/account.go (1 hunks)
  • core/providers/utils/html_response_handler_test.go (2 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

🧪 Test Suite Available

This PR can be tested by a repository admin.

Run tests for PR #1140

Copy link
Collaborator Author

Pratham-Mishra04 commented Dec 19, 2025

Merge activity

  • Dec 19, 1:07 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 19, 1:08 PM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04 Pratham-Mishra04 merged commit ed724ce into main Dec 19, 2025
10 of 11 checks passed
@Pratham-Mishra04 Pratham-Mishra04 deleted the 12-19-chore_test_fixes branch December 19, 2025 13:08
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.

3 participants