Add PythonREPLToolComponent to tools/__init__.py and create PythonREPLTool.py (#1639)
* re-add --fix * Add PythonREPLToolComponent to tools/__init__.py and create PythonREPLTool.py * Refactor PythonREPLToolComponent to use build_status_from_tool in PythonREPLTool.py * Refactor model_specs imports in ChatLiteLLMSpecs.py * Refactor imports in various files * Refactor model_specs imports and class names in AnthropicLLMSpecs.py and AnthropicSpecs.py
This commit is contained in:
parent
6f52312fe9
commit
83c915916d
31 changed files with 245 additions and 243 deletions
|
|
@ -22,9 +22,6 @@ from langflow.services.database.models.flow.model import Flow, FlowCreate
|
|||
from langflow.services.database.models.user.model import User, UserCreate
|
||||
from langflow.services.database.utils import session_getter
|
||||
from langflow.services.deps import get_db_service
|
||||
from sqlmodel import Session, SQLModel, create_engine, select
|
||||
from sqlmodel.pool import StaticPool
|
||||
from typer.testing import CliRunner
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langflow.services.database.service import DatabaseService
|
||||
|
|
|
|||
|
|
@ -6,21 +6,15 @@ import pytest
|
|||
from langchain_core.documents import Document
|
||||
|
||||
from langflow.interface.custom.base import CustomComponent
|
||||
from langflow.interface.custom.code_parser.code_parser import (
|
||||
CodeParser,
|
||||
CodeSyntaxError,
|
||||
)
|
||||
from langflow.interface.custom.custom_component.component import (
|
||||
Component,
|
||||
ComponentCodeNullError,
|
||||
)
|
||||
from langflow.interface.custom.code_parser.code_parser import CodeParser, CodeSyntaxError
|
||||
from langflow.interface.custom.custom_component.component import Component, ComponentCodeNullError
|
||||
from langflow.services.database.models.flow import Flow, FlowCreate
|
||||
|
||||
code_default = """
|
||||
from langflow.field_typing import Prompt
|
||||
from langflow.interface.custom.custom_component import CustomComponent
|
||||
|
||||
from langchain.llms.base import BaseLLM
|
||||
from langflow.field_typing import BaseLanguageModel
|
||||
from langchain.chains import LLMChain
|
||||
from langchain.prompts import PromptTemplate
|
||||
from langchain_core.documents import Document
|
||||
|
|
@ -32,7 +26,7 @@ class YourComponent(CustomComponent):
|
|||
description: str = "Your description"
|
||||
field_config = { "url": { "multiline": True, "required": True } }
|
||||
|
||||
def build(self, url: str, llm: BaseLLM, template: Prompt) -> Document:
|
||||
def build(self, url: str, llm: BaseLanguageModel, template: Prompt) -> Document:
|
||||
response = requests.get(url)
|
||||
prompt = PromptTemplate.from_template(template)
|
||||
chain = LLMChain(llm=llm, prompt=prompt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue