style: ruff
This commit is contained in:
parent
35adfaa711
commit
48cb3b06ca
6 changed files with 16 additions and 16 deletions
|
|
@ -7,6 +7,7 @@ from pathlib import Path
|
|||
|
||||
from langflow.server import LangflowApplication
|
||||
|
||||
|
||||
def serve(
|
||||
workers: int = None,
|
||||
timeout: int = None,
|
||||
|
|
@ -28,9 +29,12 @@ def serve(
|
|||
if not timeout:
|
||||
timeout = 60
|
||||
|
||||
|
||||
options = {"bind": "0.0.0.0:5003", "workers": workers, "worker_class": "uvicorn.workers.UvicornWorker", "timeout": timeout}
|
||||
|
||||
options = {
|
||||
"bind": "0.0.0.0:5003",
|
||||
"workers": workers,
|
||||
"worker_class": "uvicorn.workers.UvicornWorker",
|
||||
"timeout": timeout,
|
||||
}
|
||||
|
||||
LangflowApplication(app, options).run()
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from langchain.agents.mrkl import prompt
|
|||
|
||||
def get_custom_prompts():
|
||||
"""Get custom prompts."""
|
||||
|
||||
|
||||
return {
|
||||
"ZeroShotPrompt": {
|
||||
"template": {
|
||||
|
|
|
|||
|
|
@ -35,9 +35,6 @@ def replace_zero_shot_prompt_with_prompt_template(nodes):
|
|||
return nodes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def load_langchain_type_from_config(config: Dict[str, Any]):
|
||||
"""Load langchain type from config"""
|
||||
# Get type list
|
||||
|
|
@ -52,9 +49,6 @@ def load_langchain_type_from_config(config: Dict[str, Any]):
|
|||
raise ValueError("Type should be either agent, chain or llm")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def build_prompt_template(prompt, tools):
|
||||
"""Build PromptTemplate from ZeroShotPrompt"""
|
||||
prefix = prompt["node"]["template"]["prefix"]["value"]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ import re
|
|||
|
||||
def extract_input_variables(data):
|
||||
"""
|
||||
Extracts input variables from the template and adds them to the input_variables field.
|
||||
Extracts input variables from the template
|
||||
and adds them to the input_variables field.
|
||||
"""
|
||||
for node in data["nodes"]:
|
||||
with contextlib.suppress(Exception):
|
||||
|
|
@ -59,7 +60,6 @@ def build_json(root, nodes, edges):
|
|||
elif "dict" in module_type:
|
||||
value = {}
|
||||
else:
|
||||
|
||||
children = []
|
||||
for c in local_nodes:
|
||||
module_types = [c["data"]["type"]]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import inspect
|
|||
import re
|
||||
import importlib
|
||||
|
||||
from langchain.agents.load_tools import *
|
||||
from langchain.agents.load_tools import (
|
||||
_BASE_TOOLS,
|
||||
_LLM_TOOLS,
|
||||
|
|
|
|||
|
|
@ -8,10 +8,13 @@ class LangflowApplication(BaseApplication):
|
|||
super().__init__()
|
||||
|
||||
def load_config(self):
|
||||
config = {key: value for key, value in self.options.items()
|
||||
if key in self.cfg.settings and value is not None}
|
||||
config = {
|
||||
key: value
|
||||
for key, value in self.options.items()
|
||||
if key in self.cfg.settings and value is not None
|
||||
}
|
||||
for key, value in config.items():
|
||||
self.cfg.set(key.lower(), value)
|
||||
|
||||
def load(self):
|
||||
return self.application
|
||||
return self.application
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue