Commit graph

332 commits

Author SHA1 Message Date
Gabriel Almeida
d55d209dc3 formatting 2023-05-11 14:33:52 -03:00
Lucas Oliveira
97c60eaa5d Merge branch 'dev' into frontChanges 2023-05-11 13:59:12 -03:00
Gabriel Almeida
2e16618e47 refactor(chat_manager.py): use dict.pop() method to remove client_id from active_connections dictionary 2023-05-11 11:15:51 -03:00
Gabriel Almeida
b16084d927 fix(chat_manager.py): limit the length of the exception message to 120 characters 2023-05-11 10:18:07 -03:00
Gabriel Almeida
fd5f5784b8 refactor(api): remove unused imports in chat_manager.py and endpoints.py 2023-05-10 22:50:43 -03:00
Gabriel Almeida
e50e9b187c style(chat.py): format imports using PEP8 style guide 2023-05-10 22:49:01 -03:00
Gabriel Almeida
4046a7b1e5 refactor(agents/custom.py): create CustomAgentExecutor abstract class and make all agents inherit from it
fix(agents/custom.py): fix import error for NotEnoughElementsException
refactor(run.py): remove unused import statement for loading module
2023-05-10 22:48:49 -03:00
Gabriel Almeida
2ffc8b266f feat(nodes.py): add optional memory field to MidJourneyPromptChainNode class constructor 2023-05-10 22:31:16 -03:00
Gabriel Almeida
7fde19b36a fix(chat_manager.py): handle case where client is not in active_connections dictionary and remove duplicate code in finally block 2023-05-10 12:17:52 -03:00
Gabriel Almeida
6b6ac17167 fix(chat_manager.py): close websocket connection with status code 1011 and error message on exception 2023-05-10 12:09:14 -03:00
Gabriel Almeida
55d18426fc fix(chat_manager.py): fix chat history message to add response instead of request message 2023-05-10 11:57:29 -03:00
Gabriel Almeida
f83160cf21 refactor(langflow): organize imports in multiple files
This commit organizes imports in multiple files to follow PEP8 guidelines
and improve code readability. No functionality changes were made.
2023-05-10 11:42:36 -03:00
Gabriel Almeida
7c1c513106 refactor(loading.py): refactor instantiate_class function to improve readability and maintainability 2023-05-10 11:41:34 -03:00
Gabriel Almeida
31062f2a8c refactor(run.py): remove unused process_graph function
refactor(test_graph.py): update get_result_and_steps to get_result_and_thought function name
2023-05-10 11:31:06 -03:00
Gabriel Almeida
222bb119d3 refactor(chat_manager.py): remove unused code and method call in ChatManager constructor
refactor(chat_manager.py): remove unused method call in ChatManager.handle_message()
2023-05-10 11:30:46 -03:00
Gabriel Almeida
fc007e4349 Merge remote-tracking branch 'origin/dev' into streaming 2023-05-10 11:19:04 -03:00
Lucas Oliveira
b8c95fb7ec Get data from Validate Nodes and display it on Tooltip 2023-05-09 16:56:05 -03:00
Gabriel Almeida
79fb021307 refactor(chat_manager.py): remove unused code block in ChatManager class 2023-05-09 16:52:04 -03:00
Gabriel Almeida
0bc96208e4 refactor(api): change predict endpoint to use async/await and add response model
feat(api): add predict request and response schemas
refactor(interface): rename get_result_and_steps to get_result_and_thought and remove async prefix
fix(interface): use get_result_and_thought instead of async_get_result_and_steps in process_graph_cached
2023-05-09 13:19:19 -03:00
Gabriel Almeida
f6bc152dab fix(chat_manager.py): add missing import statement
feat(chat_manager.py): add chat message to chat history when received and sent
2023-05-09 12:37:15 -03:00
Gabriel Almeida
8810a0392a refactor(langflow): rename BaseLLM to BaseLanguageModel in multiple files
fix(langflow): fix type hints in multiple files
2023-05-08 15:05:28 -03:00
Gabriel Almeida
7b8aaef359 feat(config.yaml): add GoogleSerperRun tool to the list of available tools 2023-05-07 20:15:29 +00:00
Gabriel Almeida
7ae42bf7d2 refactor(importing/utils.py): move tool_creator import to import_tool function
refactor(tools/base.py): remove redundant variable assignment
refactor(tools/constants.py): import all tools dynamically using __all__ attribute of langchain.tools module
2023-05-07 20:15:29 +00:00
Gabriel Almeida
bbf4f5ce1a chore(agents): add type ignore comments to ZeroShotAgent instantiation
The `ZeroShotAgent` instantiation in `JsonAgent`, `CSVAgent`, `VectorStoreAgent`, `SQLAgent`, and `MalfoyAgent` classes were updated to include a `# type: ignore` comment to suppress type checking errors.
2023-05-07 20:15:29 +00:00
Gabriel Almeida
1d5f156a22 refactor(cache): add cache attribute to memoized function wrapper
refactor(test_cache.py): update import statements and function names
test(cache): add tests for load_or_build_langchain_object, build_langchain_object_with_caching, build_graph, and cache size limit
2023-05-07 20:15:29 +00:00
Gabriel Almeida
fa9825849a fix(validate.py): change logger.exception to logger.error to avoid logging traceback 2023-05-07 20:15:29 +00:00
Gabriel Almeida
17863c6e93 refactor(loading.py): add try-except block to handle KeyError when removing 'model' from params dictionary 2023-05-06 08:30:25 -03:00
Gabriel Almeida
bb41f5af5d refactor(loading.py): add try-except block to handle KeyError when removing 'model' from params dictionary 2023-05-06 08:29:38 -03:00
Gabriel Almeida
5cf531b520 refactor(callback.py): rename StreamingLLMCallbackHandler to AsyncStreamingLLMCallbackHandler and add new StreamingLLMCallbackHandler
fix(chat_manager.py): assign result to result variable instead of empty string in ChatResponse
refactor(run.py): add AsyncStreamingLLMCallbackHandler and StreamingLLMCallbackHandler imports and use kwargs instead of callbacks in get_result_and_steps function
2023-05-06 08:29:06 -03:00
Gabriel Almeida
9a67a49622 feat(chat.py, chat_manager.py): add try-except block to handle WebSocketException and WebSocketDisconnect
This commit adds a try-except block to handle WebSocketException and WebSocketDisconnect in the `websocket_endpoint` function in `chat.py` and `handle_websocket` function in `chat_manager.py`. If an exception occurs, the function logs the error and closes the websocket connection with the appropriate status code and reason.

Additionally, the `handle_websocket` function in `chat_manager.py` now waits for a final message after sending a message to the client. If the message is a string, it is a chat message, which is then added to the chat history.
2023-05-05 16:38:40 -03:00
Gabriel Almeida
c032e2a0d1 refactor(chat_manager.py): remove unused variable 'result' and set message to empty string 2023-05-05 12:22:51 -03:00
Gabriel Almeida
474e14efaf refactor(langflow): replace langchain_object.run with langchain_object.acall in get_result_and_steps function
feat(langflow): add support for streaming intermediate steps to the client via websockets
2023-05-05 11:55:25 -03:00
Gabriel Almeida
64bf97ff84 chore(base.py): add type ignore comment to clear_cache function
fix(base.py): raise ValueError if content is None in save_binary_file function
feat(nodes.py): add memory field to TimeTravelGuideChainNode
test(test_chains_template.py): add test for memory field in TimeTravelGuideChainNode
2023-05-04 18:24:12 -03:00
Gabriel Almeida
e0761cfe23 refactor(agents): change tool_names variable from list to set
The `tool_names` variable was changed from a list to a set in the `JsonAgent`, `CSVAgent`, `VectorStoreAgent`, `SQLAgent`, and `MalfoyAgent` classes. This change was made to improve performance and avoid duplicates.
2023-05-02 23:23:36 +00:00
Gabriel Almeida
1b10041730 refactor(base.py): simplify type of Union fields to the first type in the Union
fix(test_agents_template.py): set value of list field to an empty list
fix(test_llms_template.py): change type of 'request_timeout' field to float
2023-05-02 23:23:36 +00:00
Gabriel Almeida
9d3098f3e2 refactor(langflow): reorder imports in multiple files
This commit reorders imports in multiple files to follow PEP8 guidelines
and improve code readability. No functional changes were made.
2023-05-02 23:23:36 +00:00
Gabriel Almeida
7a50129149 refactor(loading.py): process params before instantiating class object 2023-05-02 16:39:33 -03:00
Gabriel Almeida
7dddd641cf refactor(agents): change tool_names from set to list
This commit changes the `tool_names` variable from a set to a list in the `JsonAgent`, `CSVAgent`, `VectorStoreAgent`, `SQLAgent`, `VectorStoreRouterAgent`, `MalfoyAgent`, and `load_agent_executor_from_config` classes. This is done to ensure that the `tool_names` variable is always a list, even when there is only one tool.
2023-05-02 15:11:32 -03:00
Gabriel Almeida
d79f655d88 refactor(loading.py): use get method to set allowed_tools to an empty list if it is not present in params dictionary 2023-05-02 15:04:28 -03:00
Gabriel Almeida
8e1cb1d732 refactor(util.py): add support for Sequence and Set types in format_dict function 2023-05-02 13:12:03 -03:00
Gabriel Almeida
c623b02bf2 refactor(loading.py): make allowed_tools a list if it's not already a list or set 2023-05-02 11:29:38 -03:00
Gabriel Almeida
4eea69c563 refactor(agents, loading): change tool_names from list to set
This commit changes the `tool_names` variable from a list to a set in several
places in the codebase. This is done to improve performance and readability
since the `tool_names` variable is used as a set in the code. The affected
files are `custom.py`, `prebuilt.py`, and `loading.py`.
2023-05-02 10:56:01 -03:00
Gabriel Almeida
96ef8fd657 refactor(loading.py): remove unused imports and add validation for class_object parameters that are not in __fields__ attribute. 2023-05-01 22:52:17 -03:00
Gabriel Almeida
a44f6123a3 refactor(base.py): change default value of advanced field from True to False in TemplateFieldCreator class 2023-05-01 19:39:02 -03:00
Gabriel Almeida
5ebf71116d feat(nodes.py): make "llm" field required and show it in the frontend 2023-05-01 19:16:36 -03:00
Gabriel Almeida
5d424474f2 fix(util.py): handle ValueError when parsing tool name and description from ast.literal_eval() 2023-05-01 18:55:35 -03:00
Gabriel Almeida
811c3f75cf fix(utils.py): import statement for AsyncCallbackManager was incorrect, changed from langchain.callbacks.base to langchain.callbacks.manager 2023-05-01 18:55:27 -03:00
Gabriel Almeida
cc3841c9bf refactor(agents): import BaseLanguageModel from base_language module instead of schema module 2023-05-01 18:40:24 -03:00
Gabriel Almeida
f0ba11c840 other template fixes 2023-04-29 19:35:10 -03:00
Gabriel Almeida
17c58fd70d fixed api key fields 2023-04-29 19:27:38 -03:00