Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ CYPHER_ENDPOINT=http://localhost:11434/v1
# CYPHER_MODEL=gemini-2.5-flash
# CYPHER_API_KEY=your-google-api-key

# Example 6: All DeepSeek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The example numbering here is inconsistent with the README.md file. This section is labeled "Example 6", but in the README.md it is introduced as "Option 4". To avoid user confusion, it would be best to align the numbering and naming convention across both files.

# Example 4: All DeepSeek

# ORCHESTRATOR_PROVIDER=deepseek
# ORCHESTRATOR_MODEL=deepseek-reasoner
# ORCHESTRATOR_API_KEY=sk-your-deepseek-key

# CYPHER_PROVIDER=deepseek
# CYPHER_MODEL=deepseek-chat
# CYPHER_API_KEY=sk-your-deepseek-key

# Memgraph settings
MEMGRAPH_HOST=localhost
MEMGRAPH_PORT=7687
Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,19 @@ CYPHER_MODEL=gemini-2.5-flash
CYPHER_API_KEY=your-google-api-key
```

#### Option 4: Mixed Providers
#### Option 4: All Deepseek Models
```bash
# .env file
ORCHESTRATOR_PROVIDER=deepseek
ORCHESTRATOR_MODEL=deepseek-reasoner
ORCHESTRATOR_API_KEY=sk-your-deepseek-key

CYPHER_PROVIDER=deepseek
CYPHER_MODEL=deepseek-chat
CYPHER_API_KEY=sk-your-deepseek-key
```

#### Option 5: Mixed Providers
```bash
# .env file - Google orchestrator + Ollama cypher
ORCHESTRATOR_PROVIDER=google
Expand Down Expand Up @@ -555,8 +567,8 @@ Configuration is managed through environment variables in `.env` file:
### Provider-Specific Settings

#### Orchestrator Model Configuration
- `ORCHESTRATOR_PROVIDER`: Provider name (`google`, `openai`, `ollama`)
- `ORCHESTRATOR_MODEL`: Model ID (e.g., `gemini-2.5-pro`, `gpt-4o`, `llama3.2`)
- `ORCHESTRATOR_PROVIDER`: Provider name (`google`, `openai`, `deepseek`, `ollama`)
- `ORCHESTRATOR_MODEL`: Model ID (e.g., `gemini-2.5-pro`, `gpt-4o`, `deepseek-reasoner`, `llama3.2`)
- `ORCHESTRATOR_API_KEY`: API key for the provider (if required)
- `ORCHESTRATOR_ENDPOINT`: Custom endpoint URL (if required)
- `ORCHESTRATOR_PROJECT_ID`: Google Cloud project ID (for Vertex AI)
Expand All @@ -566,8 +578,8 @@ Configuration is managed through environment variables in `.env` file:
- `ORCHESTRATOR_SERVICE_ACCOUNT_FILE`: Path to service account file (for Vertex AI)

#### Cypher Model Configuration
- `CYPHER_PROVIDER`: Provider name (`google`, `openai`, `ollama`)
- `CYPHER_MODEL`: Model ID (e.g., `gemini-2.5-flash`, `gpt-4o-mini`, `codellama`)
- `CYPHER_PROVIDER`: Provider name (`google`, `openai`, `deepseek`, `ollama`)
- `CYPHER_MODEL`: Model ID (e.g., `gemini-2.5-flash`, `gpt-4o-mini`, `deepseek-chat`, `codellama`)
- `CYPHER_API_KEY`: API key for the provider (if required)
- `CYPHER_ENDPOINT`: Custom endpoint URL (if required)
- `CYPHER_PROJECT_ID`: Google Cloud project ID (for Vertex AI)
Expand Down
32 changes: 32 additions & 0 deletions codebase_rag/providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,37 @@ def create_model(self, model_id: str, **kwargs: Any) -> OpenAIResponsesModel:
return OpenAIResponsesModel(model_id, provider=provider, **kwargs)


class DeepSeekProvider(ModelProvider):
"""DeepSeek provider."""

def __init__(
self,
api_key: str | None = None,
endpoint: str = "https://api.deepseek.com",
**kwargs: Any,
) -> None:
super().__init__(**kwargs)
self.api_key = api_key
self.endpoint = endpoint

@property
def provider_name(self) -> str:
return "deepseek"

def validate_config(self) -> None:
if not self.api_key:
raise ValueError(
"DeepSeek provider requires api_key. "
"Set ORCHESTRATOR_API_KEY or CYPHER_API_KEY in .env file."
)

def create_model(self, model_id: str, **kwargs: Any) -> OpenAIModel:
self.validate_config()

provider = PydanticOpenAIProvider(api_key=self.api_key, base_url=self.endpoint)
return OpenAIModel(model_id, provider=provider, **kwargs)


class OllamaProvider(ModelProvider):
"""Ollama local provider."""

Expand Down Expand Up @@ -164,6 +195,7 @@ def create_model(self, model_id: str, **kwargs: Any) -> OpenAIModel:
"google": GoogleProvider,
"openai": OpenAIProvider,
"ollama": OllamaProvider,
"deepseek": DeepSeekProvider,
}


Expand Down