Merge remote-tracking branch 'origin/dev' into fix_toolkits
This commit is contained in:
commit
410ba005cd
85 changed files with 2322 additions and 273 deletions
|
|
@ -52,7 +52,6 @@ llms:
|
|||
- OpenAI
|
||||
# - AzureOpenAI
|
||||
- ChatOpenAI
|
||||
- HuggingFaceHub
|
||||
- LlamaCpp
|
||||
- CTransformers
|
||||
- Cohere
|
||||
|
|
@ -66,9 +65,9 @@ prompts:
|
|||
- ZeroShotPrompt
|
||||
textsplitters:
|
||||
- CharacterTextSplitter
|
||||
- RecursiveCharacterTextSplitter
|
||||
- LatexTextSplitter
|
||||
- PythonCodeTextSplitter
|
||||
# - RecursiveCharacterTextSplitter
|
||||
# - LatexTextSplitter
|
||||
# - PythonCodeTextSplitter
|
||||
toolkits:
|
||||
- OpenAPIToolkit
|
||||
- JsonToolkit
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import contextlib
|
|||
import inspect
|
||||
import types
|
||||
import warnings
|
||||
from copy import deepcopy
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from langflow.cache import base as cache_utils
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from typing import Dict, List, Optional
|
||||
|
||||
from langchain.agents import loading
|
||||
from langchain.agents import types
|
||||
|
||||
from langflow.custom.customs import get_custom_nodes
|
||||
from langflow.interface.agents.custom import CUSTOM_AGENTS
|
||||
|
|
@ -16,7 +16,7 @@ class AgentCreator(LangChainTypeCreator):
|
|||
@property
|
||||
def type_to_loader_dict(self) -> Dict:
|
||||
if self.type_dict is None:
|
||||
self.type_dict = loading.AGENT_TO_CLASS
|
||||
self.type_dict = types.AGENT_TO_CLASS
|
||||
# Add JsonAgent to the list of agents
|
||||
for name, agent in CUSTOM_AGENTS.items():
|
||||
# TODO: validate AgentType
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from langflow.utils import util, validate
|
|||
def instantiate_class(node_type: str, base_type: str, params: Dict) -> Any:
|
||||
"""Instantiate class from module type and key, and params"""
|
||||
params = convert_params_to_sets(params)
|
||||
|
||||
params = convert_kwargs(params)
|
||||
if node_type in CUSTOM_AGENTS:
|
||||
custom_agent = CUSTOM_AGENTS.get(node_type)
|
||||
if custom_agent:
|
||||
|
|
@ -50,6 +50,16 @@ def convert_params_to_sets(params):
|
|||
return params
|
||||
|
||||
|
||||
def convert_kwargs(params):
|
||||
# if *kwargs are passed as a string, convert to dict
|
||||
# first find any key that has kwargs in it
|
||||
kwargs_keys = [key for key in params.keys() if "kwargs" in key]
|
||||
for key in kwargs_keys:
|
||||
if isinstance(params[key], str):
|
||||
params[key] = json.loads(params[key])
|
||||
return params
|
||||
|
||||
|
||||
def instantiate_based_on_type(class_object, base_type, node_type, params):
|
||||
if base_type == "agents":
|
||||
return instantiate_agent(class_object, params)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class TextSplitterCreator(LangChainTypeCreator):
|
|||
"type": "int",
|
||||
"required": True,
|
||||
"show": True,
|
||||
"value": 4000,
|
||||
"value": 1000,
|
||||
"name": "chunk_size",
|
||||
"display_name": "Chunk Size",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
||||
|
|
@ -3,7 +3,7 @@ from typing import List, Optional
|
|||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from langflow.template.constants import FORCE_SHOW_FIELDS
|
||||
from langflow.template.frontend_node.constants import FORCE_SHOW_FIELDS
|
||||
from langflow.template.field.base import TemplateField
|
||||
from langflow.template.template.base import Template
|
||||
from langflow.utils import constants
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@ from typing import Optional
|
|||
|
||||
from langchain.agents.mrkl import prompt
|
||||
|
||||
from langflow.template.constants import DEFAULT_PROMPT, HUMAN_PROMPT, SYSTEM_PROMPT
|
||||
from langflow.template.frontend_node.constants import (
|
||||
DEFAULT_PROMPT,
|
||||
HUMAN_PROMPT,
|
||||
SYSTEM_PROMPT,
|
||||
)
|
||||
from langflow.template.field.base import TemplateField
|
||||
from langflow.template.frontend_node.base import FrontendNode
|
||||
from langflow.template.template.base import Template
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import ast
|
||||
import json
|
||||
from typing import Optional
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ class UtilitiesFrontendNode(FrontendNode):
|
|||
# field.field_type could be "Literal['news', 'search', 'places', 'images']
|
||||
# we need to convert it to a list
|
||||
if "Literal" in field.field_type:
|
||||
field.options = eval(field.field_type.replace("Literal", ""))
|
||||
field.options = ast.literal_eval(field.field_type.replace("Literal", ""))
|
||||
field.is_list = True
|
||||
field.field_type = "str"
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
||||
|
|
@ -6,7 +6,7 @@ from typing import Dict, Optional
|
|||
|
||||
from docstring_parser import parse # type: ignore
|
||||
|
||||
from langflow.template.constants import FORCE_SHOW_FIELDS
|
||||
from langflow.template.frontend_node.constants import FORCE_SHOW_FIELDS
|
||||
from langflow.utils import constants
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue