[Feature]: Implement Provider Strategy Pattern for Multi-Model LLM Support
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### Is your feature request related to a problem? Please describe.
Provider strategy pattern created for different LLM model families (GPT-5, GPT-4o, LM Studio, Ollama) with automatic routing based on model prefixes.
Scenario generation failing due to JSON parsing errors when using GPT-5 models. Character background isn't created correctly on gpt-5 models.
The scenario generation system fails when using GPT-5 models (gpt-5-nano, gpt-5-mini) due to malformed JSON responses that cannot be parsed by the fallback JSON extraction logic.
Error Details:
fallback
Root Cause: GPT-5 models generate JSON responses with formatting issues (unterminated strings, extra commas, malformed structures) that the current simple extraction logic cannot handle.
### Describe the solution you'd like
1. Provider Capabilities Matrix (backend/providers/capabilities.py)
Model family detection and capability mapping
API family routing (responses vs chat_completions vs openai_compatible)
2. Strategy Pattern Implementation
OpenAIGPT5Strategy: GPT-5 Responses API integration
OpenAIGPT4oStrategy: GPT-4o Chat Completions via LangChain
OpenAICompatibleStrategy: LM Studio/Ollama support
3. Provider Routing (backend/providers/openai.py)
Automatic strategy selection based on model name prefix
Unified ProviderResponse interface
Testing - Test suite needs to be updated for new architecture
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
### Would you like to contribute this feature?
- [ ] Yes, I would like to implement this feature
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
La issue descrive un pattern strategico per i provider LLM. Inizia esaminando backend/providers/capabilities.py e backend/providers/openai.py per comprendere la struttura attuale. L’obiettivo è creare nuove classi strategia (OpenAIGPT5Strategy, OpenAIGPT4oStrategy, OpenAICompatibleStrategy) che gestiscano diverse famiglie di API e formati di risposta JSON. Sarà necessario aggiornare i test per coprire la nuova architettura.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- ollama
- Ambito
- ai, backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100