-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Open
langchain-ai/langchain-community
#215Labels
bugRelated to a bug, vulnerability, unexpected error with an existing featureRelated to a bug, vulnerability, unexpected error with an existing feature
Description
Checked other resources
- I added a very descriptive title to this issue.
- I searched the LangChain documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
from langchain_community.utilities import SQLDatabase
from langchain_community.tools.sql_database.tool import QuerySQLDatabaseTool
db = SQLDatabase.from_uri("sqlite+pysqlite:///:memory:")
print(QuerySQLDatabaseTool(db=db, response_format='content').invoke("SELECT 1"))
// returns correctly '[(1,)]'
QuerySQLDatabaseTool(db=db, response_format='content_and_artifact').invoke("SELECT 1")
// throws error:
// Since response_format='content_and_artifact' a two-tuple of the message content and
// raw tool output is expected. Instead generated response of type: <class 'str'>.
Error Message and Stack Trace (if applicable)
Since response_format='content_and_artifact' a two-tuple of the message content and raw tool output is expected. Instead generated response of type: <class 'str'>.
Description
langchain_community.utilities.SQLDatabase.run()
does not consider the option response_format="content_and_artifact"
from langchain_core.tools.base.BaseTool
but only returns string.
System Info
System Information
OS: Linux
OS Version: #1 SMP PREEMPT_DYNAMIC Debian 6.1.106-3 (2024-08-26)
Python Version: 3.12.5 | packaged by conda-forge | (main, Aug 8 2024, 18:36:51) [GCC 12.4.0]
Package Information
langchain_core: 0.3.43
langchain: 0.3.20
langchain_community: 0.3.19
langsmith: 0.1.125
langchain_chroma: 0.2.2
langchain_openai: 0.3.8
langchain_text_splitters: 0.3.6
Optional packages not installed
langserve
dosubot
Metadata
Metadata
Assignees
Labels
bugRelated to a bug, vulnerability, unexpected error with an existing featureRelated to a bug, vulnerability, unexpected error with an existing feature