mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
Chat model stream readability nit (#10469)
This commit is contained in:
parent
d45b042d3e
commit
6598178343
@ -222,7 +222,8 @@ class ChatKonko(ChatOpenAI):
|
|||||||
stream: Optional[bool] = None,
|
stream: Optional[bool] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> ChatResult:
|
) -> ChatResult:
|
||||||
if stream if stream is not None else self.streaming:
|
should_stream = stream if stream is not None else self.streaming
|
||||||
|
if should_stream:
|
||||||
generation: Optional[ChatGenerationChunk] = None
|
generation: Optional[ChatGenerationChunk] = None
|
||||||
for chunk in self._stream(
|
for chunk in self._stream(
|
||||||
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
||||||
|
@ -318,7 +318,8 @@ class ChatLiteLLM(BaseChatModel):
|
|||||||
stream: Optional[bool] = None,
|
stream: Optional[bool] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> ChatResult:
|
) -> ChatResult:
|
||||||
if stream if stream is not None else self.streaming:
|
should_stream = stream if stream is not None else self.streaming
|
||||||
|
if should_stream:
|
||||||
generation: Optional[ChatGenerationChunk] = None
|
generation: Optional[ChatGenerationChunk] = None
|
||||||
for chunk in self._stream(
|
for chunk in self._stream(
|
||||||
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
||||||
@ -418,7 +419,8 @@ class ChatLiteLLM(BaseChatModel):
|
|||||||
stream: Optional[bool] = None,
|
stream: Optional[bool] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> ChatResult:
|
) -> ChatResult:
|
||||||
if stream if stream is not None else self.streaming:
|
should_stream = stream if stream is not None else self.streaming
|
||||||
|
if should_stream:
|
||||||
generation: Optional[ChatGenerationChunk] = None
|
generation: Optional[ChatGenerationChunk] = None
|
||||||
async for chunk in self._astream(
|
async for chunk in self._astream(
|
||||||
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
||||||
|
@ -328,7 +328,8 @@ class ChatOpenAI(BaseChatModel):
|
|||||||
stream: Optional[bool] = None,
|
stream: Optional[bool] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> ChatResult:
|
) -> ChatResult:
|
||||||
if stream if stream is not None else self.streaming:
|
should_stream = stream if stream is not None else self.streaming
|
||||||
|
if should_stream:
|
||||||
generation: Optional[ChatGenerationChunk] = None
|
generation: Optional[ChatGenerationChunk] = None
|
||||||
for chunk in self._stream(
|
for chunk in self._stream(
|
||||||
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
||||||
@ -408,7 +409,8 @@ class ChatOpenAI(BaseChatModel):
|
|||||||
stream: Optional[bool] = None,
|
stream: Optional[bool] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> ChatResult:
|
) -> ChatResult:
|
||||||
if stream if stream is not None else self.streaming:
|
should_stream = stream if stream is not None else self.streaming
|
||||||
|
if should_stream:
|
||||||
generation: Optional[ChatGenerationChunk] = None
|
generation: Optional[ChatGenerationChunk] = None
|
||||||
async for chunk in self._astream(
|
async for chunk in self._astream(
|
||||||
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
messages=messages, stop=stop, run_manager=run_manager, **kwargs
|
||||||
|
Loading…
Reference in New Issue
Block a user