Commit graph

1,656 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
998d1bf5ed 🚀 chore(Makefile): add install_backend command to backend target
The Makefile has been updated to include the `install_backend` command as a dependency of the `backend` target. This ensures that the backend dependencies are installed before running the backend server.
2023-06-06 12:55:12 -03:00
Gabriel Luiz Freitas Almeida
0eb60c0bf0
API Refactor and structure changes (#449) 2023-06-06 12:52:41 -03:00
Gabriel Luiz Freitas Almeida
94b346196b
Initial support for Azure LLM nodes. (#443) 2023-06-06 10:14:31 -03:00
Gabriel Luiz Freitas Almeida
1e854fc469 update endpoint 2023-06-06 10:06:51 -03:00
Gabriel Luiz Freitas Almeida
6b5539232f 🚀 chore(server, tests): update API endpoint URLs to include version number
The API endpoint URLs have been updated to include the version number to improve the API's versioning and maintainability. The changes were made to the server.ts file and the tests that use the API endpoints.

🐛 fix(tests): update API endpoint paths in test files
The API endpoint paths in the test files were outdated and have been updated to reflect the current API version. This ensures that the tests are running against the correct endpoints and that the tests are up-to-date with the current API version.
2023-06-06 10:06:40 -03:00
Gabriel Luiz Freitas Almeida
478bb446c3 🐛 fix(frontend): add missing api/v1 prefix to API routes
🐛 fix(frontend): add missing api/v1 prefix to WebSocket URL
🐛 fix(frontend): add missing api/v1 prefix to Vite proxy target
The API routes, WebSocket URL, and Vite proxy target were missing the "api/v1" prefix, causing the frontend to not be able to communicate with the backend. This commit adds the missing prefix to all three locations to fix the issue.
2023-06-06 10:06:14 -03:00
Gabriel Luiz Freitas Almeida
228f938cd8 🔨 refactor(types.py): move extract_input_variables_from_prompt import to interface.utils module
🔨 refactor(custom.py, loading.py, prompts/custom.py, run.py): update import statements to use extract_input_variables_from_prompt from interface.utils module
🔨 refactor(run.py): remove unused imports and functions
🔨 refactor(utils.py): add type hinting to extract_input_variables_from_prompt function and remove unused imports
The extract_input_variables_from_prompt function has been moved to the interface.utils module to improve code organization. The import statements in the affected modules have been updated to reflect this change. Unused imports and functions have been removed from the run.py module. Type hinting has been added to the extract_input_variables_from_prompt function in the interface.utils module.

🚀 feat(processing): add processing module with get_result_and_steps and fix_memory_inputs functions
The processing module was added to the project with two functions: get_result_and_steps and fix_memory_inputs. The get_result_and_steps function extracts the result and thought from a LangChain object and returns them. The fix_memory_inputs function checks if a LangChain object has a memory attribute and if that memory key exists in the object's input variables. If not, it gets a possible new memory key using the get_memory_key function and updates the memory keys using the update_memory_keys function.
2023-06-06 10:05:46 -03:00
Gabriel Luiz Freitas Almeida
3bfee4d445 🚀 feat(graph): add from_payload class method to Graph class
🚀 feat(utils.py): import extract_input_variables_from_prompt from langflow.interface.utils
The `from_payload` class method is added to the `Graph` class to create a graph from a payload. This method takes a dictionary as input and returns a `Graph` object. The `extract_input_variables_from_prompt` function is imported from `langflow.interface.utils` to extract input variables from a prompt. This function is used in other parts of the codebase to extract input variables from prompts.
2023-06-06 10:05:01 -03:00
Gabriel Luiz Freitas Almeida
7f4eea1e59 🚀 feat(chat): add ChatManager and ChatHistory classes to manage chat history and active connections
 feat(utils.py): add process_graph function to process graph data and generate result and thought
The ChatManager class manages active connections and chat history. The ChatHistory class manages the chat history for a client. The process_graph function processes graph data and generates a result and thought. This function is used in the ChatManager class to generate a response back to the frontend.
2023-06-06 10:02:21 -03:00
Gabriel Luiz Freitas Almeida
2bfe93e0b8 🚀 feat(langflow): add new API endpoints for chat, validation, and version
This commit adds new API endpoints for chat, validation, and version. The chat endpoint is a websocket endpoint for chat. The validation endpoint has three sub-endpoints for validating code, prompt, and node. The version endpoint returns the version of LangFlow.
2023-06-06 10:01:44 -03:00
Gabriel Luiz Freitas Almeida
3e5878ddc2 🎉 feat(langflow): add new files base.py and callback.py
The base.py file contains the following classes and functions:
- CacheResponse: a pydantic BaseModel that represents a response containing a dictionary of data
- Code: a pydantic BaseModel that represents a code string
- Prompt: a pydantic BaseModel that represents a prompt template string
- CodeValidationResponse: a pydantic BaseModel that represents a response containing the validation results of code
- PromptValidationResponse: a pydantic BaseModel that represents a response containing the validation results of a prompt
- validate_prompt: a function that validates a prompt template string and returns a PromptValidationResponse object
- check_input_variables: a function that checks if input variables contain invalid characters and returns a list of fixed input variables

The callback.py file contains the following classes:
- AsyncStreamingLLMCallbackHandler: an AsyncCallbackHandler that handles streaming LLM responses asynchronously
- StreamingLLMCallbackHandler: a BaseCallbackHandler that handles streaming LLM responses

These files were added to provide support for Langflow's backend API.
2023-06-06 10:01:18 -03:00
Gabriel Luiz Freitas Almeida
bdbb4a8127 🚀 feat(api): add versioning to the API and restructure the router
The API now has versioning, with the prefix "/api/v1". The router has been restructured to include the chat, endpoints, and validate routers. This improves the organization of the code and makes it easier to add new routers in the future.
2023-06-06 10:00:38 -03:00
Gabriel Luiz Freitas Almeida
ac42e8a66c chore: remove refactored files 2023-06-06 10:00:15 -03:00
Gabriel Luiz Freitas Almeida
3342e03a2c 🔀 refactor(langflow): move routers to a single file and add health check endpoint
The routers for the langflow API have been moved to a single file for better organization and maintainability. The routers have been imported and included in the main.py file using the new file. A new health check endpoint has been added to the API to check the status of the application.
2023-06-06 09:59:37 -03:00
Gabriel Luiz Freitas Almeida
79c677fb09 🚀 feat(pyproject.toml): add pytest configuration options
Added pytest configuration options to the pyproject.toml file. The minimum version of pytest is set to 6.0, the '-ra' option is added to addopts to show all test results, testpaths are set to include both 'tests' and 'integration' directories, console output style is set to 'progress', and DeprecationWarning is ignored. log_cli is set to true to enable logging of pytest output to the console.
2023-06-06 09:58:30 -03:00
anovazzi1
4f7871ff8b
Surface an error message when a flow has an unknown node type. (#428)
This improves the user experience for issues like #283.
2023-06-05 22:51:42 -03:00
anovazzi1
8ddcbcd125
Add shadTooltip for Edge Class Grouping (#434)
Description:
This pull request introduces a new feature that installs the shadTooltip
library into the project. Additionally, it enhances the tooltip
functionality by grouping the tooltips based on their associated edge
classes.

Changes Made:
Added the shadTooltip library to the project dependencies.
Implemented logic to group tooltips based on their respective edge
classes.
Updated the tooltip rendering code to display grouped tooltips on the
edges.
2023-06-05 20:40:56 -03:00
Gabriel Luiz Freitas Almeida
d39514a137
Toolkits now work as tools (#410) 2023-06-05 20:28:06 -03:00
anovazzi1
33399dfba3
Dark mode after refreshing page (#430)
### Description
This pull request introduces an enhancement to the existing application
by adding persistence to the dark mode feature. Currently, when the page
is refreshed, the dark mode setting reverts to the default light mode.
With this enhancement, the dark mode state will be maintained even after
refreshing the page.

### Changes Made
1. Added a new setting in the application to store the user's preference
for dark mode.
2. Implemented functionality to persist the dark mode preference in
local storage.
3. Modified the page initialization logic to retrieve the dark mode
preference from local storage and apply it on page load.
2023-06-05 18:02:56 -03:00
Gabriel Luiz Freitas Almeida
5a103f0f6f 🔨 refactor(base.py): extract methods to handle model-specific and API key-specific field values
This commit refactors the FrontendNode class by extracting two methods to handle specific field values related to models and API keys. The _handle_model_specific_field_values method handles the options and is_list properties for fields related to models, while the _handle_api_key_specific_field_values method handles the display_name and required properties for fields related to API keys. This improves the readability and maintainability of the code.
2023-06-05 13:48:17 -03:00
Jacob Lee
5b28bbb795 Initial support for Azure LLM nodes.
There are still some rough edges due to underlying langchain and
openai API limitations, e.g. hwchase17/langchain#3769 and
openai/openai-python#411. Notably, you can't use the Azure and
non-Azure node types in the same server, since there's global openai
configuration needed to choose between the two. So it's probably best
to still leave the Azure node types commented out in the default
config. But with this PR, if you uncomment those nodes and start the
server with OPENAI_API_TYPE=azure, you will have working Azure nodes.
2023-06-05 09:55:16 -05:00
Gabriel Luiz Freitas Almeida
eeee895f6a 🔒 chore(pyproject.toml): update fastapi dependency to version 0.96.0
FastAPI dependency has been updated to version 0.96.0 to ensure that the application is using the latest version of the framework.
2023-06-04 21:42:14 -03:00
Cristhian Zanforlin Lousa
1bd3303c52 Change the delay to open to instant 2023-06-02 17:49:53 -03:00
Gabriel Luiz Freitas Almeida
b754c8b490 Merge branch 'jimwhite-anthropic' into dev 2023-06-02 17:43:19 -03:00
Cristhian Zanforlin Lousa
c8665ef422 Fixing css formatting codacy 2023-06-02 17:35:30 -03:00
Cristhian Zanforlin Lousa
f0ca7eeac8 formatting with codacy 2023-06-02 17:29:22 -03:00
Cristhian Zanforlin Lousa
bd7cb06e91 merge fix 2023-06-02 17:17:51 -03:00
Cristhian Zanforlin Lousa
02cb94709d Adding shad tooltip and grouping by class on edges 2023-06-02 17:15:59 -03:00
Jim White
cce41189e9 Trim too long comments about Anthropic models. 2023-06-02 12:18:38 -07:00
Jim White
07afc08129 Add model names for Anthropic and add ChatAnthropic (preferred over the deprecated Anthropic LLM). 2023-06-02 12:08:57 -07:00
Gabriel Luiz Freitas Almeida
df3cdb90b7 🔨 refactor(types.py): reorder class definitions to match the order of their usage in the code
The order of the class definitions in the file has been changed to match the order of their usage in the code. This improves the readability of the code and makes it easier to understand the relationships between the classes. No functionality has been changed.
2023-06-02 14:21:38 -03:00
anovazzi1
430043098d fix dropdown value with wrong color 2023-06-02 14:15:06 -03:00
Gabriel Luiz Freitas Almeida
534f47f153 🔨 refactor(types.py): import flatten_list function from graph.utils module
This commit simply imports the flatten_list function from the graph.utils module to be used in the AgentVertex class. This improves the readability of the code and reduces the number of lines of code.
2023-06-02 14:14:47 -03:00
Gabriel Luiz Freitas Almeida
9517ffe3b3 Merge remote-tracking branch 'origin/dev' into fix_toolkits 2023-06-02 12:56:02 -03:00
Gabriel Luiz Freitas Almeida
e21447aad8
refactor: change Node to Vertex (#426) 2023-06-02 12:16:55 -03:00
Gabriel Luiz Freitas Almeida
b7286afd32 🎨 style(types.py): improve readability of return statement in TextSplitterVertex
The return statement in TextSplitterVertex was improved to be more readable by adding a new line before the Documents field. This makes it easier to read and understand the output of the function.
2023-06-02 12:14:03 -03:00
Gabriel Luiz Freitas Almeida
b75892855f
🚀 feat(langflow): add PythonFunctionTool to the custom tools (#417) 2023-06-02 12:11:24 -03:00
Gabriel Luiz Freitas Almeida
73e07be0c7
Merge branch 'dev' into python_function_tool 2023-06-02 12:11:02 -03:00
anovazzi1
7d49319696 saving darkMode on localStorage 2023-06-02 11:23:55 -03:00
Jim White
4f152bc7ef Fix view for regular Anthropic logo 2023-06-01 23:28:44 -07:00
Jim White
8a049187df Add Anthropic to LLMs including an icon. 2023-06-01 22:55:02 -07:00
anovazzi1
730fe45518
Bringing the menu options opened on search (#427)
This pull request introduces a new feature that enhances the search
functionality by displaying menu options when performing a search.
Currently, the search results only present a list of relevant items, but
with this feature, users will have quick access to additional actions
and functionalities directly from the search results.
2023-06-01 21:03:25 -03:00
Jacob Lee
76bbf62475 Surface an error message when a flow has an unknown node type.
This improves the user experience for issues like #283.
2023-06-01 18:04:56 -05:00
Cristhian Zanforlin Lousa
da5b15fa68 Bringing the menu options opened on search 2023-06-01 17:47:27 -03:00
Gabriel Luiz Freitas Almeida
0cef4bd818 refactor: change Node to Vertex 2023-06-01 15:37:11 -03:00
Gabriel Luiz Freitas Almeida
5b5eea9895 🚀 feat(langflow): reorganize graph package to improve modularity and maintainability
The changes include:
- Moved the `Edge` class to a new `edge` package
- Moved the `Graph` class to a new `graph` package
- Moved the `Node` class to a new `node` package
- Moved the `VectorStoreNode` class to the `node/types.py` module
- Moved the `Edge`, `Graph`, and `Node` classes to their respective `base.py` modules
- Added an `__init__.py` file to each package to allow for importing of classes
- Added a `constants.py` module to the `graph` package to store constants used in the `Graph` class
- Refactored the `Graph` class to use the new `Node` and `Edge` classes
- Refactored the `Graph` class to use a dictionary to map node types to their respective classes
- Refactored the `Graph` class to remove invalid nodes from the graph
- Refactored the `Graph` class to handle the LLM node within the graph
- Refactored the `Graph` class to build the nodes before building the edges
- Refactored the `Graph` class to use the `get_node` method to find nodes by id
- Refactored the `Graph` class to use the `get_node_neighbors` method to find the neighbors of a node
- Refactored the `Graph` class to use the `get_children_by_node_type` method to find the children of a node based on the node type

These changes improve the modularity and maintainability of the `langflow` package by separating the classes into their respective packages and modules. The changes also make it easier to add new node types to the `Graph` class by using a dictionary to map node types to their respective classes.

🚀 feat(node): add Node class to represent a node in the graph
🚀 feat(constants.py): add DIRECT_TYPES constant to represent direct types in a node's template
The Node class represents a node in the graph and is responsible for parsing the data and building the module. The DIRECT_TYPES constant is a list of direct types in a node's template.

🚧 chore(types.py): add import statements for typing and Node classes
This commit adds import statements for the typing module and the Node class to the types.py file. This is necessary for the code to run properly as it uses these classes and modules.

🚧 chore(loading.py): remove unnecessary import statement
This commit removes an unnecessary import statement from the loading.py file. The import statement was causing a circular import error and was not needed for the code to run properly.

🚧 chore(run.py): update import statement for Graph class
This commit updates the import statement for the Graph class in the run.py file. The import statement was outdated and was causing an import error.

🚧 chore(conftest.py): update import statement for Graph class
This commit updates the import statement for the Graph class in the conftest.py file. The import statement was outdated and was causing an import error.

🚧 chore(test_graph.py): update import statements for Node and Edge classes
This commit updates the import statements for the Node and Edge classes in the test_graph.py file. The import statements were outdated and were causing import errors.
2023-06-01 15:07:56 -03:00
Deepankar Mahapatro
4ba881d0e1
build: update lcserve version to support public (#424) 2023-06-01 11:09:55 +05:30
Deepankar Mahapatro
2285304e09 build: update lcserve version to support public 2023-06-01 10:56:39 +05:30
Deepankar Mahapatro
0a0dc673c1
build: push lcserve image as public (#423) 2023-06-01 10:10:46 +05:30
Deepankar Mahapatro
a9e1fb4eb7 build: push lcserve image as public 2023-06-01 10:00:56 +05:30