Closed psathish10 closed 1 week ago
The constructured query is returing alot of results from your database which is raising the above error. You need to reduce the size of top_k:
chain = SQLDatabaseChain.from_llm(db=db,llm=llm,top_k = 1)
See if this works.
If not then can you do the following:
chain = SQLDatabaseChain.from_llm(db=db,llm=llm,top_k = 1,verbose = True)
and output the logs from the high verbosity!!!
Please remove me from your mailing list of lang hain. I tried unsubscribing multiple times but still receiving the mails
Thanks, Arti
On Wed, 28 Aug 2024 at 9:38 PM, dosubot[bot] @.***> wrote:
Closed #22025 https://github.com/langchain-ai/langchain/issues/22025 as not planned.
— Reply to this email directly, view it on GitHub https://github.com/langchain-ai/langchain/issues/22025#event-14049620531, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYLGP3P43UGAVADNPFBTYLZTXYXLAVCNFSM6AAAAABIDUF7W2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUGA2DSNRSGA2TGMI . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>
Checked other resources
Example Code
from langchain.llms import GooglePalm from langchain.utilities import SQLDatabase from langchain_experimental.sql.base import SQLDatabaseChain
import os
key_google=os.environ["key"]
llm = GooglePalm(google_api_key=key_google, temperature=0.1) host = os.environ.get('MYSQL_HOST') user = os.environ.get('MYSQL_USER') password = os.environ.get('MYSQL_PASSWORD') database = os.environ.get('MYSQL_DATABASE')
db = SQLDatabase.from_uri(f"mysql+mysqlconnector://{user}:{password}@{host}/{database}")
chain = SQLDatabaseChain.from_llm(db=db,llm=llmp)
query = "how many employees are there?" chain.run(query)
Error
InvalidArgument: 400 Request payload size exceeds the limit: 50000 bytes.
Error Message and Stack Trace (if applicable)
_InactiveRpcError Traceback (most recent call last) File c:\Users\SATHISH\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\api_core\grpc_helpers.py:72, in _wrap_unary_errors..error_remapped_callable(*args, *kwargs)
71 try:
---> 72 return callable_(args, **kwargs)
73 except grpc.RpcError as exc:
File c:\Users\SATHISH\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc_channel.py:1176, in _UnaryUnaryMultiCallable.call(self, request, timeout, metadata, credentials, wait_for_ready, compression) 1170 ( 1171 state, 1172 call, 1173 ) = self._blocking( 1174 request, timeout, metadata, credentials, wait_for_ready, compression 1175 ) -> 1176 return _end_unary_response_blocking(state, call, False, None)
File c:\Users\SATHISH\AppData\Local\Programs\Python\Python311\Lib\site-packages\grpc_channel.py:1005, in _end_unary_response_blocking(state, call, with_call, deadline) 1004 else: -> 1005 raise _InactiveRpcError(state)
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "Request payload size exceeds the limit: 50000 bytes." debug_error_string = "UNKNOWN:Error received from peer ipv4:142.250.193.170:443 {created_time:"2024-05-22T11:59:36.7301692+00:00", grpc_status:3, grpc_message:"Request payload size exceeds the limit: 50000 bytes."}"
InvalidArgument: 400 Request payload size exceeds the limit: 50000 bytes.
Description
I'm encountering an error when attempting to fetch queries using the Google Palm model with SQLDatabaseChain. I've tried using different API keys and accounts, but I still encounter the same error.
System Info
langchian Version: 0.2.0 langchain_experimental Version: 0.0.59