Update DeepSeekLLMService docstrings

This commit is contained in:
Mark Backman
2025-06-26 10:27:36 -04:00
parent 3828df8cf9
commit 65234ae41a

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
"""DeepSeek LLM service implementation using OpenAI-compatible interface."""
from typing import List from typing import List
@@ -22,10 +23,10 @@ class DeepSeekLLMService(OpenAILLMService):
maintaining full compatibility with OpenAI's interface and functionality. maintaining full compatibility with OpenAI's interface and functionality.
Args: Args:
api_key (str): The API key for accessing DeepSeek's API api_key: The API key for accessing DeepSeek's API.
base_url (str, optional): The base URL for DeepSeek API. Defaults to "https://api.deepseek.com/v1" base_url: The base URL for DeepSeek API. Defaults to "https://api.deepseek.com/v1".
model (str, optional): The model identifier to use. Defaults to "deepseek-chat" model: The model identifier to use. Defaults to "deepseek-chat".
**kwargs: Additional keyword arguments passed to OpenAILLMService **kwargs: Additional keyword arguments passed to OpenAILLMService.
""" """
def __init__( def __init__(
@@ -39,24 +40,33 @@ class DeepSeekLLMService(OpenAILLMService):
super().__init__(api_key=api_key, base_url=base_url, model=model, **kwargs) super().__init__(api_key=api_key, base_url=base_url, model=model, **kwargs)
def create_client(self, api_key=None, base_url=None, **kwargs): def create_client(self, api_key=None, base_url=None, **kwargs):
"""Create OpenAI-compatible client for DeepSeek API endpoint.""" """Create OpenAI-compatible client for DeepSeek API endpoint.
Args:
api_key: The API key for authentication. If None, uses instance default.
base_url: The base URL for the API. If None, uses instance default.
**kwargs: Additional keyword arguments for client configuration.
Returns:
An OpenAI-compatible client configured for DeepSeek's API.
"""
logger.debug(f"Creating DeepSeek client with api {base_url}") logger.debug(f"Creating DeepSeek client with api {base_url}")
return super().create_client(api_key, base_url, **kwargs) return super().create_client(api_key, base_url, **kwargs)
async def get_chat_completions( async def get_chat_completions(
self, context: OpenAILLMContext, messages: List[ChatCompletionMessageParam] self, context: OpenAILLMContext, messages: List[ChatCompletionMessageParam]
) -> AsyncStream[ChatCompletionChunk]: ) -> AsyncStream[ChatCompletionChunk]:
"""Create a streaming chat completion using Cerebras's API. """Create a streaming chat completion using DeepSeek's API.
Args: Args:
context (OpenAILLMContext): The context object containing tools configuration context: The context object containing tools configuration
and other settings for the chat completion. and other settings for the chat completion.
messages (List[ChatCompletionMessageParam]): The list of messages comprising messages: The list of messages comprising the conversation
the conversation history and current request. history and current request.
Returns: Returns:
AsyncStream[ChatCompletionChunk]: A streaming response of chat completion A streaming response of chat completion chunks that can be
chunks that can be processed asynchronously. processed asynchronously.
""" """
params = { params = {
"model": self.model_name, "model": self.model_name,