From 18b4e330629cd072e8ff133f3e590942262ac4df Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 12 Dec 2023 16:46:41 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(flows.py):=20remove=20unused?= =?UTF-8?q?=20import=20statement=20to=20improve=20code=20cleanliness=20and?= =?UTF-8?q?=20maintainability=20=F0=9F=90=9B=20fix(flows.py):=20change=20F?= =?UTF-8?q?low.from=5Form()=20to=20Flow.model=5Fvalidate()=20to=20ensure?= =?UTF-8?q?=20data=20integrity=20and=20validation=20=F0=9F=90=9B=20fix(use?= =?UTF-8?q?rs.py):=20remove=20unused=20import=20statements=20to=20improve?= =?UTF-8?q?=20code=20cleanliness=20and=20maintainability=20=F0=9F=90=9B=20?= =?UTF-8?q?fix(users.py):=20change=20User.from=5Form()=20to=20User.model?= =?UTF-8?q?=5Fvalidate()=20to=20ensure=20data=20integrity=20and=20validati?= =?UTF-8?q?on=20=F0=9F=90=9B=20fix(LLMChain.py):=20remove=20unused=20impor?= =?UTF-8?q?t=20statements=20to=20improve=20code=20cleanliness=20and=20main?= =?UTF-8?q?tainability=20=F0=9F=90=9B=20fix(LLMChain.py):=20remove=20unnec?= =?UTF-8?q?essary=20line=20breaks=20to=20improve=20code=20readability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(base.py):=20remove=20unused=20import=20state?= =?UTF-8?q?ments=20to=20improve=20code=20cleanliness=20and=20maintainabili?= =?UTF-8?q?ty=20=F0=9F=90=9B=20fix(base.py):=20remove=20unnecessary=20line?= =?UTF-8?q?=20breaks=20to=20improve=20code=20readability=20=F0=9F=90=9B=20?= =?UTF-8?q?fix(base.py):=20fix=20condition=20to=20append=20vertex=5Fid=20t?= =?UTF-8?q?o=20top=5Flevel=5Fvertices=20to=20avoid=20appending=20non-strin?= =?UTF-8?q?g=20values=20=F0=9F=90=9B=20fix(vertex/base.py):=20add=20parent?= =?UTF-8?q?=5Fnode=5Fid=20attribute=20to=20Vertex=20class=20to=20support?= =?UTF-8?q?=20hierarchical=20graph=20structures=20=F0=9F=90=9B=20fix(base.?= =?UTF-8?q?py):=20remove=20unused=20import=20statements=20to=20improve=20c?= =?UTF-8?q?ode=20cleanliness=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🚀 feat(GroupTest): add a new node for a simple chat with a custom prompt template and conversational memory buffer ℹ️ This commit adds a new node to the GroupTest project. The node is a genericNode with the following properties: - Width: 384 - Height: 621 - ID: ChatOpenAI-rUJ1b - Type: genericNode - Position: x: 170.87326389541306, y: 465.8628482073749 - Data: - Type: ChatOpenAI - Node: - Template: - Callbacks: - Required: false - Placeholder: "" - Show: false - Multiline: false - Password: false - Name: callbacks - Advanced: false - Dynamic: false - Info: "" - Type: langchain.callbacks.base.BaseCallbackHandler - List: true - Cache: - Required: false - Placeholder: "" - Show: false - Multiline: false - Password: false - Name: cache - Advanced: false - Dynamic: false - Info: "" - Type: bool - List: false - Client: - Required: false - Placeholder: "" - Show: false - Multiline: false - Password: false - Name: client - Advanced: false - Dynamic: false - Info: "" - Type: Any - List: false - Max Retries: - Required: false - Placeholder: "" - Show: false - Multiline: false - Value: 6 - Password: false - Name: max_retries - Advanced: false - Dynamic: false - Info: "" - Type: int - List: false - Max Tokens: - Required: false - Placeholder: "" - Show: true - Multiline: false - Password: true - Name: max_tokens - Advanced: false - Dynamic: false - Info: "" - Type: int - List: false 🔧 chore: fix formatting issue in code 📝 docs: update documentation link for `OpenAI` Chat large language models API 🔧 chore: update prompt template configuration in LLMChain node 📝 docs: add documentation link for PromptTemplate in the description 📝 chore(grouped_chat.json): add grouped_chat.json test data file This commit adds the `grouped_chat.json` file to the `tests/data` directory. The file contains a JSON object representing grouped chat data. This file is necessary for testing and will be used in the test suite. 📝 chore(one_group_chat.json): add one_group_chat.json test data file This commit adds the one_group_chat.json file, which contains a simple chat with a custom prompt template and conversational memory buffer. This file is used for testing purposes. 🔧 chore: update node configuration for ConversationBufferMemory, ChatOpenAI, and LLMChain 📝 docs: update documentation links for ConversationBufferMemory and LLMChain 🔧 fix: update prompt template in LLMChain to include conversation history and text input variables 🔧 fix: update ConversationBufferMemory node to include description and documentation link 🎨 style: format and organize code for better readability and maintainability 🆕 feat(Vector Store): add Vector Store agent and Vector Store Info node The Vector Store agent allows querying a Vector Store. It can be used to construct an agent from a Vector Store. The Vector Store Info node provides information about a Vector Store. The Vector Store agent and Vector Store Info node are added to support the functionality of querying a Vector Store. 🔧 chore: update configuration options in the OpenAI API client The configuration options in the OpenAI API client have been updated. This commit includes changes to the following options: - `max_tokens`: Removed the `required` flag and set `show` to `true` - `metadata`: Set `show` to `false` - `model_kwargs`: Set `show` to `true` and `advanced` to `true` - `model_name`: Added options `gpt-3.5-turbo-0613`, `gpt-3.5-turbo`, `gpt-3.5-turbo-16k-0613`, `gpt-3.5-turbo-16k`, `gpt-4-0613`, `gpt-4-32k-0613`, `gpt-4`, `gpt-4-32k` - `n`: Removed the `show` flag - `openai_api_base`: Added `display_name` as "OpenAI API Base" and updated `info` with additional details - `openai_api_key`: Removed the `required` flag and set `show` to `true` - `openai_organization`: Removed the `show` flag - `openai_proxy`: Removed the `show` flag - `request_timeout`: Removed the `show` flag - `streaming`: Removed the `show` flag - `tags`: Removed the `show` flag - `temperature`: Removed the `show` flag - `tiktoken_model_name`: Removed the `show` flag - `verbose`: Removed the `show` flag 🔧 chore: update configuration for ChatOpenAI and Chroma nodes The configuration for the ChatOpenAI and Chroma nodes has been updated. This includes changes to the allowed_special, disallowed_special, chunk_size, client, deployment, embedding_ctx_length, and max_retries properties. These changes were made to improve the functionality and performance of the nodes. 🔧 chore(config): update OpenAIEmbeddings-YwSvx configuration options The OpenAIEmbeddings-YwSvx configuration options have been updated to include new fields and values. This commit updates the configuration file to reflect these changes. 🔧 chore(config): update configuration options for OpenAIEmbeddings and Chroma 🔧 chore(config): update configuration options for OpenAIEmbeddings and Chroma to improve flexibility and customization 🔧 chore: update configuration options for RecursiveCharacterTextSplitter and WebBaseLoader in flow The configuration options for RecursiveCharacterTextSplitter and WebBaseLoader in the flow have been updated. The changes include: - Persist Directory - Chroma: The persist directory option for Chroma has been modified. - Search Kwargs - Chroma: The search kwargs option for Chroma has been modified. - Chunk Overlap - RecursiveCharacterTextSplitter: The chunk overlap option for RecursiveCharacterTextSplitter has been modified. - Chunk Size - RecursiveCharacterTextSplitter: The chunk size option for RecursiveCharacterTextSplitter has been modified. - Separator Type - RecursiveCharacterTextSplitter: The separator type option for RecursiveCharacterTextSplitter has been modified. - Separator - RecursiveCharacterTextSplitter: The separator option for RecursiveCharacterTextSplitter has been modified. - Metadata - WebBaseLoader: The metadata option for WebBaseLoader has been modified. - Web Page - WebBaseLoader: The web page option for WebBaseLoader has been modified. 🔧 chore(OpenAIEmbeddings): update OpenAIEmbeddings configuration options The OpenAIEmbeddings node configuration options have been updated to include the following changes: - `allowed_special` and `disallowed_special` now accept a list of values instead of a single value - `chunk_size` now accepts an integer value - `deployment` now accepts a string value - `embedding_ctx_length` now accepts an integer value - `headers` now supports multiline values - `max_retries` now accepts an integer value - `model` now accepts a string value - `model_kwargs` now accepts code input - `openai_api_base` now accepts a password input - `openai_api_key` now accepts a password input - `openai_api_type` now accepts a password input - `openai_api_version` now accepts a password input - `openai_organization` has been removed from the configuration options 🔧 chore: update OpenAIEmbeddings configuration options in the UI The OpenAIEmbeddings configuration options in the UI have been updated to include the following changes: - Added the `openai_organization` option to specify the OpenAI organization. - Added the `openai_proxy` option to configure the OpenAI proxy. - Added the `request_timeout` option to set the request timeout. - Added the `show_progress_bar` option to control the visibility of the progress bar. - Changed the `tiktoken_model_name` option to be a password field. - Updated the documentation link for OpenAIEmbeddings. This commit updates the configuration options to improve the usability and functionality of the OpenAIEmbeddings module in the UI. 🔧 chore: clean up unused code and remove unnecessary fields in the configuration file 📝 docs: update documentation link for the Chroma vectorstore module 🔧 chore: update configuration options for RecursiveCharacterTextSplitter in flow The configuration options for the RecursiveCharacterTextSplitter node in the flow have been updated. The following changes were made: - `chunk_size` option: The default value has been changed to 1000. - `separator_type` option: The available options have been updated to include "Text", "cpp", "go", "html", "java", "js", "latex", "markdown", "php", "proto", "python", "rst", "ruby", "rust", "scala", "sol", and "swift". - `separators` option: The default value has been changed to ".". These changes were made to improve the usability and flexibility of the RecursiveCharacterTextSplitter node in the flow. 📝 chore(vector_store_grouped.json): add vector_store_grouped.json test data file 🔀 chore(vector_store_grouped.json): add vector_store_grouped.json test data file 🔨 refactor(test_graph.py): reformat import statements and improve code readability 🔨 refactor(test_prompts_template.py): change dynamic attribute to True for input variables, output parser, partial variables, template, and validate template 🔨 refactor(test_template.py): reformat import statements and remove duplicate import of BaseModel 🔨 refactor(test_template.py): update value for options in format_dict test --- src/backend/langflow/api/v1/flows.py | 5 +- src/backend/langflow/api/v1/users.py | 11 +- .../langflow/components/chains/LLMChain.py | 7 +- src/backend/langflow/graph/edge/base.py | 4 +- src/backend/langflow/graph/graph/base.py | 6 +- src/backend/langflow/graph/vertex/base.py | 1 + src/backend/langflow/interface/tools/base.py | 23 +- .../services/database/models/api_key/crud.py | 2 +- .../langflow/services/task/backends/anyio.py | 11 +- src/backend/langflow/utils/util.py | 13 +- tests/conftest.py | 19 + tests/data/grouped_chat.json | 1 + tests/data/one_group_chat.json | 1302 +++++++++++++++++ tests/data/vector_store_grouped.json | 1 + tests/test_graph.py | 17 +- tests/test_prompts_template.py | 10 +- tests/test_template.py | 5 +- 17 files changed, 1382 insertions(+), 56 deletions(-) create mode 100644 tests/data/grouped_chat.json create mode 100644 tests/data/one_group_chat.json create mode 100644 tests/data/vector_store_grouped.json diff --git a/src/backend/langflow/api/v1/flows.py b/src/backend/langflow/api/v1/flows.py index 28c11dfb4..fcf776a93 100644 --- a/src/backend/langflow/api/v1/flows.py +++ b/src/backend/langflow/api/v1/flows.py @@ -5,13 +5,14 @@ from uuid import UUID import orjson from fastapi import APIRouter, Depends, File, HTTPException, UploadFile from fastapi.encoders import jsonable_encoder +from sqlmodel import Session, select + from langflow.api.utils import remove_api_keys, validate_is_component from langflow.api.v1.schemas import FlowListCreate, FlowListRead from langflow.services.auth.utils import get_current_active_user from langflow.services.database.models.flow import Flow, FlowCreate, FlowRead, FlowUpdate from langflow.services.database.models.user.model import User from langflow.services.deps import get_session, get_settings_service -from sqlmodel import Session, select # build router router = APIRouter(prefix="/flows", tags=["Flows"]) @@ -122,7 +123,7 @@ def create_flows( db_flows = [] for flow in flow_list.flows: flow.user_id = current_user.id - db_flow = Flow.from_orm(flow) + db_flow = Flow.model_validate(flow) session.add(db_flow) db_flows.append(db_flow) session.commit() diff --git a/src/backend/langflow/api/v1/users.py b/src/backend/langflow/api/v1/users.py index 9d4c3f32e..594ed5de7 100644 --- a/src/backend/langflow/api/v1/users.py +++ b/src/backend/langflow/api/v1/users.py @@ -1,6 +1,11 @@ from uuid import UUID from fastapi import APIRouter, Depends, HTTPException +from sqlalchemy import func +from sqlalchemy.exc import IntegrityError +from sqlmodel import Session, select +from sqlmodel.sql.expression import SelectOfScalar + from langflow.api.v1.schemas import UsersResponse from langflow.services.auth.utils import ( get_current_active_superuser, @@ -11,10 +16,6 @@ from langflow.services.auth.utils import ( from langflow.services.database.models.user import User, UserCreate, UserRead, UserUpdate from langflow.services.database.models.user.crud import get_user_by_id, update_user from langflow.services.deps import get_session, get_settings_service -from sqlalchemy import func -from sqlalchemy.exc import IntegrityError -from sqlmodel import Session, select -from sqlmodel.sql.expression import SelectOfScalar router = APIRouter(tags=["Users"], prefix="/users") @@ -28,7 +29,7 @@ def add_user( """ Add a new user to the database. """ - new_user = User.from_orm(user) + new_user = User.model_validate(user) try: new_user.password = get_password_hash(user.password) new_user.is_active = settings_service.auth_settings.NEW_USER_IS_ACTIVE diff --git a/src/backend/langflow/components/chains/LLMChain.py b/src/backend/langflow/components/chains/LLMChain.py index ec88e128a..d62f7ce06 100644 --- a/src/backend/langflow/components/chains/LLMChain.py +++ b/src/backend/langflow/components/chains/LLMChain.py @@ -3,12 +3,7 @@ from typing import Callable, Optional, Union from langchain.chains import LLMChain from langflow import CustomComponent -from langflow.field_typing import ( - BaseLanguageModel, - BaseMemory, - BasePromptTemplate, - Chain, -) +from langflow.field_typing import BaseLanguageModel, BaseMemory, BasePromptTemplate, Chain class LLMChainComponent(CustomComponent): diff --git a/src/backend/langflow/graph/edge/base.py b/src/backend/langflow/graph/edge/base.py index fae994571..399638e18 100644 --- a/src/backend/langflow/graph/edge/base.py +++ b/src/backend/langflow/graph/edge/base.py @@ -60,8 +60,8 @@ class Edge: self.source_id = state["source_id"] self.target_id = state["target_id"] self.target_param = state["target_param"] - self.source_handle = state["source_handle"] - self.target_handle = state["target_handle"] + self.source_handle = state.get("source_handle") + self.target_handle = state.get("target_handle") def validate_edge(self, source, target) -> None: # Validate that the outputs of the source node are valid inputs diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index ad8f80835..31537c51e 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -7,8 +7,7 @@ from langflow.graph.edge.base import Edge from langflow.graph.graph.constants import lazy_load_vertex_dict from langflow.graph.graph.utils import process_flow from langflow.graph.vertex.base import Vertex -from langflow.graph.vertex.types import (FileToolVertex, LLMVertex, - ToolkitVertex) +from langflow.graph.vertex.types import FileToolVertex, LLMVertex, ToolkitVertex from langflow.interface.tools.constants import FILE_TOOLS from langflow.utils import payload @@ -28,7 +27,8 @@ class Graph: self.top_level_vertices = [] for vertex in self._vertices: if vertex_id := vertex.get("id"): - self.top_level_vertices.append(vertex_id) + if isinstance(vertex_id, str): + self.top_level_vertices.append(vertex_id) self._graph_data = process_flow(self.raw_graph_data) self._vertices = self._graph_data["nodes"] diff --git a/src/backend/langflow/graph/vertex/base.py b/src/backend/langflow/graph/vertex/base.py index 167acf8bf..477f8434e 100644 --- a/src/backend/langflow/graph/vertex/base.py +++ b/src/backend/langflow/graph/vertex/base.py @@ -35,6 +35,7 @@ class Vertex: self.artifacts: Dict[str, Any] = {} self.task_id: Optional[str] = None self.is_task = is_task + self.parent_node_id: Optional[str] = self._data.get("parent_node_id") self.params = params or {} @property diff --git a/src/backend/langflow/interface/tools/base.py b/src/backend/langflow/interface/tools/base.py index 20a08ee0a..cc8e5cd75 100644 --- a/src/backend/langflow/interface/tools/base.py +++ b/src/backend/langflow/interface/tools/base.py @@ -1,28 +1,18 @@ from typing import Dict, List, Optional -from langchain.agents.load_tools import ( - _EXTRA_LLM_TOOLS, - _EXTRA_OPTIONAL_TOOLS, - _LLM_TOOLS, -) -from langchain.tools.python.tool import PythonInputs +from langchain.agents.load_tools import _EXTRA_LLM_TOOLS, _EXTRA_OPTIONAL_TOOLS, _LLM_TOOLS +from langchain_experimental.tools.python.tool import PythonInputs from langflow.custom import customs from langflow.interface.base import LangChainTypeCreator -from langflow.interface.tools.constants import ( - ALL_TOOLS_NAMES, - CUSTOM_TOOLS, - FILE_TOOLS, - OTHER_TOOLS, -) +from langflow.interface.tools.constants import ALL_TOOLS_NAMES, CUSTOM_TOOLS, FILE_TOOLS, OTHER_TOOLS from langflow.interface.tools.util import get_tool_params from langflow.services.deps import get_settings_service - from langflow.template.field.base import TemplateField from langflow.template.template.base import Template from langflow.utils import util -from langflow.utils.util import build_template_from_class from langflow.utils.logger import logger +from langflow.utils.util import build_template_from_class TOOL_INPUTS = { "str": TemplateField( @@ -167,10 +157,7 @@ class ToolCreator(LangChainTypeCreator): tool_params = {**tool_params, **self.type_to_loader_dict[name]["params"]} template_dict = template.to_dict() - if ( - "args_schema" in template_dict - and template_dict.get("args_schema").get("value") == PythonInputs - ): + if "args_schema" in template_dict and template_dict.get("args_schema").get("value") == PythonInputs: template_dict["args_schema"]["value"] = "" return { "template": util.format_dict(template_dict), diff --git a/src/backend/langflow/services/database/models/api_key/crud.py b/src/backend/langflow/services/database/models/api_key/crud.py index e5c7d9ddd..1a487cb9e 100644 --- a/src/backend/langflow/services/database/models/api_key/crud.py +++ b/src/backend/langflow/services/database/models/api_key/crud.py @@ -29,7 +29,7 @@ def create_api_key(session: Session, api_key_create: ApiKeyCreate, user_id: UUID session.add(api_key) session.commit() session.refresh(api_key) - unmasked = UnmaskedApiKeyRead.from_orm(api_key) + unmasked = UnmaskedApiKeyRead.model_validate(api_key) unmasked.api_key = generated_api_key return unmasked diff --git a/src/backend/langflow/services/task/backends/anyio.py b/src/backend/langflow/services/task/backends/anyio.py index 49c9c0e4f..d80e10f03 100644 --- a/src/backend/langflow/services/task/backends/anyio.py +++ b/src/backend/langflow/services/task/backends/anyio.py @@ -1,8 +1,11 @@ +import traceback from typing import Any, Callable, Optional, Tuple + import anyio -from langflow.services.task.backends.base import TaskBackend from loguru import logger +from langflow.services.task.backends.base import TaskBackend + class AnyIOTaskResult: def __init__(self, scope): @@ -10,6 +13,7 @@ class AnyIOTaskResult: self._status = "PENDING" self._result = None self._exception = None + self._traceback = None @property def status(self) -> str: @@ -17,6 +21,10 @@ class AnyIOTaskResult: return "FAILURE" if self._exception is not None else "SUCCESS" return self._status + @property + def traceback(self) -> Optional[str]: + return self._traceback + @property def result(self) -> Any: return self._result @@ -29,6 +37,7 @@ class AnyIOTaskResult: self._result = await func(*args, **kwargs) except Exception as e: self._exception = e + self._traceback = traceback.format_exc() finally: self._status = "DONE" diff --git a/src/backend/langflow/utils/util.py b/src/backend/langflow/utils/util.py index e65010ff8..a73b798ff 100644 --- a/src/backend/langflow/utils/util.py +++ b/src/backend/langflow/utils/util.py @@ -1,14 +1,14 @@ -import re -import inspect import importlib +import inspect +import re from functools import wraps -from typing import List, Optional, Dict, Any, Union +from typing import Any, Dict, List, Optional, Union from docstring_parser import parse +from langchain.schema import Document from langflow.template.frontend_node.constants import FORCE_SHOW_FIELDS from langflow.utils import constants -from langchain.schema import Document def remove_ansi_escape_codes(text): @@ -171,7 +171,9 @@ def get_base_classes(cls): """Get the base classes of a class. These are used to determine the output of the nodes. """ - if bases := cls.__bases__: + + if hasattr(cls, "__bases__") and cls.__bases__: + bases = cls.__bases__ result = [] for base in bases: if any(type in base.__module__ for type in ["pydantic", "abc"]): @@ -252,6 +254,7 @@ def format_dict(dictionary: Dict[str, Any], class_name: Optional[str] = None) -> _type = remove_optional_wrapper(_type) _type = check_list_type(_type, value) _type = replace_mapping_with_dict(_type) + _type = get_type_from_union_literal(_type) value["type"] = get_formatted_type(key, _type) value["show"] = should_show_field(value, key) diff --git a/tests/conftest.py b/tests/conftest.py index f8db5a67f..af9bbe169 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import json + # we need to import tmpdir import tempfile from contextlib import contextmanager, suppress @@ -150,6 +151,24 @@ def json_flow(): return f.read() +@pytest.fixture +def grouped_chat_json_flow(): + with open(pytest.GROUPED_CHAT_EXAMPLE_PATH, "r") as f: + return f.read() + + +@pytest.fixture +def one_grouped_chat_json_flow(): + with open(pytest.ONE_GROUPED_CHAT_EXAMPLE_PATH, "r") as f: + return f.read() + + +@pytest.fixture +def vector_store_grouped_json_flow(): + with open(pytest.VECTOR_STORE_GROUPED_EXAMPLE_PATH, "r") as f: + return f.read() + + @pytest.fixture def json_flow_with_prompt_and_history(): with open(pytest.BASIC_CHAT_WITH_PROMPT_AND_HISTORY, "r") as f: diff --git a/tests/data/grouped_chat.json b/tests/data/grouped_chat.json new file mode 100644 index 000000000..79a01a119 --- /dev/null +++ b/tests/data/grouped_chat.json @@ -0,0 +1 @@ +{"description":"A simple chat with a custom prompt template and conversational memory buffer","name":"GroupTest","data":{"nodes":[{"width":384,"height":621,"id":"ChatOpenAI-rUJ1b","type":"genericNode","position":{"x":170.87326389541306,"y":465.8628482073749},"data":{"type":"ChatOpenAI","node":{"template":{"callbacks":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"callbacks","advanced":false,"dynamic":false,"info":"","type":"langchain.callbacks.base.BaseCallbackHandler","list":true},"cache":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"cache","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"client":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"client","advanced":false,"dynamic":false,"info":"","type":"Any","list":false},"max_retries":{"required":false,"placeholder":"","show":false,"multiline":false,"value":6,"password":false,"name":"max_retries","advanced":false,"dynamic":false,"info":"","type":"int","list":false},"max_tokens":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"max_tokens","advanced":false,"dynamic":false,"info":"","type":"int","list":false,"value":""},"metadata":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"metadata","advanced":false,"dynamic":false,"info":"","type":"code","list":false},"model_kwargs":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"model_kwargs","advanced":true,"dynamic":false,"info":"","type":"code","list":false},"model_name":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"gpt-3.5-turbo","password":false,"options":["gpt-3.5-turbo-0613","gpt-3.5-turbo","gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k","gpt-4-0613","gpt-4-32k-0613","gpt-4","gpt-4-32k"],"name":"model_name","advanced":false,"dynamic":false,"info":"","type":"str","list":true},"n":{"required":false,"placeholder":"","show":false,"multiline":false,"value":1,"password":false,"name":"n","advanced":false,"dynamic":false,"info":"","type":"int","list":false},"openai_api_base":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"openai_api_base","display_name":"OpenAI API Base","advanced":false,"dynamic":false,"info":"\nThe base URL of the OpenAI API. Defaults to https://api.openai.com/v1.\n\nYou can change this to use other APIs like JinaChat, LocalAI and Prem.\n","type":"str","list":false},"openai_api_key":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":true,"name":"openai_api_key","display_name":"OpenAI API Key","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"openai_organization":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"openai_organization","display_name":"OpenAI Organization","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"openai_proxy":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"openai_proxy","display_name":"OpenAI Proxy","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"request_timeout":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"request_timeout","advanced":false,"dynamic":false,"info":"","type":"float","list":false,"value":60},"streaming":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"streaming","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"tags":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"tags","advanced":false,"dynamic":false,"info":"","type":"str","list":true},"temperature":{"required":false,"placeholder":"","show":true,"multiline":false,"value":0.7,"password":false,"name":"temperature","advanced":false,"dynamic":false,"info":"","type":"float","list":false},"tiktoken_model_name":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"tiktoken_model_name","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"verbose":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"verbose","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"_type":"ChatOpenAI"},"description":"`OpenAI` Chat large language models API.","base_classes":["ChatOpenAI","BaseChatModel","BaseLanguageModel","BaseLLM"],"display_name":"ChatOpenAI","documentation":"https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai"},"id":"ChatOpenAI-rUJ1b","value":null},"selected":false,"dragging":false,"positionAbsolute":{"x":170.87326389541306,"y":465.8628482073749}},{"width":384,"height":445,"id":"PromptTemplate-Wjk4g","type":"genericNode","position":{"x":190.53285757241179,"y":6.073885727980169},"data":{"type":"PromptTemplate","node":{"template":{"output_parser":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"output_parser","advanced":false,"dynamic":true,"info":"","type":"BaseOutputParser","list":false},"input_variables":{"required":true,"placeholder":"","show":false,"multiline":false,"password":false,"name":"input_variables","advanced":false,"dynamic":true,"info":"","type":"str","list":true,"value":["history","text"]},"partial_variables":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"partial_variables","advanced":false,"dynamic":true,"info":"","type":"code","list":false},"template":{"required":true,"placeholder":"","show":true,"multiline":true,"password":false,"name":"template","advanced":false,"dynamic":true,"info":"","type":"prompt","list":false,"value":"The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n\nCurrent conversation:\n\n{history}\nHuman: {text}\nAI:"},"template_format":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"f-string","password":false,"name":"template_format","advanced":false,"dynamic":true,"info":"","type":"str","list":false},"validate_template":{"required":false,"placeholder":"","show":false,"multiline":false,"value":true,"password":false,"name":"validate_template","advanced":false,"dynamic":true,"info":"","type":"bool","list":false},"_type":"PromptTemplate","history":{"required":false,"placeholder":"","show":true,"multiline":true,"value":"","password":false,"name":"history","display_name":"history","advanced":false,"input_types":["Document","BaseOutputParser"],"dynamic":false,"info":"","type":"str","list":false},"text":{"required":false,"placeholder":"","show":true,"multiline":true,"value":"","password":false,"name":"text","display_name":"text","advanced":false,"input_types":["Document","BaseOutputParser"],"dynamic":false,"info":"","type":"str","list":false}},"description":"A prompt template for a language model.","base_classes":["BasePromptTemplate","PromptTemplate","StringPromptTemplate"],"name":"","display_name":"PromptTemplate","documentation":"https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/","custom_fields":{"":["history","text"],"template":["history","text"]},"output_types":[],"field_formatters":{"formatters":{"openai_api_key":{}},"base_formatters":{"kwargs":{},"optional":{},"list":{},"dict":{},"union":{},"multiline":{},"show":{},"password":{},"default":{},"headers":{},"dict_code_file":{},"model_fields":{"MODEL_DICT":{"OpenAI":["text-davinci-003","text-davinci-002","text-curie-001","text-babbage-001","text-ada-001"],"ChatOpenAI":["gpt-3.5-turbo-0613","gpt-3.5-turbo","gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k","gpt-4-0613","gpt-4-32k-0613","gpt-4","gpt-4-32k"],"Anthropic":["claude-v1","claude-v1-100k","claude-instant-v1","claude-instant-v1-100k","claude-v1.3","claude-v1.3-100k","claude-v1.2","claude-v1.0","claude-instant-v1.1","claude-instant-v1.1-100k","claude-instant-v1.0"],"ChatAnthropic":["claude-v1","claude-v1-100k","claude-instant-v1","claude-instant-v1-100k","claude-v1.3","claude-v1.3-100k","claude-v1.2","claude-v1.0","claude-instant-v1.1","claude-instant-v1.1-100k","claude-instant-v1.0"]}}}},"beta":false,"error":null},"id":"PromptTemplate-Wjk4g"},"selected":false,"positionAbsolute":{"x":190.53285757241179,"y":6.073885727980169},"dragging":false},{"width":384,"height":307,"data":{"id":"LLMChain-pimAb","type":"LLMChain","node":{"display_name":"group Node","documentation":"","base_classes":["Chain","LLMChain","function"],"description":"double click to edit description","template":{"llm_LLMChain-2P369":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"llm","advanced":false,"dynamic":false,"info":"","type":"BaseLanguageModel","list":false,"proxy":{"id":"LLMChain-2P369","field":"llm"},"display_name":"LLM - LLMChain"},"prompt_LLMChain-2P369":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"prompt","advanced":false,"dynamic":false,"info":"","type":"BasePromptTemplate","list":false,"proxy":{"id":"LLMChain-2P369","field":"prompt"},"display_name":"Prompt - LLMChain"},"output_key_LLMChain-2P369":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"text","password":false,"name":"output_key","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"LLMChain-2P369","field":"output_key"},"display_name":"Output Key - LLMChain"},"chat_memory_ConversationBufferMemory-kUMif":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chat_memory","advanced":false,"dynamic":false,"info":"","type":"BaseChatMessageHistory","list":false,"proxy":{"id":"ConversationBufferMemory-kUMif","field":"chat_memory"},"display_name":"Chat Memory - ConversationBuf..."},"input_key_ConversationBufferMemory-kUMif":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":false,"name":"input_key","advanced":true,"dynamic":false,"info":"The variable to be used as Chat Input when more than one variable is available.","type":"str","list":false,"proxy":{"id":"ConversationBufferMemory-kUMif","field":"input_key"},"display_name":"Input Key - ConversationBuf..."},"memory_key_ConversationBufferMemory-kUMif":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"history","password":false,"name":"memory_key","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"ConversationBufferMemory-kUMif","field":"memory_key"},"display_name":"Memory Key - ConversationBuf..."},"output_key_ConversationBufferMemory-kUMif":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":false,"name":"output_key","advanced":true,"dynamic":false,"info":"The variable to be used as Chat Output (e.g. answer in a ConversationalRetrievalChain)","type":"str","list":false,"proxy":{"id":"ConversationBufferMemory-kUMif","field":"output_key"},"display_name":"Output Key - ConversationBuf..."},"return_messages_ConversationBufferMemory-kUMif":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"return_messages","advanced":true,"dynamic":false,"info":"","type":"bool","list":false,"proxy":{"id":"ConversationBufferMemory-kUMif","field":"return_messages"},"display_name":"Return Messages - ConversationBuf..."}},"flow":{"data":{"nodes":[{"width":384,"height":307,"id":"LLMChain-2P369","type":"genericNode","position":{"x":1250.1806448178158,"y":588.4657451068704},"data":{"type":"LLMChain","node":{"template":{"callbacks":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"callbacks","advanced":false,"dynamic":false,"info":"","type":"langchain.callbacks.base.BaseCallbackHandler","list":true},"llm":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"llm","advanced":false,"dynamic":false,"info":"","type":"BaseLanguageModel","list":false},"memory":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"memory","advanced":false,"dynamic":false,"info":"","type":"BaseMemory","list":false},"output_parser":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"output_parser","advanced":false,"dynamic":false,"info":"","type":"BaseLLMOutputParser","list":false},"prompt":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"prompt","advanced":false,"dynamic":false,"info":"","type":"BasePromptTemplate","list":false},"llm_kwargs":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"llm_kwargs","advanced":false,"dynamic":false,"info":"","type":"code","list":false},"metadata":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"metadata","advanced":false,"dynamic":false,"info":"","type":"code","list":false},"output_key":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"text","password":false,"name":"output_key","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"return_final_only":{"required":false,"placeholder":"","show":false,"multiline":false,"value":true,"password":false,"name":"return_final_only","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"tags":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"tags","advanced":false,"dynamic":false,"info":"","type":"str","list":true},"verbose":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"verbose","advanced":true,"dynamic":false,"info":"","type":"bool","list":false},"_type":"LLMChain"},"description":"Chain to run queries against LLMs.","base_classes":["Chain","LLMChain","function"],"display_name":"LLMChain","documentation":"https://python.langchain.com/docs/modules/chains/foundational/llm_chain"},"id":"LLMChain-2P369","value":null},"selected":true,"positionAbsolute":{"x":1250.1806448178158,"y":588.4657451068704},"dragging":false},{"width":384,"height":561,"id":"ConversationBufferMemory-kUMif","type":"genericNode","position":{"x":802.1806448178158,"y":43.265745106870426},"data":{"type":"ConversationBufferMemory","node":{"template":{"chat_memory":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chat_memory","advanced":false,"dynamic":false,"info":"","type":"BaseChatMessageHistory","list":false},"ai_prefix":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"AI","password":false,"name":"ai_prefix","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"human_prefix":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"Human","password":false,"name":"human_prefix","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"input_key":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":false,"name":"input_key","advanced":false,"dynamic":false,"info":"The variable to be used as Chat Input when more than one variable is available.","type":"str","list":false},"memory_key":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"history","password":false,"name":"memory_key","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"output_key":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":false,"name":"output_key","advanced":false,"dynamic":false,"info":"The variable to be used as Chat Output (e.g. answer in a ConversationalRetrievalChain)","type":"str","list":false},"return_messages":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"return_messages","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"_type":"ConversationBufferMemory"},"description":"Buffer for storing conversation memory.","base_classes":["ConversationBufferMemory","BaseMemory","BaseChatMemory"],"display_name":"ConversationBufferMemory","documentation":"https://python.langchain.com/docs/modules/memory/how_to/buffer"},"id":"ConversationBufferMemory-kUMif","value":null},"selected":true,"positionAbsolute":{"x":802.1806448178158,"y":43.265745106870426},"dragging":false}],"edges":[{"source":"ConversationBufferMemory-kUMif","sourceHandle":"{œbaseClassesœ:[œConversationBufferMemoryœ,œBaseMemoryœ,œBaseChatMemoryœ],œdataTypeœ:œConversationBufferMemoryœ,œidœ:œConversationBufferMemory-kUMifœ}","target":"LLMChain-2P369","targetHandle":"{œfieldNameœ:œmemoryœ,œidœ:œLLMChain-2P369œ,œinputTypesœ:null,œtypeœ:œBaseMemoryœ}","className":"stroke-gray-900 stroke-connection","id":"reactflow__edge-ConversationBufferMemory-kUMif{œbaseClassesœ:[œConversationBufferMemoryœ,œBaseMemoryœ,œBaseChatMemoryœ],œdataTypeœ:œConversationBufferMemoryœ,œidœ:œConversationBufferMemory-kUMifœ}-LLMChain-2P369{œfieldNameœ:œmemoryœ,œidœ:œLLMChain-2P369œ,œinputTypesœ:null,œtypeœ:œBaseMemoryœ}","animated":false,"style":{"stroke":"#555"},"data":{"sourceHandle":{"baseClasses":["ConversationBufferMemory","BaseMemory","BaseChatMemory"],"dataType":"ConversationBufferMemory","id":"ConversationBufferMemory-kUMif"},"targetHandle":{"fieldName":"memory","id":"LLMChain-2P369","inputTypes":null,"type":"BaseMemory"}},"selected":true}],"viewport":{"x":169.1802019559105,"y":186.01151115352206,"zoom":0.5224749517346055}},"name":"Pensive Franklin","description":"","id":"3Sb9U"}}},"id":"LLMChain-pimAb","position":{"x":775.4509216701647,"y":315.8657451068704},"type":"genericNode","selected":false,"positionAbsolute":{"x":775.4509216701647,"y":315.8657451068704},"dragging":false}],"edges":[{"source":"PromptTemplate-Wjk4g","sourceHandle":"{œbaseClassesœ:[œBasePromptTemplateœ,œPromptTemplateœ,œStringPromptTemplateœ],œdataTypeœ:œPromptTemplateœ,œidœ:œPromptTemplate-Wjk4gœ}","target":"LLMChain-pimAb","targetHandle":"{œfieldNameœ:œprompt_LLMChain-2P369œ,œidœ:œLLMChain-pimAbœ,œinputTypesœ:null,œproxyœ:{œfieldœ:œpromptœ,œidœ:œLLMChain-2P369œ},œtypeœ:œBasePromptTemplateœ}","data":{"targetHandle":{"fieldName":"prompt_LLMChain-2P369","id":"LLMChain-pimAb","inputTypes":null,"proxy":{"field":"prompt","id":"LLMChain-2P369"},"type":"BasePromptTemplate"},"sourceHandle":{"baseClasses":["BasePromptTemplate","PromptTemplate","StringPromptTemplate"],"dataType":"PromptTemplate","id":"PromptTemplate-Wjk4g"}},"style":{"stroke":"#555"},"className":"stroke-foreground stroke-connection","animated":false,"id":"reactflow__edge-PromptTemplate-Wjk4g{œbaseClassesœ:[œBasePromptTemplateœ,œPromptTemplateœ,œStringPromptTemplateœ],œdataTypeœ:œPromptTemplateœ,œidœ:œPromptTemplate-Wjk4gœ}-LLMChain-pimAb{œfieldNameœ:œprompt_LLMChain-2P369œ,œidœ:œLLMChain-pimAbœ,œinputTypesœ:null,œproxyœ:{œfieldœ:œpromptœ,œidœ:œLLMChain-2P369œ},œtypeœ:œBasePromptTemplateœ}"},{"source":"ChatOpenAI-rUJ1b","sourceHandle":"{œbaseClassesœ:[œChatOpenAIœ,œBaseChatModelœ,œBaseLanguageModelœ,œBaseLLMœ],œdataTypeœ:œChatOpenAIœ,œidœ:œChatOpenAI-rUJ1bœ}","target":"LLMChain-pimAb","targetHandle":"{œfieldNameœ:œllm_LLMChain-2P369œ,œidœ:œLLMChain-pimAbœ,œinputTypesœ:null,œproxyœ:{œfieldœ:œllmœ,œidœ:œLLMChain-2P369œ},œtypeœ:œBaseLanguageModelœ}","data":{"targetHandle":{"fieldName":"llm_LLMChain-2P369","id":"LLMChain-pimAb","inputTypes":null,"proxy":{"field":"llm","id":"LLMChain-2P369"},"type":"BaseLanguageModel"},"sourceHandle":{"baseClasses":["ChatOpenAI","BaseChatModel","BaseLanguageModel","BaseLLM"],"dataType":"ChatOpenAI","id":"ChatOpenAI-rUJ1b"}},"style":{"stroke":"#555"},"className":"stroke-foreground stroke-connection","animated":false,"id":"reactflow__edge-ChatOpenAI-rUJ1b{œbaseClassesœ:[œChatOpenAIœ,œBaseChatModelœ,œBaseLanguageModelœ,œBaseLLMœ],œdataTypeœ:œChatOpenAIœ,œidœ:œChatOpenAI-rUJ1bœ}-LLMChain-pimAb{œfieldNameœ:œllm_LLMChain-2P369œ,œidœ:œLLMChain-pimAbœ,œinputTypesœ:null,œproxyœ:{œfieldœ:œllmœ,œidœ:œLLMChain-2P369œ},œtypeœ:œBaseLanguageModelœ}"}],"viewport":{"x":169.18020195591043,"y":186.01151115352206,"zoom":0.5224749517346055}},"id":"6a498bfb-bdb4-40f8-9ac5-30c6afcb2d53"} \ No newline at end of file diff --git a/tests/data/one_group_chat.json b/tests/data/one_group_chat.json new file mode 100644 index 000000000..31b2df84e --- /dev/null +++ b/tests/data/one_group_chat.json @@ -0,0 +1,1302 @@ +{ + "description": "A simple chat with a custom prompt template and conversational memory buffer", + "name": "One Group", + "data": { + "nodes": [ + { + "width": 384, + "height": 485, + "data": { + "id": "LLMChain-7wD4b", + "type": "LLMChain", + "node": { + "display_name": "group Node", + "documentation": "", + "base_classes": [ + "Chain", + "LLMChain", + "function" + ], + "description": "double click to edit description", + "template": { + "max_tokens_ChatOpenAI-WlIXw": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": true, + "name": "max_tokens", + "advanced": true, + "dynamic": false, + "info": "", + "type": "int", + "list": false, + "proxy": { + "id": "ChatOpenAI-WlIXw", + "field": "max_tokens" + }, + "display_name": "Max Tokens - ChatOpenAI", + "value": "" + }, + "model_kwargs_ChatOpenAI-WlIXw": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "model_kwargs", + "advanced": true, + "dynamic": false, + "info": "", + "type": "code", + "list": false, + "proxy": { + "id": "ChatOpenAI-WlIXw", + "field": "model_kwargs" + }, + "display_name": "Model Kwargs - ChatOpenAI" + }, + "model_name_ChatOpenAI-WlIXw": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "gpt-3.5-turbo", + "password": false, + "options": [ + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k-0613", + "gpt-3.5-turbo-16k", + "gpt-4-0613", + "gpt-4-32k-0613", + "gpt-4", + "gpt-4-32k" + ], + "name": "model_name", + "advanced": true, + "dynamic": false, + "info": "", + "type": "str", + "list": true, + "proxy": { + "id": "ChatOpenAI-WlIXw", + "field": "model_name" + }, + "display_name": "Model Name - ChatOpenAI" + }, + "openai_api_base_ChatOpenAI-WlIXw": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "openai_api_base", + "display_name": "OpenAI API Base - ChatOpenAI", + "advanced": true, + "dynamic": false, + "info": "\nThe base URL of the OpenAI API. Defaults to https://api.openai.com/v1.\n\nYou can change this to use other APIs like JinaChat, LocalAI and Prem.\n", + "type": "str", + "list": false, + "proxy": { + "id": "ChatOpenAI-WlIXw", + "field": "openai_api_base" + } + }, + "openai_api_key_ChatOpenAI-WlIXw": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "test", + "password": true, + "name": "openai_api_key", + "display_name": "OpenAI API Key - ChatOpenAI", + "advanced": true, + "dynamic": false, + "info": "", + "type": "str", + "list": false, + "proxy": { + "id": "ChatOpenAI-WlIXw", + "field": "openai_api_key" + } + }, + "temperature_ChatOpenAI-WlIXw": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": 0.7, + "password": false, + "name": "temperature", + "advanced": true, + "dynamic": false, + "info": "", + "type": "float", + "list": false, + "proxy": { + "id": "ChatOpenAI-WlIXw", + "field": "temperature" + }, + "display_name": "Temperature - ChatOpenAI" + }, + "output_key_LLMChain-qaGdJ": { + "required": true, + "placeholder": "", + "show": true, + "multiline": false, + "value": "text", + "password": false, + "name": "output_key", + "advanced": true, + "dynamic": false, + "info": "", + "type": "str", + "list": false, + "proxy": { + "id": "LLMChain-qaGdJ", + "field": "output_key" + }, + "display_name": "Output Key - LLMChain" + }, + "chat_memory_ConversationBufferMemory-WkJkh": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "chat_memory", + "advanced": false, + "dynamic": false, + "info": "", + "type": "BaseChatMessageHistory", + "list": false, + "proxy": { + "id": "ConversationBufferMemory-WkJkh", + "field": "chat_memory" + }, + "display_name": "Chat Memory - ConversationBuf..." + }, + "input_key_ConversationBufferMemory-WkJkh": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "", + "password": false, + "name": "input_key", + "advanced": true, + "dynamic": false, + "info": "The variable to be used as Chat Input when more than one variable is available.", + "type": "str", + "list": false, + "proxy": { + "id": "ConversationBufferMemory-WkJkh", + "field": "input_key" + }, + "display_name": "Input Key - ConversationBuf..." + }, + "memory_key_ConversationBufferMemory-WkJkh": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "history", + "password": false, + "name": "memory_key", + "advanced": true, + "dynamic": false, + "info": "", + "type": "str", + "list": false, + "proxy": { + "id": "ConversationBufferMemory-WkJkh", + "field": "memory_key" + }, + "display_name": "Memory Key - ConversationBuf..." + }, + "output_key_ConversationBufferMemory-WkJkh": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "", + "password": false, + "name": "output_key", + "advanced": true, + "dynamic": false, + "info": "The variable to be used as Chat Output (e.g. answer in a ConversationalRetrievalChain)", + "type": "str", + "list": false, + "proxy": { + "id": "ConversationBufferMemory-WkJkh", + "field": "output_key" + }, + "display_name": "Output Key - ConversationBuf..." + }, + "return_messages_ConversationBufferMemory-WkJkh": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "return_messages", + "advanced": true, + "dynamic": false, + "info": "", + "type": "bool", + "list": false, + "proxy": { + "id": "ConversationBufferMemory-WkJkh", + "field": "return_messages" + }, + "display_name": "Return Messages - ConversationBuf..." + }, + "template_PromptTemplate-h1IlH": { + "required": true, + "placeholder": "", + "show": true, + "multiline": true, + "password": false, + "name": "template", + "advanced": false, + "dynamic": true, + "info": "", + "type": "prompt", + "list": false, + "value": "The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n\nCurrent conversation:\n\n{history}\nHuman: {text}\nAI:", + "proxy": { + "id": "PromptTemplate-h1IlH", + "field": "template" + }, + "display_name": "Template - PromptTemplate" + }, + "history_PromptTemplate-h1IlH": { + "required": false, + "placeholder": "", + "show": true, + "multiline": true, + "value": "", + "password": false, + "name": "history", + "display_name": "history - PromptTemplate", + "advanced": false, + "input_types": [ + "Document", + "BaseOutputParser" + ], + "dynamic": false, + "info": "", + "type": "str", + "list": false, + "proxy": { + "id": "PromptTemplate-h1IlH", + "field": "history" + } + }, + "text_PromptTemplate-h1IlH": { + "required": false, + "placeholder": "", + "show": true, + "multiline": true, + "value": "", + "password": false, + "name": "text", + "display_name": "text - PromptTemplate", + "advanced": false, + "input_types": [ + "Document", + "BaseOutputParser" + ], + "dynamic": false, + "info": "", + "type": "str", + "list": false, + "proxy": { + "id": "PromptTemplate-h1IlH", + "field": "text" + } + } + }, + "flow": { + "data": { + "nodes": [ + { + "width": 384, + "height": 621, + "id": "ChatOpenAI-WlIXw", + "type": "genericNode", + "position": { + "x": 170.87326389541306, + "y": 465.8628482073749 + }, + "data": { + "type": "ChatOpenAI", + "node": { + "template": { + "callbacks": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "callbacks", + "advanced": false, + "dynamic": false, + "info": "", + "type": "langchain.callbacks.base.BaseCallbackHandler", + "list": true + }, + "cache": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "cache", + "advanced": false, + "dynamic": false, + "info": "", + "type": "bool", + "list": false + }, + "client": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "client", + "advanced": false, + "dynamic": false, + "info": "", + "type": "Any", + "list": false + }, + "max_retries": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": 6, + "password": false, + "name": "max_retries", + "advanced": false, + "dynamic": false, + "info": "", + "type": "int", + "list": false + }, + "max_tokens": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": true, + "name": "max_tokens", + "advanced": false, + "dynamic": false, + "info": "", + "type": "int", + "list": false + }, + "metadata": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "metadata", + "advanced": false, + "dynamic": false, + "info": "", + "type": "code", + "list": false + }, + "model_kwargs": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "model_kwargs", + "advanced": true, + "dynamic": false, + "info": "", + "type": "code", + "list": false + }, + "model_name": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "gpt-3.5-turbo", + "password": false, + "options": [ + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k-0613", + "gpt-3.5-turbo-16k", + "gpt-4-0613", + "gpt-4-32k-0613", + "gpt-4", + "gpt-4-32k" + ], + "name": "model_name", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": true + }, + "n": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": 1, + "password": false, + "name": "n", + "advanced": false, + "dynamic": false, + "info": "", + "type": "int", + "list": false + }, + "openai_api_base": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "openai_api_base", + "display_name": "OpenAI API Base", + "advanced": false, + "dynamic": false, + "info": "\nThe base URL of the OpenAI API. Defaults to https://api.openai.com/v1.\n\nYou can change this to use other APIs like JinaChat, LocalAI and Prem.\n", + "type": "str", + "list": false + }, + "openai_api_key": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "", + "password": true, + "name": "openai_api_key", + "display_name": "OpenAI API Key", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "openai_organization": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "openai_organization", + "display_name": "OpenAI Organization", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "openai_proxy": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "openai_proxy", + "display_name": "OpenAI Proxy", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "request_timeout": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "request_timeout", + "advanced": false, + "dynamic": false, + "info": "", + "type": "float", + "list": false, + "value": 60 + }, + "streaming": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": false, + "password": false, + "name": "streaming", + "advanced": false, + "dynamic": false, + "info": "", + "type": "bool", + "list": false + }, + "tags": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "tags", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": true + }, + "temperature": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": 0.7, + "password": false, + "name": "temperature", + "advanced": false, + "dynamic": false, + "info": "", + "type": "float", + "list": false + }, + "tiktoken_model_name": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "tiktoken_model_name", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "verbose": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": false, + "password": false, + "name": "verbose", + "advanced": false, + "dynamic": false, + "info": "", + "type": "bool", + "list": false + }, + "_type": "ChatOpenAI" + }, + "description": "`OpenAI` Chat large language models API.", + "base_classes": [ + "ChatOpenAI", + "BaseLanguageModel", + "BaseChatModel", + "BaseLLM" + ], + "display_name": "ChatOpenAI", + "documentation": "https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai" + }, + "id": "ChatOpenAI-WlIXw", + "value": null + }, + "selected": true, + "dragging": false, + "positionAbsolute": { + "x": 170.87326389541306, + "y": 465.8628482073749 + } + }, + { + "width": 384, + "height": 307, + "id": "LLMChain-qaGdJ", + "type": "genericNode", + "position": { + "x": 1250.1806448178158, + "y": 588.4657451068704 + }, + "data": { + "type": "LLMChain", + "node": { + "template": { + "callbacks": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "callbacks", + "advanced": false, + "dynamic": false, + "info": "", + "type": "langchain.callbacks.base.BaseCallbackHandler", + "list": true + }, + "llm": { + "required": true, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "llm", + "advanced": false, + "dynamic": false, + "info": "", + "type": "BaseLanguageModel", + "list": false + }, + "memory": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "memory", + "advanced": false, + "dynamic": false, + "info": "", + "type": "BaseMemory", + "list": false + }, + "output_parser": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "output_parser", + "advanced": false, + "dynamic": false, + "info": "", + "type": "BaseLLMOutputParser", + "list": false + }, + "prompt": { + "required": true, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "prompt", + "advanced": false, + "dynamic": false, + "info": "", + "type": "BasePromptTemplate", + "list": false + }, + "llm_kwargs": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "llm_kwargs", + "advanced": false, + "dynamic": false, + "info": "", + "type": "code", + "list": false + }, + "metadata": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "metadata", + "advanced": false, + "dynamic": false, + "info": "", + "type": "code", + "list": false + }, + "output_key": { + "required": true, + "placeholder": "", + "show": true, + "multiline": false, + "value": "text", + "password": false, + "name": "output_key", + "advanced": true, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "return_final_only": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": true, + "password": false, + "name": "return_final_only", + "advanced": false, + "dynamic": false, + "info": "", + "type": "bool", + "list": false + }, + "tags": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "tags", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": true + }, + "verbose": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": false, + "password": false, + "name": "verbose", + "advanced": true, + "dynamic": false, + "info": "", + "type": "bool", + "list": false + }, + "_type": "LLMChain" + }, + "description": "Chain to run queries against LLMs.", + "base_classes": [ + "Chain", + "LLMChain", + "function" + ], + "display_name": "LLMChain", + "documentation": "https://python.langchain.com/docs/modules/chains/foundational/llm_chain" + }, + "id": "LLMChain-qaGdJ", + "value": null + }, + "selected": true, + "positionAbsolute": { + "x": 1250.1806448178158, + "y": 588.4657451068704 + }, + "dragging": false + }, + { + "width": 384, + "height": 561, + "id": "ConversationBufferMemory-WkJkh", + "type": "genericNode", + "position": { + "x": 802.1806448178158, + "y": 43.265745106870426 + }, + "data": { + "type": "ConversationBufferMemory", + "node": { + "template": { + "chat_memory": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "chat_memory", + "advanced": false, + "dynamic": false, + "info": "", + "type": "BaseChatMessageHistory", + "list": false + }, + "ai_prefix": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": "AI", + "password": false, + "name": "ai_prefix", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "human_prefix": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": "Human", + "password": false, + "name": "human_prefix", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "input_key": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "", + "password": false, + "name": "input_key", + "advanced": false, + "dynamic": false, + "info": "The variable to be used as Chat Input when more than one variable is available.", + "type": "str", + "list": false + }, + "memory_key": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "history", + "password": false, + "name": "memory_key", + "advanced": false, + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "output_key": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "value": "", + "password": false, + "name": "output_key", + "advanced": false, + "dynamic": false, + "info": "The variable to be used as Chat Output (e.g. answer in a ConversationalRetrievalChain)", + "type": "str", + "list": false + }, + "return_messages": { + "required": false, + "placeholder": "", + "show": true, + "multiline": false, + "password": false, + "name": "return_messages", + "advanced": false, + "dynamic": false, + "info": "", + "type": "bool", + "list": false + }, + "_type": "ConversationBufferMemory" + }, + "description": "Buffer for storing conversation memory.", + "base_classes": [ + "BaseChatMemory", + "BaseMemory", + "ConversationBufferMemory" + ], + "display_name": "ConversationBufferMemory", + "documentation": "https://python.langchain.com/docs/modules/memory/how_to/buffer" + }, + "id": "ConversationBufferMemory-WkJkh", + "value": null + }, + "selected": true, + "positionAbsolute": { + "x": 802.1806448178158, + "y": 43.265745106870426 + }, + "dragging": false + }, + { + "width": 384, + "height": 445, + "id": "PromptTemplate-h1IlH", + "type": "genericNode", + "position": { + "x": 190.53285757241179, + "y": 6.073885727980169 + }, + "data": { + "type": "PromptTemplate", + "node": { + "template": { + "output_parser": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "output_parser", + "advanced": false, + "dynamic": true, + "info": "", + "type": "BaseOutputParser", + "list": false + }, + "input_variables": { + "required": true, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "input_variables", + "advanced": false, + "dynamic": true, + "info": "", + "type": "str", + "list": true, + "value": [ + "history", + "text" + ] + }, + "partial_variables": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "password": false, + "name": "partial_variables", + "advanced": false, + "dynamic": true, + "info": "", + "type": "code", + "list": false + }, + "template": { + "required": true, + "placeholder": "", + "show": true, + "multiline": true, + "password": false, + "name": "template", + "advanced": false, + "dynamic": true, + "info": "", + "type": "prompt", + "list": false, + "value": "The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n\nCurrent conversation:\n\n{history}\nHuman: {text}\nAI:" + }, + "template_format": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": "f-string", + "password": false, + "name": "template_format", + "advanced": false, + "dynamic": true, + "info": "", + "type": "str", + "list": false + }, + "validate_template": { + "required": false, + "placeholder": "", + "show": false, + "multiline": false, + "value": true, + "password": false, + "name": "validate_template", + "advanced": false, + "dynamic": true, + "info": "", + "type": "bool", + "list": false + }, + "_type": "PromptTemplate", + "history": { + "required": false, + "placeholder": "", + "show": true, + "multiline": true, + "value": "", + "password": false, + "name": "history", + "display_name": "history", + "advanced": false, + "input_types": [ + "Document", + "BaseOutputParser" + ], + "dynamic": false, + "info": "", + "type": "str", + "list": false + }, + "text": { + "required": false, + "placeholder": "", + "show": true, + "multiline": true, + "value": "", + "password": false, + "name": "text", + "display_name": "text", + "advanced": false, + "input_types": [ + "Document", + "BaseOutputParser" + ], + "dynamic": false, + "info": "", + "type": "str", + "list": false + } + }, + "description": "A prompt template for a language model.", + "base_classes": [ + "BasePromptTemplate", + "PromptTemplate", + "StringPromptTemplate" + ], + "name": "", + "display_name": "PromptTemplate", + "documentation": "https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/", + "custom_fields": { + "": [ + "history", + "text" + ], + "template": [ + "history", + "text" + ] + }, + "output_types": [], + "field_formatters": { + "formatters": { + "openai_api_key": {} + }, + "base_formatters": { + "kwargs": {}, + "optional": {}, + "list": {}, + "dict": {}, + "union": {}, + "multiline": {}, + "show": {}, + "password": {}, + "default": {}, + "headers": {}, + "dict_code_file": {}, + "model_fields": { + "MODEL_DICT": { + "OpenAI": [ + "text-davinci-003", + "text-davinci-002", + "text-curie-001", + "text-babbage-001", + "text-ada-001" + ], + "ChatOpenAI": [ + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k-0613", + "gpt-3.5-turbo-16k", + "gpt-4-0613", + "gpt-4-32k-0613", + "gpt-4", + "gpt-4-32k" + ], + "Anthropic": [ + "claude-v1", + "claude-v1-100k", + "claude-instant-v1", + "claude-instant-v1-100k", + "claude-v1.3", + "claude-v1.3-100k", + "claude-v1.2", + "claude-v1.0", + "claude-instant-v1.1", + "claude-instant-v1.1-100k", + "claude-instant-v1.0" + ], + "ChatAnthropic": [ + "claude-v1", + "claude-v1-100k", + "claude-instant-v1", + "claude-instant-v1-100k", + "claude-v1.3", + "claude-v1.3-100k", + "claude-v1.2", + "claude-v1.0", + "claude-instant-v1.1", + "claude-instant-v1.1-100k", + "claude-instant-v1.0" + ] + } + } + } + }, + "beta": false, + "error": null + }, + "id": "PromptTemplate-h1IlH" + }, + "selected": true, + "positionAbsolute": { + "x": 190.53285757241179, + "y": 6.073885727980169 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "ChatOpenAI-WlIXw", + "sourceHandle": "{œbaseClassesœ:[œChatOpenAIœ,œBaseLanguageModelœ,œBaseChatModelœ,œBaseLLMœ],œdataTypeœ:œChatOpenAIœ,œidœ:œChatOpenAI-WlIXwœ}", + "target": "LLMChain-qaGdJ", + "targetHandle": "{œfieldNameœ:œllmœ,œidœ:œLLMChain-qaGdJœ,œinputTypesœ:null,œtypeœ:œBaseLanguageModelœ}", + "className": "stroke-gray-900 stroke-connection", + "id": "reactflow__edge-ChatOpenAI-WlIXw{œbaseClassesœ:[œChatOpenAIœ,œBaseLanguageModelœ,œBaseChatModelœ,œBaseLLMœ],œdataTypeœ:œChatOpenAIœ,œidœ:œChatOpenAI-WlIXwœ}-LLMChain-qaGdJ{œfieldNameœ:œllmœ,œidœ:œLLMChain-qaGdJœ,œinputTypesœ:null,œtypeœ:œBaseLanguageModelœ}", + "selected": true, + "animated": false, + "style": { + "stroke": "#555" + }, + "data": { + "sourceHandle": { + "baseClasses": [ + "ChatOpenAI", + "BaseLanguageModel", + "BaseChatModel", + "BaseLLM" + ], + "dataType": "ChatOpenAI", + "id": "ChatOpenAI-WlIXw" + }, + "targetHandle": { + "fieldName": "llm", + "id": "LLMChain-qaGdJ", + "inputTypes": null, + "type": "BaseLanguageModel" + } + } + }, + { + "source": "ConversationBufferMemory-WkJkh", + "sourceHandle": "{œbaseClassesœ:[œBaseChatMemoryœ,œBaseMemoryœ,œConversationBufferMemoryœ],œdataTypeœ:œConversationBufferMemoryœ,œidœ:œConversationBufferMemory-WkJkhœ}", + "target": "LLMChain-qaGdJ", + "targetHandle": "{œfieldNameœ:œmemoryœ,œidœ:œLLMChain-qaGdJœ,œinputTypesœ:null,œtypeœ:œBaseMemoryœ}", + "className": "stroke-gray-900 stroke-connection", + "id": "reactflow__edge-ConversationBufferMemory-WkJkh{œbaseClassesœ:[œBaseChatMemoryœ,œBaseMemoryœ,œConversationBufferMemoryœ],œdataTypeœ:œConversationBufferMemoryœ,œidœ:œConversationBufferMemory-WkJkhœ}-LLMChain-qaGdJ{œfieldNameœ:œmemoryœ,œidœ:œLLMChain-qaGdJœ,œinputTypesœ:null,œtypeœ:œBaseMemoryœ}", + "animated": false, + "style": { + "stroke": "#555" + }, + "data": { + "sourceHandle": { + "baseClasses": [ + "BaseChatMemory", + "BaseMemory", + "ConversationBufferMemory" + ], + "dataType": "ConversationBufferMemory", + "id": "ConversationBufferMemory-WkJkh" + }, + "targetHandle": { + "fieldName": "memory", + "id": "LLMChain-qaGdJ", + "inputTypes": null, + "type": "BaseMemory" + } + }, + "selected": true + }, + { + "source": "PromptTemplate-h1IlH", + "sourceHandle": "{œbaseClassesœ:[œBasePromptTemplateœ,œPromptTemplateœ,œStringPromptTemplateœ],œdataTypeœ:œPromptTemplateœ,œidœ:œPromptTemplate-h1IlHœ}", + "target": "LLMChain-qaGdJ", + "targetHandle": "{œfieldNameœ:œpromptœ,œidœ:œLLMChain-qaGdJœ,œinputTypesœ:null,œtypeœ:œBasePromptTemplateœ}", + "style": { + "stroke": "#555" + }, + "className": "stroke-gray-900 stroke-connection", + "animated": false, + "id": "reactflow__edge-PromptTemplate-h1IlH{œbaseClassesœ:[œBasePromptTemplateœ,œPromptTemplateœ,œStringPromptTemplateœ],œdataTypeœ:œPromptTemplateœ,œidœ:œPromptTemplate-h1IlHœ}-LLMChain-qaGdJ{œfieldNameœ:œpromptœ,œidœ:œLLMChain-qaGdJœ,œinputTypesœ:null,œtypeœ:œBasePromptTemplateœ}", + "data": { + "sourceHandle": { + "baseClasses": [ + "BasePromptTemplate", + "PromptTemplate", + "StringPromptTemplate" + ], + "dataType": "PromptTemplate", + "id": "PromptTemplate-h1IlH" + }, + "targetHandle": { + "fieldName": "prompt", + "id": "LLMChain-qaGdJ", + "inputTypes": null, + "type": "BasePromptTemplate" + } + }, + "selected": true + } + ], + "viewport": { + "x": 51.18733552370577, + "y": 64.73969994910271, + "zoom": 0.5175724661902371 + } + }, + "name": "Peppy Cori", + "description": "", + "id": "fmpGP" + } + } + }, + "id": "LLMChain-7wD4b", + "position": { + "x": 603.4418527758642, + "y": 275.91705603727394 + }, + "type": "genericNode", + "selected": true, + "dragging": false, + "positionAbsolute": { + "x": 603.4418527758642, + "y": 275.91705603727394 + } + } + ], + "edges": [], + "viewport": { + "x": -248.3019876307386, + "y": -114.01962984298234, + "zoom": 0.8178072603465967 + } + }, + "id": "70a5f5a3-53c8-4e1c-996c-d9c46ae40220" +} \ No newline at end of file diff --git a/tests/data/vector_store_grouped.json b/tests/data/vector_store_grouped.json new file mode 100644 index 000000000..37176fb98 --- /dev/null +++ b/tests/data/vector_store_grouped.json @@ -0,0 +1 @@ +{"description":"An agent that can query a Vector Store.\nTry asking \"How do I upload examples to Langflow?\"\n\n\n\n","name":"Vector Store","data":{"nodes":[{"width":384,"height":267,"id":"VectorStoreAgent-xWgPj","type":"genericNode","position":{"x":2115.5183674856203,"y":-1277.6284872455249},"data":{"type":"VectorStoreAgent","node":{"template":{"llm":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"llm","display_name":"LLM","advanced":false,"dynamic":false,"info":"","type":"BaseLanguageModel","list":false},"vectorstoreinfo":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"vectorstoreinfo","display_name":"Vector Store Info","advanced":false,"dynamic":false,"info":"","type":"VectorStoreInfo","list":false},"_type":"vectorstore_agent"},"description":"Construct an agent from a Vector Store.","base_classes":["AgentExecutor"],"display_name":"VectorStoreAgent","documentation":""},"id":"VectorStoreAgent-xWgPj","value":null},"selected":false,"positionAbsolute":{"x":2115.5183674856203,"y":-1277.6284872455249},"dragging":false},{"width":384,"height":399,"id":"VectorStoreInfo-JbqfX","type":"genericNode","position":{"x":1553.2875394928135,"y":-1319.2113273706286},"data":{"type":"VectorStoreInfo","node":{"template":{"vectorstore":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"vectorstore","advanced":false,"dynamic":false,"info":"","type":"VectorStore","list":false},"description":{"required":true,"placeholder":"","show":true,"multiline":true,"password":false,"name":"description","advanced":false,"dynamic":false,"info":"","type":"str","list":false,"value":"Instructions to upload examples to Langflow Community Examples"},"name":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"name","advanced":false,"dynamic":false,"info":"","type":"str","list":false,"value":"UploadExamples"},"_type":"VectorStoreInfo"},"description":"Information about a VectorStore.","base_classes":["VectorStoreInfo"],"display_name":"VectorStoreInfo","documentation":""},"id":"VectorStoreInfo-JbqfX","value":null},"selected":false,"positionAbsolute":{"x":1553.2875394928135,"y":-1319.2113273706286},"dragging":false},{"width":384,"height":621,"id":"ChatOpenAI-sXmo2","type":"genericNode","position":{"x":1557.7805431884235,"y":-897.7091381330642},"data":{"type":"ChatOpenAI","node":{"template":{"callbacks":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"callbacks","advanced":false,"dynamic":false,"info":"","type":"langchain.callbacks.base.BaseCallbackHandler","list":true},"cache":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"cache","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"client":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"client","advanced":false,"dynamic":false,"info":"","type":"Any","list":false},"max_retries":{"required":false,"placeholder":"","show":false,"multiline":false,"value":6,"password":false,"name":"max_retries","advanced":false,"dynamic":false,"info":"","type":"int","list":false},"max_tokens":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"max_tokens","advanced":false,"dynamic":false,"info":"","type":"int","list":false,"value":""},"metadata":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"metadata","advanced":false,"dynamic":false,"info":"","type":"code","list":false},"model_kwargs":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"model_kwargs","advanced":true,"dynamic":false,"info":"","type":"code","list":false},"model_name":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"gpt-3.5-turbo-0613","password":false,"options":["gpt-3.5-turbo-0613","gpt-3.5-turbo","gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k","gpt-4-0613","gpt-4-32k-0613","gpt-4","gpt-4-32k"],"name":"model_name","advanced":false,"dynamic":false,"info":"","type":"str","list":true},"n":{"required":false,"placeholder":"","show":false,"multiline":false,"value":1,"password":false,"name":"n","advanced":false,"dynamic":false,"info":"","type":"int","list":false},"openai_api_base":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"openai_api_base","display_name":"OpenAI API Base","advanced":false,"dynamic":false,"info":"\nThe base URL of the OpenAI API. Defaults to https://api.openai.com/v1.\n\nYou can change this to use other APIs like JinaChat, LocalAI and Prem.\n","type":"str","list":false},"openai_api_key":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":true,"name":"openai_api_key","display_name":"OpenAI API Key","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"openai_organization":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"openai_organization","display_name":"OpenAI Organization","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"openai_proxy":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"openai_proxy","display_name":"OpenAI Proxy","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"request_timeout":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"request_timeout","advanced":false,"dynamic":false,"info":"","type":"float","list":false},"streaming":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"streaming","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"tags":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"tags","advanced":false,"dynamic":false,"info":"","type":"str","list":true},"temperature":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"0.2","password":false,"name":"temperature","advanced":false,"dynamic":false,"info":"","type":"float","list":false},"tiktoken_model_name":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"tiktoken_model_name","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"verbose":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"verbose","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"_type":"ChatOpenAI"},"description":"`OpenAI` Chat large language models API.","base_classes":["ChatOpenAI","BaseLanguageModel","BaseChatModel","BaseLLM"],"display_name":"ChatOpenAI","custom_fields":{},"output_types":[],"documentation":"https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai"},"id":"ChatOpenAI-sXmo2","value":null},"selected":false,"positionAbsolute":{"x":1557.7805431884235,"y":-897.7091381330642},"dragging":false},{"width":384,"height":707,"data":{"id":"Chroma-JRSb8","type":"Chroma","node":{"output_types":[],"display_name":"group Node","documentation":"","base_classes":["Chroma","VectorStore","BaseRetriever","VectorStoreRetriever"],"description":"double click to edit description","template":{"allowed_special_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":[],"password":false,"name":"allowed_special","advanced":true,"dynamic":false,"info":"","type":"Literal'all'","list":true,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"allowed_special"},"display_name":"Allowed Special - OpenAIEmbedding..."},"disallowed_special_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"all","password":false,"name":"disallowed_special","advanced":true,"dynamic":false,"info":"","type":"Literal'all'","list":true,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"disallowed_special"},"display_name":"Disallowed Special - OpenAIEmbedding..."},"chunk_size_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":1000,"password":false,"name":"chunk_size","advanced":true,"dynamic":false,"info":"","type":"int","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"chunk_size"},"display_name":"Chunk Size - OpenAIEmbedding..."},"client_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"client","advanced":true,"dynamic":false,"info":"","type":"Any","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"client"},"display_name":"Client - OpenAIEmbedding..."},"deployment_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"text-embedding-ada-002","password":false,"name":"deployment","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"deployment"},"display_name":"Deployment - OpenAIEmbedding..."},"embedding_ctx_length_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":8191,"password":false,"name":"embedding_ctx_length","advanced":true,"dynamic":false,"info":"","type":"int","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"embedding_ctx_length"},"display_name":"Embedding Ctx Length - OpenAIEmbedding..."},"max_retries_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":6,"password":false,"name":"max_retries","advanced":true,"dynamic":false,"info":"","type":"int","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"max_retries"},"display_name":"Max Retries - OpenAIEmbedding..."},"model_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"text-embedding-ada-002","password":false,"name":"model","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"model"},"display_name":"Model - OpenAIEmbedding..."},"model_kwargs_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"model_kwargs","advanced":true,"dynamic":false,"info":"","type":"code","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"model_kwargs"},"display_name":"Model Kwargs - OpenAIEmbedding..."},"openai_api_base_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"openai_api_base","display_name":"OpenAI API Base - OpenAIEmbedding...","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"openai_api_base"},"value":""},"openai_api_key_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":true,"name":"openai_api_key","display_name":"OpenAI API Key - OpenAIEmbedding...","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"openai_api_key"}},"openai_api_type_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"openai_api_type","display_name":"OpenAI API Type - OpenAIEmbedding...","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"openai_api_type"},"value":""},"openai_api_version_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"openai_api_version","display_name":"OpenAI API Version - OpenAIEmbedding...","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"openai_api_version"},"value":""},"openai_organization_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"openai_organization","display_name":"OpenAI Organization - OpenAIEmbedding...","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"openai_organization"}},"openai_proxy_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"openai_proxy","display_name":"OpenAI Proxy - OpenAIEmbedding...","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"openai_proxy"}},"request_timeout_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"request_timeout","advanced":true,"dynamic":false,"info":"","type":"float","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"request_timeout"},"display_name":"Request Timeout - OpenAIEmbedding..."},"show_progress_bar_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"value":false,"password":false,"name":"show_progress_bar","advanced":true,"dynamic":false,"info":"","type":"bool","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"show_progress_bar"},"display_name":"Show Progress Bar - OpenAIEmbedding..."},"tiktoken_model_name_OpenAIEmbeddings-YwSvx":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"tiktoken_model_name","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"OpenAIEmbeddings-YwSvx","field":"tiktoken_model_name"},"display_name":"Tiktoken Model Name - OpenAIEmbedding...","value":""},"chroma_server_cors_allow_origins_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_cors_allow_origins","display_name":"Chroma Server CORS Allow Origins - Chroma","advanced":true,"dynamic":false,"info":"","type":"str","list":true,"proxy":{"id":"Chroma-fIjxj","field":"chroma_server_cors_allow_origins"}},"chroma_server_grpc_port_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_grpc_port","display_name":"Chroma Server GRPC Port - Chroma","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"Chroma-fIjxj","field":"chroma_server_grpc_port"}},"chroma_server_host_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_host","display_name":"Chroma Server Host - Chroma","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"Chroma-fIjxj","field":"chroma_server_host"}},"chroma_server_http_port_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_http_port","display_name":"Chroma Server HTTP Port - Chroma","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"Chroma-fIjxj","field":"chroma_server_http_port"}},"chroma_server_ssl_enabled_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"value":false,"password":false,"name":"chroma_server_ssl_enabled","display_name":"Chroma Server SSL Enabled - Chroma","advanced":true,"dynamic":false,"info":"","type":"bool","list":false,"proxy":{"id":"Chroma-fIjxj","field":"chroma_server_ssl_enabled"}},"collection_name_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"langflow","password":false,"name":"collection_name","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"Chroma-fIjxj","field":"collection_name"},"display_name":"Collection Name - Chroma"},"persist_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"value":false,"password":false,"name":"persist","display_name":"Persist - Chroma","advanced":true,"dynamic":false,"info":"","type":"bool","list":false,"proxy":{"id":"Chroma-fIjxj","field":"persist"}},"persist_directory_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"persist_directory","advanced":true,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"Chroma-fIjxj","field":"persist_directory"},"display_name":"Persist Directory - Chroma"},"search_kwargs_Chroma-fIjxj":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"{}","password":false,"name":"search_kwargs","advanced":true,"dynamic":false,"info":"","type":"code","list":false,"proxy":{"id":"Chroma-fIjxj","field":"search_kwargs"},"display_name":"Search Kwargs - Chroma"},"chunk_overlap_RecursiveCharacterTextSplitter-eXb39_RecursiveCharacterTextSplitter-SjLCC":{"required":true,"placeholder":"","show":true,"multiline":false,"value":200,"password":false,"name":"chunk_overlap","display_name":"Chunk Overlap - RecursiveCharac... - group Node","advanced":false,"dynamic":false,"info":"","type":"int","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-SjLCC","field":"chunk_overlap_RecursiveCharacterTextSplitter-eXb39"}},"chunk_size_RecursiveCharacterTextSplitter-eXb39_RecursiveCharacterTextSplitter-SjLCC":{"required":true,"placeholder":"","show":true,"multiline":false,"value":1000,"password":false,"name":"chunk_size","display_name":"Chunk Size - RecursiveCharac... - group Node","advanced":false,"dynamic":false,"info":"","type":"int","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-SjLCC","field":"chunk_size_RecursiveCharacterTextSplitter-eXb39"}},"separator_type_RecursiveCharacterTextSplitter-eXb39_RecursiveCharacterTextSplitter-SjLCC":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"Text","password":false,"options":["Text","cpp","go","html","java","js","latex","markdown","php","proto","python","rst","ruby","rust","scala","sol","swift"],"name":"separator_type","display_name":"Separator Type - RecursiveCharac... - group Node","advanced":false,"dynamic":false,"info":"","type":"str","list":true,"proxy":{"id":"RecursiveCharacterTextSplitter-SjLCC","field":"separator_type_RecursiveCharacterTextSplitter-eXb39"}},"separators_RecursiveCharacterTextSplitter-eXb39_RecursiveCharacterTextSplitter-SjLCC":{"required":true,"placeholder":"","show":true,"multiline":false,"value":".","password":false,"name":"separators","display_name":"Separator - RecursiveCharac... - group Node","advanced":false,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-SjLCC","field":"separators_RecursiveCharacterTextSplitter-eXb39"}},"metadata_WebBaseLoader-LlDNv_RecursiveCharacterTextSplitter-SjLCC":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"{}","password":false,"name":"metadata","display_name":"Metadata - WebBaseLoader - group Node","advanced":false,"dynamic":false,"info":"","type":"code","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-SjLCC","field":"metadata_WebBaseLoader-LlDNv"}},"web_path_WebBaseLoader-LlDNv_RecursiveCharacterTextSplitter-SjLCC":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"http://docs.langflow.org/examples/how-upload-examples","password":false,"name":"web_path","display_name":"Web Page - WebBaseLoader - group Node","advanced":false,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-SjLCC","field":"web_path_WebBaseLoader-LlDNv"}}},"flow":{"data":{"nodes":[{"width":384,"height":359,"id":"OpenAIEmbeddings-YwSvx","type":"genericNode","position":{"x":677.2699276778915,"y":-734.4639958173494},"data":{"type":"OpenAIEmbeddings","node":{"template":{"allowed_special":{"required":false,"placeholder":"","show":true,"multiline":false,"value":[],"password":false,"name":"allowed_special","advanced":true,"dynamic":false,"info":"","type":"Literal'all'","list":true},"disallowed_special":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"all","password":false,"name":"disallowed_special","advanced":true,"dynamic":false,"info":"","type":"Literal'all'","list":true},"chunk_size":{"required":false,"placeholder":"","show":true,"multiline":false,"value":1000,"password":false,"name":"chunk_size","advanced":true,"dynamic":false,"info":"","type":"int","list":false},"client":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"client","advanced":true,"dynamic":false,"info":"","type":"Any","list":false},"deployment":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"text-embedding-ada-002","password":false,"name":"deployment","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"embedding_ctx_length":{"required":false,"placeholder":"","show":true,"multiline":false,"value":8191,"password":false,"name":"embedding_ctx_length","advanced":true,"dynamic":false,"info":"","type":"int","list":false},"headers":{"required":false,"placeholder":"","show":false,"multiline":true,"value":"{'Authorization':\n 'Bearer '}","password":false,"name":"headers","advanced":true,"dynamic":false,"info":"","type":"Any","list":false},"max_retries":{"required":false,"placeholder":"","show":true,"multiline":false,"value":6,"password":false,"name":"max_retries","advanced":true,"dynamic":false,"info":"","type":"int","list":false},"model":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"text-embedding-ada-002","password":false,"name":"model","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"model_kwargs":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"model_kwargs","advanced":true,"dynamic":false,"info":"","type":"code","list":false},"openai_api_base":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"openai_api_base","display_name":"OpenAI API Base","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"openai_api_key":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"","password":true,"name":"openai_api_key","display_name":"OpenAI API Key","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"openai_api_type":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"openai_api_type","display_name":"OpenAI API Type","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"openai_api_version":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"openai_api_version","display_name":"OpenAI API Version","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"openai_organization":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"openai_organization","display_name":"OpenAI Organization","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"openai_proxy":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"openai_proxy","display_name":"OpenAI Proxy","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"request_timeout":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"request_timeout","advanced":true,"dynamic":false,"info":"","type":"float","list":false},"show_progress_bar":{"required":false,"placeholder":"","show":true,"multiline":false,"value":false,"password":false,"name":"show_progress_bar","advanced":true,"dynamic":false,"info":"","type":"bool","list":false},"tiktoken_model_name":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"tiktoken_model_name","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"_type":"OpenAIEmbeddings"},"description":"OpenAI embedding models.","base_classes":["OpenAIEmbeddings","Embeddings"],"display_name":"OpenAIEmbeddings","documentation":"https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/openai"},"id":"OpenAIEmbeddings-YwSvx","value":null},"selected":true,"positionAbsolute":{"x":677.2699276778915,"y":-734.4639958173494},"dragging":false},{"width":384,"height":515,"id":"Chroma-fIjxj","type":"genericNode","position":{"x":998.5929276655718,"y":-1315.4167537905012},"data":{"type":"Chroma","node":{"template":{"client":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"client","advanced":false,"dynamic":false,"info":"","type":"chromadb.Client","list":false},"client_settings":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"client_settings","advanced":false,"dynamic":false,"info":"","type":"chromadb.config.Setting","list":true},"documents":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"documents","display_name":"Documents","advanced":false,"dynamic":false,"info":"","type":"Document","list":true},"embedding":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"embedding","display_name":"Embedding","advanced":false,"dynamic":false,"info":"","type":"Embeddings","list":false},"chroma_server_cors_allow_origins":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_cors_allow_origins","display_name":"Chroma Server CORS Allow Origins","advanced":true,"dynamic":false,"info":"","type":"str","list":true},"chroma_server_grpc_port":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_grpc_port","display_name":"Chroma Server GRPC Port","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"chroma_server_host":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_host","display_name":"Chroma Server Host","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"chroma_server_http_port":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"chroma_server_http_port","display_name":"Chroma Server HTTP Port","advanced":true,"dynamic":false,"info":"","type":"str","list":false},"chroma_server_ssl_enabled":{"required":false,"placeholder":"","show":true,"multiline":false,"value":false,"password":false,"name":"chroma_server_ssl_enabled","display_name":"Chroma Server SSL Enabled","advanced":true,"dynamic":false,"info":"","type":"bool","list":false},"collection_metadata":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"collection_metadata","advanced":false,"dynamic":false,"info":"","type":"code","list":false},"collection_name":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"langflow","password":false,"name":"collection_name","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"ids":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"ids","advanced":false,"dynamic":false,"info":"","type":"str","list":true},"metadatas":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"metadatas","advanced":false,"dynamic":false,"info":"","type":"code","list":true},"persist":{"required":false,"placeholder":"","show":true,"multiline":false,"value":false,"password":false,"name":"persist","display_name":"Persist","advanced":false,"dynamic":false,"info":"","type":"bool","list":false},"persist_directory":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"persist_directory","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"search_kwargs":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"{}","password":false,"name":"search_kwargs","advanced":true,"dynamic":false,"info":"","type":"code","list":false},"_type":"Chroma"},"description":"Create a Chroma vectorstore from a raw documents.","base_classes":["Chroma","VectorStore","BaseRetriever","VectorStoreRetriever"],"display_name":"Chroma","custom_fields":{},"output_types":[],"documentation":"https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/chroma"},"id":"Chroma-fIjxj","value":null},"selected":true,"positionAbsolute":{"x":998.5929276655718,"y":-1315.4167537905012},"dragging":false},{"width":384,"height":707,"data":{"id":"RecursiveCharacterTextSplitter-SjLCC","type":"RecursiveCharacterTextSplitter","node":{"output_types":["Document"],"display_name":"group Node","documentation":"","base_classes":["Document"],"description":"double click to edit description","template":{"chunk_overlap_RecursiveCharacterTextSplitter-eXb39":{"required":true,"placeholder":"","show":true,"multiline":false,"value":200,"password":false,"name":"chunk_overlap","display_name":"Chunk Overlap - RecursiveCharac...","advanced":false,"dynamic":false,"info":"","type":"int","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-eXb39","field":"chunk_overlap"}},"chunk_size_RecursiveCharacterTextSplitter-eXb39":{"required":true,"placeholder":"","show":true,"multiline":false,"value":1000,"password":false,"name":"chunk_size","display_name":"Chunk Size - RecursiveCharac...","advanced":false,"dynamic":false,"info":"","type":"int","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-eXb39","field":"chunk_size"}},"separator_type_RecursiveCharacterTextSplitter-eXb39":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"Text","password":false,"options":["Text","cpp","go","html","java","js","latex","markdown","php","proto","python","rst","ruby","rust","scala","sol","swift"],"name":"separator_type","display_name":"Separator Type - RecursiveCharac...","advanced":false,"dynamic":false,"info":"","type":"str","list":true,"proxy":{"id":"RecursiveCharacterTextSplitter-eXb39","field":"separator_type"}},"separators_RecursiveCharacterTextSplitter-eXb39":{"required":true,"placeholder":"","show":true,"multiline":false,"value":".","password":false,"name":"separators","display_name":"Separator - RecursiveCharac...","advanced":false,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"RecursiveCharacterTextSplitter-eXb39","field":"separators"}},"metadata_WebBaseLoader-LlDNv":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"{}","password":false,"name":"metadata","display_name":"Metadata - WebBaseLoader","advanced":false,"dynamic":false,"info":"","type":"code","list":false,"proxy":{"id":"WebBaseLoader-LlDNv","field":"metadata"}},"web_path_WebBaseLoader-LlDNv":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"http://docs.langflow.org/examples/how-upload-examples","password":false,"name":"web_path","display_name":"Web Page - WebBaseLoader","advanced":false,"dynamic":false,"info":"","type":"str","list":false,"proxy":{"id":"WebBaseLoader-LlDNv","field":"web_path"}}},"flow":{"data":{"nodes":[{"width":384,"height":575,"id":"RecursiveCharacterTextSplitter-eXb39","type":"genericNode","position":{"x":543.3651467111342,"y":-1373.3607842112438},"data":{"type":"RecursiveCharacterTextSplitter","node":{"template":{"documents":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"documents","advanced":false,"dynamic":false,"info":"","type":"Document","list":true},"chunk_overlap":{"required":true,"placeholder":"","show":true,"multiline":false,"value":200,"password":false,"name":"chunk_overlap","display_name":"Chunk Overlap","advanced":false,"dynamic":false,"info":"","type":"int","list":false},"chunk_size":{"required":true,"placeholder":"","show":true,"multiline":false,"value":1000,"password":false,"name":"chunk_size","display_name":"Chunk Size","advanced":false,"dynamic":false,"info":"","type":"int","list":false},"separator_type":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"Text","password":false,"options":["Text","cpp","go","html","java","js","latex","markdown","php","proto","python","rst","ruby","rust","scala","sol","swift"],"name":"separator_type","display_name":"Separator Type","advanced":false,"dynamic":false,"info":"","type":"str","list":true},"separators":{"required":true,"placeholder":"","show":true,"multiline":false,"value":".","password":false,"name":"separators","display_name":"Separator","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"_type":"RecursiveCharacterTextSplitter"},"description":"Splitting text by recursively look at characters.","base_classes":["Document"],"display_name":"RecursiveCharacterTextSplitter","custom_fields":{},"output_types":["Document"],"documentation":"https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/recursive_text_splitter"},"id":"RecursiveCharacterTextSplitter-eXb39","value":null},"selected":true,"positionAbsolute":{"x":543.3651467111342,"y":-1373.3607842112438},"dragging":false},{"width":384,"height":379,"id":"WebBaseLoader-LlDNv","type":"genericNode","position":{"x":60.77712301470575,"y":-1345.575885746874},"data":{"type":"WebBaseLoader","node":{"template":{"metadata":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"{}","password":false,"name":"metadata","display_name":"Metadata","advanced":false,"dynamic":false,"info":"","type":"code","list":false},"web_path":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"http://docs.langflow.org/examples/how-upload-examples","password":false,"name":"web_path","display_name":"Web Page","advanced":false,"dynamic":false,"info":"","type":"str","list":false},"_type":"WebBaseLoader"},"description":"Load HTML pages using `urllib` and parse them with `BeautifulSoup'.","base_classes":["Document"],"display_name":"WebBaseLoader","custom_fields":{},"output_types":["Document"],"documentation":"https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/web_base"},"id":"WebBaseLoader-LlDNv","value":null},"selected":true,"positionAbsolute":{"x":60.77712301470575,"y":-1345.575885746874},"dragging":false}],"edges":[{"source":"WebBaseLoader-LlDNv","sourceHandle":"{œbaseClassesœ:[œDocumentœ],œdataTypeœ:œWebBaseLoaderœ,œidœ:œWebBaseLoader-LlDNvœ}","target":"RecursiveCharacterTextSplitter-eXb39","targetHandle":"{œfieldNameœ:œdocumentsœ,œidœ:œRecursiveCharacterTextSplitter-eXb39œ,œinputTypesœ:null,œtypeœ:œDocumentœ}","style":{"stroke":"#555"},"className":"stroke-gray-900 stroke-connection","animated":false,"id":"reactflow__edge-WebBaseLoader-LlDNv{œbaseClassesœ:[œDocumentœ],œdataTypeœ:œWebBaseLoaderœ,œidœ:œWebBaseLoader-LlDNvœ}-RecursiveCharacterTextSplitter-eXb39{œfieldNameœ:œdocumentsœ,œidœ:œRecursiveCharacterTextSplitter-eXb39œ,œinputTypesœ:null,œtypeœ:œDocumentœ}","selected":true,"data":{"sourceHandle":{"baseClasses":["Document"],"dataType":"WebBaseLoader","id":"WebBaseLoader-LlDNv"},"targetHandle":{"fieldName":"documents","id":"RecursiveCharacterTextSplitter-eXb39","inputTypes":null,"type":"Document"}}}],"viewport":{"x":171.77566864238327,"y":1008.7716987035463,"zoom":0.6091751241035919}},"name":"Giggly Aryabhata","description":"","id":"oms5B"}}},"id":"RecursiveCharacterTextSplitter-SjLCC","position":{"x":459.66128620284064,"y":-1502.284409630862},"type":"genericNode","selected":true,"positionAbsolute":{"x":459.66128620284064,"y":-1502.284409630862},"dragging":false}],"edges":[{"source":"OpenAIEmbeddings-YwSvx","sourceHandle":"{œbaseClassesœ:[œOpenAIEmbeddingsœ,œEmbeddingsœ],œdataTypeœ:œOpenAIEmbeddingsœ,œidœ:œOpenAIEmbeddings-YwSvxœ}","target":"Chroma-fIjxj","targetHandle":"{œfieldNameœ:œembeddingœ,œidœ:œChroma-fIjxjœ,œinputTypesœ:null,œtypeœ:œEmbeddingsœ}","style":{"stroke":"#555"},"className":"stroke-gray-900 stroke-connection","animated":false,"id":"reactflow__edge-OpenAIEmbeddings-YwSvx{œbaseClassesœ:[œOpenAIEmbeddingsœ,œEmbeddingsœ],œdataTypeœ:œOpenAIEmbeddingsœ,œidœ:œOpenAIEmbeddings-YwSvxœ}-Chroma-fIjxj{œfieldNameœ:œembeddingœ,œidœ:œChroma-fIjxjœ,œinputTypesœ:null,œtypeœ:œEmbeddingsœ}","data":{"sourceHandle":{"baseClasses":["OpenAIEmbeddings","Embeddings"],"dataType":"OpenAIEmbeddings","id":"OpenAIEmbeddings-YwSvx"},"targetHandle":{"fieldName":"embedding","id":"Chroma-fIjxj","inputTypes":null,"type":"Embeddings"}},"selected":true},{"source":"RecursiveCharacterTextSplitter-SjLCC","sourceHandle":"{œbaseClassesœ:[œDocumentœ],œdataTypeœ:œRecursiveCharacterTextSplitterœ,œidœ:œRecursiveCharacterTextSplitter-SjLCCœ}","target":"Chroma-fIjxj","targetHandle":"{œfieldNameœ:œdocumentsœ,œidœ:œChroma-fIjxjœ,œinputTypesœ:null,œtypeœ:œDocumentœ}","data":{"targetHandle":{"fieldName":"documents","id":"Chroma-fIjxj","inputTypes":null,"type":"Document"},"sourceHandle":{"baseClasses":["Document"],"dataType":"RecursiveCharacterTextSplitter","id":"RecursiveCharacterTextSplitter-SjLCC"}},"style":{"stroke":"#555"},"className":"stroke-foreground stroke-connection","animated":false,"id":"reactflow__edge-RecursiveCharacterTextSplitter-SjLCC{œbaseClassesœ:[œDocumentœ],œdataTypeœ:œRecursiveCharacterTextSplitterœ,œidœ:œRecursiveCharacterTextSplitter-SjLCCœ}-Chroma-fIjxj{œfieldNameœ:œdocumentsœ,œidœ:œChroma-fIjxjœ,œinputTypesœ:null,œtypeœ:œDocumentœ}","selected":true}],"viewport":{"x":75.85425902478954,"y":794.442518380995,"zoom":0.3834017786930542}},"name":"Serene Noyce","description":"","id":"Tfctp"}}},"id":"Chroma-JRSb8","position":{"x":910.0668563050097,"y":-1379.672298924546},"type":"genericNode","selected":true,"positionAbsolute":{"x":910.0668563050097,"y":-1379.672298924546},"dragging":false}],"edges":[{"source":"VectorStoreInfo-JbqfX","sourceHandle":"{œbaseClassesœ:[œVectorStoreInfoœ],œdataTypeœ:œVectorStoreInfoœ,œidœ:œVectorStoreInfo-JbqfXœ}","target":"VectorStoreAgent-xWgPj","targetHandle":"{œfieldNameœ:œvectorstoreinfoœ,œidœ:œVectorStoreAgent-xWgPjœ,œinputTypesœ:null,œtypeœ:œVectorStoreInfoœ}","className":"stroke-gray-900 stroke-connection","id":"reactflow__edge-VectorStoreInfo-JbqfX{œbaseClassesœ:[œVectorStoreInfoœ],œdataTypeœ:œVectorStoreInfoœ,œidœ:œVectorStoreInfo-JbqfXœ}-VectorStoreAgent-xWgPj{œfieldNameœ:œvectorstoreinfoœ,œidœ:œVectorStoreAgent-xWgPjœ,œinputTypesœ:null,œtypeœ:œVectorStoreInfoœ}","selected":false,"style":{"stroke":"#555"},"animated":false,"data":{"sourceHandle":{"baseClasses":["VectorStoreInfo"],"dataType":"VectorStoreInfo","id":"VectorStoreInfo-JbqfX"},"targetHandle":{"fieldName":"vectorstoreinfo","id":"VectorStoreAgent-xWgPj","inputTypes":null,"type":"VectorStoreInfo"}}},{"source":"ChatOpenAI-sXmo2","sourceHandle":"{œbaseClassesœ:[œChatOpenAIœ,œBaseLanguageModelœ,œBaseChatModelœ,œBaseLLMœ],œdataTypeœ:œChatOpenAIœ,œidœ:œChatOpenAI-sXmo2œ}","target":"VectorStoreAgent-xWgPj","targetHandle":"{œfieldNameœ:œllmœ,œidœ:œVectorStoreAgent-xWgPjœ,œinputTypesœ:null,œtypeœ:œBaseLanguageModelœ}","style":{"stroke":"#555"},"className":"stroke-gray-900 stroke-connection","animated":false,"id":"reactflow__edge-ChatOpenAI-sXmo2{œbaseClassesœ:[œChatOpenAIœ,œBaseLanguageModelœ,œBaseChatModelœ,œBaseLLMœ],œdataTypeœ:œChatOpenAIœ,œidœ:œChatOpenAI-sXmo2œ}-VectorStoreAgent-xWgPj{œfieldNameœ:œllmœ,œidœ:œVectorStoreAgent-xWgPjœ,œinputTypesœ:null,œtypeœ:œBaseLanguageModelœ}","selected":false,"data":{"sourceHandle":{"baseClasses":["ChatOpenAI","BaseLanguageModel","BaseChatModel","BaseLLM"],"dataType":"ChatOpenAI","id":"ChatOpenAI-sXmo2"},"targetHandle":{"fieldName":"llm","id":"VectorStoreAgent-xWgPj","inputTypes":null,"type":"BaseLanguageModel"}}},{"source":"Chroma-JRSb8","sourceHandle":"{œbaseClassesœ:[œChromaœ,œVectorStoreœ,œBaseRetrieverœ,œVectorStoreRetrieverœ],œdataTypeœ:œChromaœ,œidœ:œChroma-JRSb8œ}","target":"VectorStoreInfo-JbqfX","targetHandle":"{œfieldNameœ:œvectorstoreœ,œidœ:œVectorStoreInfo-JbqfXœ,œinputTypesœ:null,œtypeœ:œVectorStoreœ}","data":{"targetHandle":{"fieldName":"vectorstore","id":"VectorStoreInfo-JbqfX","inputTypes":null,"type":"VectorStore"},"sourceHandle":{"baseClasses":["Chroma","VectorStore","BaseRetriever","VectorStoreRetriever"],"dataType":"Chroma","id":"Chroma-JRSb8"}},"style":{"stroke":"#555"},"className":"stroke-foreground stroke-connection","animated":false,"id":"reactflow__edge-Chroma-JRSb8{œbaseClassesœ:[œChromaœ,œVectorStoreœ,œBaseRetrieverœ,œVectorStoreRetrieverœ],œdataTypeœ:œChromaœ,œidœ:œChroma-JRSb8œ}-VectorStoreInfo-JbqfX{œfieldNameœ:œvectorstoreœ,œidœ:œVectorStoreInfo-JbqfXœ,œinputTypesœ:null,œtypeœ:œVectorStoreœ}"}],"viewport":{"x":-514.4089400658404,"y":1037.1605824094304,"zoom":0.6583510309092263}},"id":"33f0dc0b-39f1-4573-9811-a92b1ea51634"} \ No newline at end of file diff --git a/tests/test_graph.py b/tests/test_graph.py index ad5f8c07a..cca6d4f49 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -1,3 +1,4 @@ +import copy import json import os import pickle @@ -11,14 +12,18 @@ from langchain.llms.fake import FakeListLLM from langflow.graph import Graph from langflow.graph.edge.base import Edge -from langflow.graph.graph.utils import (find_last_node, process_flow, - set_new_target_handle, ungroup_node, - update_source_handle, - update_target_handle, update_template) +from langflow.graph.graph.utils import ( + find_last_node, + process_flow, + set_new_target_handle, + ungroup_node, + update_source_handle, + update_target_handle, + update_template, +) from langflow.graph.utils import UnbuiltObject from langflow.graph.vertex.base import Vertex -from langflow.graph.vertex.types import (FileToolVertex, LLMVertex, - ToolkitVertex) +from langflow.graph.vertex.types import FileToolVertex, LLMVertex, ToolkitVertex from langflow.processing.process import get_result_and_thought from langflow.utils.payload import get_root_vertex diff --git a/tests/test_prompts_template.py b/tests/test_prompts_template.py index 491a18d69..ca2bedb13 100644 --- a/tests/test_prompts_template.py +++ b/tests/test_prompts_template.py @@ -22,7 +22,7 @@ def test_prompt_template(client: TestClient, logged_in_headers): template = prompt["template"] assert template["input_variables"] == { "required": True, - "dynamic": False, + "dynamic": True, "placeholder": "", "show": False, "multiline": False, @@ -37,7 +37,7 @@ def test_prompt_template(client: TestClient, logged_in_headers): assert template["output_parser"] == { "required": False, - "dynamic": False, + "dynamic": True, "placeholder": "", "show": False, "multiline": False, @@ -52,7 +52,7 @@ def test_prompt_template(client: TestClient, logged_in_headers): assert template["partial_variables"] == { "required": False, - "dynamic": False, + "dynamic": True, "placeholder": "", "show": False, "multiline": False, @@ -67,7 +67,7 @@ def test_prompt_template(client: TestClient, logged_in_headers): assert template["template"] == { "required": True, - "dynamic": False, + "dynamic": True, "placeholder": "", "show": True, "multiline": True, @@ -98,7 +98,7 @@ def test_prompt_template(client: TestClient, logged_in_headers): assert template["validate_template"] == { "required": False, - "dynamic": False, + "dynamic": True, "placeholder": "", "show": False, "multiline": False, diff --git a/tests/test_template.py b/tests/test_template.py index b7a3e1441..6dcb789ee 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -2,6 +2,8 @@ import importlib from typing import Dict, List, Optional import pytest +from pydantic import BaseModel + from langflow.utils.constants import CHAT_OPENAI_MODELS, OPENAI_MODELS from langflow.utils.util import ( build_template_from_class, @@ -10,7 +12,6 @@ from langflow.utils.util import ( get_base_classes, get_default_factory, ) -from pydantic import BaseModel # Dummy classes for testing purposes @@ -235,7 +236,7 @@ def test_format_dict(): "password": False, "multiline": False, "options": CHAT_OPENAI_MODELS, - "value": "gpt-3.5-turbo-0613", + "value": "gpt-4-1106-preview", }, } assert format_dict(input_dict, "OpenAI") == expected_output_openai