Additional parameters for openai (#385)

This commit is contained in:
Touseef Ahmad 2025-01-28 14:01:12 +05:00 committed by GitHub
parent 42c79f21a1
commit 8178eeca65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -698,6 +698,10 @@ class OpenAIServerModel(Model):
The base URL of the OpenAI-compatible API server. The base URL of the OpenAI-compatible API server.
api_key (`str`, *optional*): api_key (`str`, *optional*):
The API key to use for authentication. The API key to use for authentication.
organization (`str`, *optional*):
The organization to use for the API request.
project (`str`, *optional*):
The project to use for the API request.
custom_role_conversions (`dict[str, str]`, *optional*): custom_role_conversions (`dict[str, str]`, *optional*):
Custom role conversion mapping to convert message roles in others. Custom role conversion mapping to convert message roles in others.
Useful for specific models that do not support specific message roles like "system". Useful for specific models that do not support specific message roles like "system".
@ -710,6 +714,8 @@ class OpenAIServerModel(Model):
model_id: str, model_id: str,
api_base: Optional[str] = None, api_base: Optional[str] = None,
api_key: Optional[str] = None, api_key: Optional[str] = None,
organization: Optional[str] | None = None,
project: Optional[str] | None = None,
custom_role_conversions: Optional[Dict[str, str]] = None, custom_role_conversions: Optional[Dict[str, str]] = None,
**kwargs, **kwargs,
): ):
@ -725,6 +731,8 @@ class OpenAIServerModel(Model):
self.client = openai.OpenAI( self.client = openai.OpenAI(
base_url=api_base, base_url=api_base,
api_key=api_key, api_key=api_key,
organization=organization,
project=project,
) )
self.custom_role_conversions = custom_role_conversions self.custom_role_conversions = custom_role_conversions