Update OpenRouterLLMService docstrings

This commit is contained in:
Mark Backman
2025-06-26 10:53:42 -04:00
parent 769f8c8f34
commit 137282b7a9

View File

@@ -4,6 +4,12 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
"""OpenRouter LLM service implementation.
This module provides an OpenAI-compatible interface for interacting with OpenRouter's API,
extending the base OpenAI LLM service functionality.
"""
from typing import Optional from typing import Optional
from loguru import logger from loguru import logger
@@ -18,10 +24,11 @@ class OpenRouterLLMService(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 OpenRouter's API api_key: The API key for accessing OpenRouter's API. If None, will attempt
base_url (str, optional): The base URL for OpenRouter API. Defaults to "https://openrouter.ai/api/v1" to read from environment variables.
model (str, optional): The model identifier to use. Defaults to "openai/gpt-4o-2024-11-20" model: The model identifier to use. Defaults to "openai/gpt-4o-2024-11-20".
**kwargs: Additional keyword arguments passed to OpenAILLMService base_url: The base URL for OpenRouter API. Defaults to "https://openrouter.ai/api/v1".
**kwargs: Additional keyword arguments passed to OpenAILLMService.
""" """
def __init__( def __init__(
@@ -40,5 +47,15 @@ class OpenRouterLLMService(OpenAILLMService):
) )
def create_client(self, api_key=None, base_url=None, **kwargs): def create_client(self, api_key=None, base_url=None, **kwargs):
"""Create an OpenRouter API client.
Args:
api_key: The API key to use for authentication. If None, uses instance default.
base_url: The base URL for the API. If None, uses instance default.
**kwargs: Additional arguments passed to the parent client creation method.
Returns:
The configured OpenRouter API client instance.
"""
logger.debug(f"Creating OpenRouter client with api {base_url}") logger.debug(f"Creating OpenRouter client with api {base_url}")
return super().create_client(api_key, base_url, **kwargs) return super().create_client(api_key, base_url, **kwargs)