Commit graph

257 commits

Author SHA1 Message Date
Gabriel Almeida
d52e7700c0 fix(nodes.py): set prompt field as not required and show it if no prompt is provided 2023-04-28 14:42:38 -03:00
Gabriel Almeida
7a951dcc59 refactor(cache/manager.py): extract add method to reduce code duplication
feat(cache/manager.py): add support for custom extensions when adding objects to cache
2023-04-27 12:11:02 -03:00
Gabriel Almeida
9cf286d4d3 refactor(base.py): remove print statement from ToolCreator class 2023-04-26 09:02:57 -03:00
Gabriel Luiz Freitas Almeida
5dbca85512
Merge branch 'chat_and_cache' into 186-endpoints-for-node-validation-and-debugging 2023-04-26 01:28:43 -03:00
Gabriel Almeida
0945dbe582 style(chat_manager.py, chatMessage/index.tsx): fix indentation and formatting issues 2023-04-26 00:55:44 -03:00
Gabriel Almeida
5894f32ab0 refactor(chat_manager.py): close connection in finally block to prevent memory leaks and improve code readability 2023-04-25 23:17:45 -03:00
Gabriel Almeida
aacfa378f3 refactor(langflow): add verbose and fix_memory_inputs to langchain_object
Add verbose and fix_memory_inputs to langchain_object in load_flow_from_json function. The verbose attribute is set to True if it exists in the langchain_object. The fix_memory_inputs function is called on the langchain_object.
2023-04-25 23:12:44 -03:00
Gabriel Almeida
ed2a2c7db8 feat(chat_manager.py): send error message to client when an exception occurs 2023-04-25 23:07:05 -03:00
Gabriel Almeida
70bfc77a82 feat(chat_manager.py): add base64 encoding for image data in FileResponse objects 2023-04-25 22:15:36 -03:00
Gabriel Almeida
d3b72f3958 refactor(chat_manager.py): add comment to clarify iteration direction in get_file_responses method 2023-04-25 22:12:06 -03:00
Gabriel Almeida
9f8b474a36 refactor(chat_manager.py): prevent notification when message is a FileResponse instance 2023-04-25 22:06:26 -03:00
Gabriel Almeida
4dcfd9d1db feat(chat_manager.py): add file responses to ChatResponse
feat(schemas.py): add files field to ChatResponse schema
2023-04-25 22:01:50 -03:00
Gabriel Almeida
167d6c0f1e refactor(chat_manager.py): add continue statement to clear_history block to skip message processing 2023-04-25 21:47:50 -03:00
Gabriel Almeida
ea210af19b refactor(chat_manager.py, utils.py): remove unused imports and functions, move pil_to_base64 and try_setting_streaming_options to utils module 2023-04-25 21:46:02 -03:00
Gabriel Almeida
42a17e3aaf refactor(chat_manager.py): remove redundant or condition in line 129
feat(chat_manager.py): add strip() method to intermediate_steps to remove leading/trailing whitespaces
2023-04-25 20:50:49 -03:00
Gabriel Almeida
57826f1248 fix(api/chat.py): catch and log exceptions in websocket endpoint
fix(api/chat_manager.py): remove async from ChatHistory.add_message and on_chat_history_update
fix(interface/run.py): remove async from async_get_result_and_steps
refactor(utils/util.py): remove unused code and simplify sync_to_async decorator
2023-04-25 20:26:17 -03:00
Gabriel Almeida
db46f80ac8 Merge remote-tracking branch 'origin/websocket' into chat_and_cache 2023-04-25 19:11:40 -03:00
Gabriel Almeida
60e09a3628 feat(langflow): add support for async functions in Node's func parameter
fix(langflow): fix Node's func parameter to be a coroutine function if it is a sync function
2023-04-25 19:11:04 -03:00
anovazzi1
bc97420b5e Merge remote-tracking branch 'origin/chat_and_cache' into websocket 2023-04-25 17:34:21 -03:00
Gabriel Almeida
2d68541650 refactor(api): remove sender field from ChatMessage and ChatResponse schemas
fix(api): fix ChatManager.get_history method to exclude start and stream messages
feat(api): add is_bot field to ChatMessage, ChatResponse, and FileResponse schemas
2023-04-25 17:30:53 -03:00
anovazzi1
8932a959c0 Merge remote-tracking branch 'origin/chat_and_cache' into websocket 2023-04-25 16:41:20 -03:00
Gabriel Almeida
e1544aadae chore(pyproject.toml): add websockets dependency
refactor(chat_manager.py): remove redundant json.dumps() and convert BaseModel to dict before sending to websocket
2023-04-25 16:35:17 -03:00
anovazzi1
7f2ad60a35 Merge remote-tracking branch 'origin/chat_and_cache' into websocket 2023-04-25 15:42:06 -03:00
Gabriel Almeida
7af5f68861 feat(validate): add debounced validation for nodes in GenericNode component
fix(validate): set validation status to "success" or "error" based on response status
feat(validate): add state for validation status and outline color in GenericNode component
refactor(validate): use useDebouncedCallback hook for debouncing validation function
refactor(validate): simplify useEffect dependencies in GenericNode component
2023-04-25 14:31:57 -03:00
Gabriel Almeida
f122151b12 fix(validate.py): raise an exception with a message when node is not found
feat(GenericNode): add node validation with outline color feedback
feat(tailwind.config.js): add styles for outline colors and animations
2023-04-24 13:43:52 -03:00
Gabriel Almeida
09320824a9 refactor(validate.py): extract build_graph function to langflow.interface.run module
feat(validate.py): add post_validate_node endpoint to validate a single node in the graph by its id
2023-04-24 10:32:15 -03:00
Gabriel Almeida
23eb511560 Merge branch 'dev' of https://github.com/logspace-ai/langflow into dev 2023-04-24 08:40:49 -03:00
Gabriel Almeida
23fbec9d42 feat(loading.py): add error handling for empty documents in vectorstore instantiation
feat(loading.py): add optional build parameter to load_flow_from_json function
2023-04-24 08:40:06 -03:00
Rodrigo Nader
76162a9ffa feat(langflow): Handle ChromaDB NotEnoughElementsException
This change adds error handling to catch a specific exception that may occur when processing documents with the ChromaDB library. If there are not enough documents for indexing, the error message will suggest reducing the chunk size in TextSplitter.
2023-04-23 23:06:10 -03:00
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
Petru Molla
801ff57dc0 Update loading.py 2023-04-20 16:06:22 -03:00
Gabriel Luiz Freitas Almeida
ded527a64a Update loading.py 2023-04-20 16:06:22 -03:00
Petru Molla
68f69e878e Using an exported Flow JSON file with load_flow_from_json("path/to/flow.json") returns
"UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 9465: character maps to
<undefined>".

Specifying the encodint type in the function helps to fix that error.
2023-04-20 16:06:22 -03:00
Ibis Prevedello
46e76c8ca4 feat: add SQLDatabaseChain
Close #173
2023-04-20 15:17:23 -03:00
Ibis Prevedello
843ae8efc5 feat: add extra tools and utilities 2023-04-20 15:17:23 -03:00
Ibis Prevedello
571f407ef3 refac: refactor tools and add QuerySQLDataBaseTool 2023-04-20 15:17:23 -03:00
Gabriel Almeida
5169c0bc27 feat(chat_manager.py): add support for sending file responses
fix(schemas.py): add validation for file response type and data type
test(test_websocket.py): remove data and data_type fields from ChatResponse messages in tests
2023-04-20 11:09:42 -03:00
Gabriel Almeida
3da30cc5bf refactor(cache): move cache functionality to a separate class
feat(cache): add support for multiple clients and context manager to set client_id
feat(cache): add observer pattern to notify on cache changes
feat(cache): add async observer pattern to notify on cache changes in async functions
feat(cache): add methods to add pandas DataFrame or Series and PIL Image to cache
feat(cache): add method to get an object from cache by key
feat(cache): add method to get the last added item in cache
2023-04-20 11:09:11 -03:00
Gabriel Almeida
0a630cd70d refactor(chat_manager.py): move process_graph function outside of ChatManager class
test(websocket.py): add tests for websocket connection, chat history, and sending messages
2023-04-19 22:23:31 -03:00
Gabriel Almeida
7d183ff57e refactor(chat.py, chat_manager.py, schemas.py, run.py): add chat history to ChatManager and ChatMessage schema
feat(chat.py, chat_manager.py): add error handling for async_get_result_and_steps
feat(chat.py): add client_id to websocket endpoint
feat(schemas.py): add data_type field to ChatResponse schema
refactor(run.py): memoize build_langchain_object_with_caching function with maxsize of 10
2023-04-19 21:28:05 -03:00
Gabriel Almeida
18b3583850 test(websocket.py): add tests for websocket connection, chat history and sending message 2023-04-19 13:13:58 -03:00
Gabriel Almeida
e4d0a39b0b refactor: remove unnecessary build and push scripts and Dockerfiles
The removed files were unnecessary and were removed to simplify the project.
2023-04-19 11:49:17 -03:00
Gabriel Almeida
d978ae5438 refactor(cache): move cache-related functions to base.py module
feat(cache): add support for pandas and PIL Image objects caching
fix(interface): import cache-related functions from base.py module
test(cache): update import statements in cache-related test file
2023-04-19 11:02:32 -03:00
Gabriel Almeida
8721083c25 refactor(run.py): simplify fix_memory_inputs function and handle cases where langchain_object has no prompt attribute 2023-04-19 00:48:06 -03:00
Gabriel Almeida
cd241c22c7 refactor(loading.py): add support for instantiating tool nodes
refactor(tools/base.py): comment out unused code for ToolCreator
feat(nodes.py): add 'return_direct' field to ToolNode template and set base class to 'Tool'
2023-04-19 00:46:57 -03:00
Gabriel Almeida
a0da9c6111 refactor(validate.py): filter function objects by filename to ensure they are from the evaluated string 2023-04-18 21:27:47 -03:00
Ibis Prevedello
e1f4041908 Fix bug when running LLM alone
Fix #117
2023-04-17 16:57:49 -03:00
Ibis Prevedello
ec0c6c79c1 feat: add SQL agent 2023-04-13 22:33:46 -03:00
Ibis Prevedello
3d211fc487 fix test, linting, and vector_store folder 2023-04-13 22:12:21 -03:00
Ibis Prevedello
ba1f7daa7a refac: change docstring parser 2023-04-13 21:39:25 -03:00