mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-07 13:40:46 +00:00
add setters
This commit is contained in:
parent
7506c72346
commit
230f2e030a
@ -641,6 +641,10 @@ class BaseChatOpenAI(BaseChatModel):
|
||||
)
|
||||
return self._root_client
|
||||
|
||||
@root_client.setter
|
||||
def root_client(self, value: openai.OpenAI) -> None:
|
||||
self._root_client = value
|
||||
|
||||
@property
|
||||
def root_async_client(self) -> openai.AsyncOpenAI:
|
||||
if self._root_async_client is None:
|
||||
@ -651,18 +655,30 @@ class BaseChatOpenAI(BaseChatModel):
|
||||
)
|
||||
return self._root_async_client
|
||||
|
||||
@root_async_client.setter
|
||||
def root_async_client(self, value: openai.AsyncOpenAI) -> None:
|
||||
self._root_async_client = value
|
||||
|
||||
@property
|
||||
def client(self) -> Any:
|
||||
if self._client is None:
|
||||
self._client = self.root_client.chat.completions
|
||||
return self._client
|
||||
|
||||
@client.setter
|
||||
def client(self, value: Any) -> None:
|
||||
self._client = value
|
||||
|
||||
@property
|
||||
def async_client(self) -> Any:
|
||||
if self._async_client is None:
|
||||
self._async_client = self.root_async_client.chat.completions
|
||||
return self._async_client
|
||||
|
||||
@async_client.setter
|
||||
def async_client(self, value: Any) -> None:
|
||||
self._async_client = value
|
||||
|
||||
@property
|
||||
def _default_params(self) -> Dict[str, Any]:
|
||||
"""Get the default parameters for calling OpenAI API."""
|
||||
|
Loading…
Reference in New Issue
Block a user