langflow/src/backend
Gabriel Almeida ebc1f6a0df feat(api): add callback handler for streaming LLM responses
Add a new file `callback.py` that contains a new class `StreamingLLMCallbackHandler` that inherits from `AsyncCallbackHandler`. This class handles streaming LLM responses. It has a constructor that takes a `websocket` parameter and sets it as an instance variable. It also has an `on_llm_new_token` method that takes a `token` parameter and sends a `ChatResponse` object to the `websocket` instance variable.

Update `chat_manager.py` to import the new `StreamingLLMCallbackHandler` class. Add a new function `try_setting_streaming_options` that takes a `langchain_object` and a `websocket` parameter. This function checks if the `llm` attribute of the `langchain_object` is an instance of `OpenAI`, `ChatOpenAI`, `AzureOpenAI`, or `AzureChatOpenAI`. If it is, it sets the
2023-04-23 14:31:21 -03:00
..
langflow feat(api): add callback handler for streaming LLM responses 2023-04-23 14:31:21 -03:00
.gitignore refac: langflow_backend -> langflow 2023-03-17 09:50:02 -03:00
Dockerfile refac: langflow_backend -> langflow 2023-03-17 09:50:02 -03:00