Skip to content

Commit

Permalink
Convert get_api_key method into a property: _api_key
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesev15 committed Nov 1, 2024
1 parent cd72d57 commit c80052b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libs/community/langchain_community/chat_models/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ def _default_params(self) -> Dict[str, Any]:
**self.model_kwargs,
}

def get_api_key(self) -> str:
@property
def _api_key(self) -> str:
return (
self.openai_api_key
or self.azure_api_key
Expand All @@ -286,7 +287,7 @@ def _client_params(self) -> Dict[str, Any]:
if self.model_name is not None:
set_model_value = self.model_name
self.client.api_base = self.api_base
self.client.api_key = self.get_api_key()
self.client.api_key = self._api_key
self.client.organization = self.organization
creds: Dict[str, Any] = {
"model": set_model_value,
Expand Down

0 comments on commit c80052b

Please sign in to comment.