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