diff --git a/CHANGELOG.md b/CHANGELOG.md index e9553c7c1..0a551a155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Added `organization` and `project` level authentication to + `OpenAILLMService`. + - Improved the language checking logic in `ElevenLabsTTSService` and `ElevenLabsHttpTTSService` to properly handle language codes based on model compatibility, with appropriate warnings when language codes cannot be diff --git a/src/pipecat/services/openai.py b/src/pipecat/services/openai.py index 1c3977b7f..ab81a1abb 100644 --- a/src/pipecat/services/openai.py +++ b/src/pipecat/services/openai.py @@ -116,6 +116,8 @@ class BaseOpenAILLMService(LLMService): model: str, api_key=None, base_url=None, + organization=None, + project=None, params: InputParams = InputParams(), **kwargs, ): @@ -131,12 +133,16 @@ class BaseOpenAILLMService(LLMService): "extra": params.extra if isinstance(params.extra, dict) else {}, } self.set_model_name(model) - self._client = self.create_client(api_key=api_key, base_url=base_url, **kwargs) + self._client = self.create_client( + api_key=api_key, base_url=base_url, organization=organization, project=project, **kwargs + ) - def create_client(self, api_key=None, base_url=None, **kwargs): + def create_client(self, api_key=None, base_url=None, organization=None, project=None, **kwargs): return AsyncOpenAI( api_key=api_key, base_url=base_url, + organization=organization, + project=project, http_client=DefaultAsyncHttpxClient( limits=httpx.Limits( max_keepalive_connections=100, max_connections=1000, keepalive_expiry=None