AI Providers
Ragfish is designed to work with multiple AI providers through a modular provider architecture.
Instead of tightly coupling the core framework to a single AI platform, Ragfish separates the framework APIs from the implementations provided by individual AI providers.
This allows developers to choose the model provider that best fits their application requirements.
Provider Architecture
The Ragfish provider architecture separates the core framework from provider-specific implementations.
Ragfish Application
│
▼
@ragfish/core
│
Settings
/ \
/ \
▼ ▼
LLM Embeddings
│ │
▼ ▼
AI Provider Packages
For example:
@ragfish/core
│
▼
Settings
│
├───────────────┐
▼ ▼
Settings.llm Settings.embedModel
│ │
▼ ▼
@ragfish/openai
│
├── OpenAILLM
└── OpenAIEmbedding
The current Ragfish architecture uses this separation between the core framework and the OpenAI integration.
Language Models and Embedding Models
Ragfish applications typically use two types of AI models.
Language Model
The language model generates responses based on the user's question and the retrieved context.
User Question
│
▼
Retrieved Context
│
▼
Language Model
│
▼
AI Response
In Ragfish, the language model is configured through:
Settings.llm
Embedding Model
The embedding model converts text into vector representations that can be searched by the retrieval system.
Document
│
▼
Embedding Model
│
▼
Vector
│
▼
Vector Store
The embedding model is configured through:
Settings.embedModel
OpenAI Integration
Ragfish currently provides an OpenAI integration through:
@ragfish/openai
The package provides the OpenAI implementations used by the core framework.
For example:
import {
OpenAILLM,
OpenAIEmbedding
} from "@ragfish/openai";
You can then configure them through Settings:
import { Settings } from "@ragfish/core";
Settings.llm = new OpenAILLM({
apiKey: process.env.OPENAI_API_KEY
});
Settings.embedModel = new OpenAIEmbedding({
apiKey: process.env.OPENAI_API_KEY
});
This allows the core framework to remain independent of the provider implementation.
Supported Providers
The Ragfish provider architecture is designed to support multiple AI providers.
Provider Status
OpenAI Available
Azure OpenAI Coming Soon
Ollama Coming Soon
Gemini Coming Soon
Anthropic Coming Soon
Provider availability may change as new integrations are released.
Why Multiple Providers?
Different applications have different AI requirements.
A developer may choose a provider based on:
Model capabilities
Performance
Cost
Data requirements
Deployment environment
Privacy requirements
Enterprise policies
Availability
Ragfish keeps provider integrations separate so that applications can adopt different providers without redesigning the entire RAG architecture.
Provider Independence
The application architecture remains largely unchanged when the provider changes.
Conceptually:
Ragfish Application
│
▼
Settings
│
┌────┴────────┐
▼ ▼
LLM Embeddings
│ │
▼ ▼
Provider Provider
│ │
├─ OpenAI ├─ OpenAI
├─ Gemini ├─ Gemini
└─ Ollama └─ Ollama
The framework works with the provider through its defined interfaces rather than depending on provider-specific implementation details.
Bring Your Own Model
One of the long-term goals of the Ragfish architecture is to support bring-your-own-model scenarios.
The master framework architecture identifies this as part of Ragfish's broader platform direction, alongside enterprise deployment, multi-tenant support, assistant management, and document governance.
This means applications can be designed around the Ragfish framework while choosing the model infrastructure appropriate for their environment.
Provider Configuration
Provider configuration should normally happen during application initialization.
For example:
import { Settings } from "@ragfish/core";
import {
OpenAILLM,
OpenAIEmbedding
} from "@ragfish/openai";
Settings.llm = new OpenAILLM({
apiKey: process.env.OPENAI_API_KEY
});
Settings.embedModel = new OpenAIEmbedding({
apiKey: process.env.OPENAI_API_KEY
});
The rest of the application can then use the configured models through the core framework.
Provider Packages
Ragfish follows a modular package structure.
@ragfish/core │ ├── Framework ├── Settings ├── Assistant ├── Chat ├── Retrieval └── Interfaces @ragfish/openai │ ├── OpenAILLM └── OpenAIEmbedding @ragfish/qdrant │ ├── QdrantVectorStore └── QdrantRetriever
This keeps provider-specific code outside the core package.
Choosing a Provider
When selecting an AI provider, consider the requirements of your application.
Cloud AI
Use a cloud provider when you want access to managed models and infrastructure.
Self-Hosted AI
Self-hosted providers can be useful when infrastructure control, privacy, or deployment requirements are important.
Enterprise AI
Enterprise environments may require specific providers, security controls, regional availability, or existing cloud agreements.
Ragfish's provider abstraction is designed to accommodate these different deployment requirements.
Provider and RAG Architecture
The AI provider is only one part of a complete Ragfish application.
AI Assistant
│
▼
Chat
│
▼
Retriever
│
▼
Vector Store
▲
│
Embeddings
▲
│
AI Provider
The language model and embedding model work alongside ingestion, chunking, retrieval, and vector storage.
Changing the AI provider should not require changing these other layers.
Best Practices
When working with AI providers:
Keep provider configuration centralized.
Store API credentials in environment variables.
Keep provider-specific code inside provider packages.
Avoid coupling application logic directly to provider APIs.
Use the Ragfish core abstractions wherever possible.
Choose providers based on your application's functional and deployment requirements.
Verify provider capabilities before relying on provider-specific features.
What's Next?
Ragfish currently provides its primary AI provider integration through
Continue to to learn how to install the OpenAI integration, configure OpenAILLM, configure OpenAIEmbedding, and build a complete Ragfish application using OpenAI models.