mirror of https://github.com/hwchase17/langchain
openai[patch]: wrap stream code in context manager blocks (#18013)
**Description:** Use the `Stream` context managers in `ChatOpenAi` `stream` and `astream` method. Using the context manager returned by the OpenAI client makes it possible to terminate the stream early since the response connection will be closed when the context manager exists. **Issue:** #5340 **Twitter handle:** @snopoke --------- Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>pull/20218/head
parent
6c11c8dac6
commit
a682f0d12b
Loading…
Reference in New Issue