fix: Add outputs support to SQLAgentComponent (#9173)
* ✨ (sql.py): add new output definitions for the SQLAgentComponent to include 'Agent' and 'Response' outputs for better functionality and flexibility * 📝 (sql.py): update import statement for Output class to match new file structure ♻️ (sql.py): refactor Output class usage to remove unnecessary attributes and improve code readability --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
This commit is contained in:
parent
cf863ff4a9
commit
73225f4d81
1 changed files with 6 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ from langchain_community.utilities import SQLDatabase
|
|||
|
||||
from langflow.base.agents.agent import LCAgentComponent
|
||||
from langflow.inputs.inputs import HandleInput, MessageTextInput
|
||||
from langflow.template.field.base import Output
|
||||
|
||||
|
||||
class SQLAgentComponent(LCAgentComponent):
|
||||
|
|
@ -25,6 +26,11 @@ class SQLAgentComponent(LCAgentComponent):
|
|||
),
|
||||
]
|
||||
|
||||
outputs = [
|
||||
Output(display_name="Response", name="response", method="message_response"),
|
||||
Output(display_name="Agent", name="agent", method="build_agent", tool_mode=False),
|
||||
]
|
||||
|
||||
def build_agent(self) -> AgentExecutor:
|
||||
db = SQLDatabase.from_uri(self.database_uri)
|
||||
toolkit = SQLDatabaseToolkit(db=db, llm=self.llm)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue