🔧 chore(__main__.py): update components_path default value to include "components" directory for better organization
🔧 chore(custom.py): update description of YourComponent to be more descriptive and accurate
This commit is contained in:
parent
0fa15d2d91
commit
a09e57b9ef
2 changed files with 4 additions and 3 deletions
|
|
@ -127,7 +127,7 @@ def serve(
|
||||||
timeout: int = typer.Option(300, help="Worker timeout in seconds."),
|
timeout: int = typer.Option(300, help="Worker timeout in seconds."),
|
||||||
port: int = typer.Option(7860, help="Port to listen on.", envvar="LANGFLOW_PORT"),
|
port: int = typer.Option(7860, help="Port to listen on.", envvar="LANGFLOW_PORT"),
|
||||||
components_path: Optional[Path] = typer.Option(
|
components_path: Optional[Path] = typer.Option(
|
||||||
Path(__file__).parent,
|
Path(__file__).parent / "components",
|
||||||
help="Path to the directory containing custom components.",
|
help="Path to the directory containing custom components.",
|
||||||
envvar="LANGFLOW_COMPONENTS_PATH",
|
envvar="LANGFLOW_COMPONENTS_PATH",
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,13 @@ from langchain.schema import Document
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
class YourComponent(CustomComponent):
|
class YourComponent(CustomComponent):
|
||||||
display_name: str = "Custom Component"
|
display_name: str = "Custom Component"
|
||||||
description: str = "My description"
|
description: str = "Create any custom component you want!"
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return { "url": { "multiline": True, "required": True } }
|
return {"url": {"multiline": True, "required": True}}
|
||||||
|
|
||||||
def build(self, url: str, llm: BaseLLM, prompt: PromptTemplate) -> Document:
|
def build(self, url: str, llm: BaseLLM, prompt: PromptTemplate) -> Document:
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue