mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 17:05:56 +03:00
[PR #416] [MERGED] Tenant-aware LLM routing, Hugging Face client refactor, and personalization input hardening #719
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#719
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/416
Author: @AJaySi
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @AJaySi
Base:
main← Head:codex/document-llm-provider-routing-choices📝 Commits (1)
4b7f443Fix TEXTGEN_AI_MODELS full-name mapping and unify model resolution📊 Changes
5 files changed (+435 additions, -375 deletions)
View changed files
📝
backend/services/llm_providers/huggingface_provider.py(+79 -183)📝
backend/services/llm_providers/main_text_generation.py(+227 -183)➕
backend/services/llm_providers/routing_observability.py(+22 -0)➕
backend/services/llm_providers/tenant_provider_config.py(+83 -0)📝
backend/services/product_marketing/personalization_service.py(+24 -9)📄 Description
Motivation
Description
backend/services/llm_providers/huggingface_provider.pyto add_get_hf_client(cached vialru_cache), accept an optionalapi_keyparam inget_huggingface_api_keyand response functions, centralize error classification via_classify_hf_errorand_error_details, remove legacy fallback loops and dotenv path hacks, and improve structured logging.backend/services/llm_providers/main_text_generation.pyto add tenant-aware routing and model resolution, provider normalization, multi-provider/model attempt loop, strict pinned-provider behavior, tenant API key retrieval, and routing observability events; integratedget_available_text_providersandget_tenant_api_keyand updated usage tracking hooks.backend/services/llm_providers/tenant_provider_config.pyto resolve tenant-scoped API keys (DB lookup with caching) and to enumerate available providers for a tenant.backend/services/llm_providers/routing_observability.pyto emit masked, structured routing events for observability.backend/services/product_marketing/personalization_service.pyby adding_ensure_dictand_ensure_listhelpers and using them to coerce onboarding payloads into stable types before mapping preferences.Testing
llm_providersandproduct_marketingmodules; tests covering text generation and personalization logic completed and passed.llm_text_genrouting and Hugging Face call paths (mocked keys/clients); routing events and error logging emitted as expected.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.