Blog → Regalame → Architecture
One interface, two LLM providers
Regalame needs language models inside real product features, but application code should not be tied to the details of one provider. The current layer separates those concerns.
The constraint
Gemini is the primary provider and DeepSeek is available as a fallback. Adding or changing a provider should not require every calling feature to learn a new SDK, response format or error model.
A small common interface
The layer exposes generate_text and generate_structured. Both return normalized responses and raise errors defined by the application rather than leaking provider-specific exceptions into product code.
Retries and fallback
Transient failures can be retried. When the primary path cannot complete under the configured rules, the request can fall back from Gemini to DeepSeek. The fallback is explicit and observable rather than hidden inside each feature.
Structured output
For features that need data rather than prose, Pydantic models define the expected shape. Provider responses are validated and returned in a consistent form before the rest of Regalame uses them.
Logging records provider, model, latency, retries and fallback so behavior can be investigated without reconstructing it from a user report.
Current status
This architecture is part of Regalame's AI-first work. The current phase focuses on stabilization, testing and a confident deployment of the provider layer.