mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 17:05:56 +03:00
[PR #437] [MERGED] Refactor Hugging Face provider: fallbacks, retries, and improved error handling #742
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#742
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/437
Author: @AJaySi
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @AJaySi
Base:
main← Head:codex/fix-merge-conflicts-in-huggingface_provider.py📝 Commits (1)
9689008Repair huggingface provider and restore explicit retry/fallback behavior📊 Changes
1 file changed (+151 additions, -497 deletions)
View changed files
📝
backend/services/llm_providers/huggingface_provider.py(+151 -497)📄 Description
Motivation
response_format.Description
get_service_logger, makeOpenAI/NotFoundErrorsafe when theopenaipackage is missing, and add@lru_cachefor_get_hf_clientcreation._candidate_model_variantsand_fallback_model_sequence, and centralize non-retryable classification in_is_non_retryable_hf_errorand_classify_hf_error.get_huggingface_api_key, usetenacityretries with_should_retry_hf_error, and wraphuggingface_text_responseandhuggingface_structured_json_responsewith retry logic.NotFoundErrorand other call errors per-model, enforce fallback/no-response_formatpaths for structured responses, and include regex-based JSON extraction as a parsing fallback.get_available_modelsandvalidate_model, and replace many ad-hoc debug/log messages with structured error logging using_error_details.Testing
backend/services/llm_providersand integration tests against the Hugging Face Router endpoint to validate fallback and parsing behavior.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.