-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: SQL size keyword error #1103
Comments
Hi @Vasu2803k , |
try:
|
'''from typing import Optional, Dict, Any, Union dotenv.load_dotenv() class CacheManager:
''' |
@Vasu2803k To better understand and debug the problem, could you please provide a minimal, self-contained code example that reproduces the issue? A smaller snippet (around 10-20 lines) would make it much easier to diagnose and fix. |
Here is the smaller snippet that you have asked for.
|
@Vasu2803k import os
from autogen import AssistantAgent, Cache, UserProxyAgent
config_list = [
{
"api_type": "openai",
"model": "gpt-4o",
"api_key": os.environ["OPENAI_API_KEY"]
}
]
user_proxy = UserProxyAgent(
name="user_proxy",
human_input_mode="NEVER",
)
assistant = AssistantAgent(
name="assistant",
llm_config={"config_list": config_list},
)
with Cache.disk(cache_path_root="/tmp/.cache-test") as cache:
user_proxy.initiate_chat(
recipient=assistant,
message="What is the capital of France?",
cache=cache,
) and for with Cache.redis(redis_url=...) as cache:
... |
You think I haven't gone through this and raised a bug. Earlier it was working well before your latest update on Feb 15, 2025. All of a sudden when I ran the whole system, it raised an error due to disk cache. I was not using redis and I had not initialized it. It is not working for some reason. Could you check the code that I gave you and try to reproduce the issue? |
@Vasu2803k Thank you again for reporting this weird behaviour. It seems that it is caused by an updated sqlite3 library on your system, we found a number of similar issues in other repos:
Please check your version of sqlite3 by running:
If the version is 3.49.1, please try downgrading it (it seems like 3.42.0 does not have this problem). In any case, please let us know what happened and we'll take it from there. |
@davorrunje Thank you for providing the solution to resolve the issue. It worked fine after downgrading the sqlite version to 3.42.0. You are a legend. |
This bug appears to be related to the disk cache implementation in the AutoGen framework. Let me break down the error:
The error occurs during the chat execution when trying to cache an LLM response
The specific error is: sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes?
The error chain shows it's happening in the diskcache library's SQLite operations
This suggests there's a schema mismatch in the disk cache database. The cache is trying to insert a record with a "size" column, but the database table doesn't have this column defined.
Traceback (most recent call last):
File "/media/vasu/Hard Disk/Projects/CareerSage/SageBuilder/src/scripts/SageBuilder.py", line 624, in _run_group_chat
chat_result = initiator_agent.initiate_chat(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 1106, in initiate_chat
self.send(msg2send, recipient, silent=silent)
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 741, in send
recipient.receive(message, self, request_reply, silent)
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 906, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 2060, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/groupchat.py", line 1174, in run_chat
reply = speaker.generate_reply(sender=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 2060, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 1428, in generate_oai_reply
extracted_response = self._generate_oai_reply_from_client(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 1447, in _generate_oai_reply_from_client
response = llm_client.create(
^^^^^^^^^^^^^^^^^^
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/oai/client.py", line 897, in create
cache.set(key, response)
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/autogen/cache/disk_cache.py", line 73, in set
self.cache.set(key, value)
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/diskcache/core.py", line 808, in set
self._row_insert(db_key, raw, now, columns)
File "/home/vasu/miniconda3/envs/sagebuilder/lib/python3.11/site-packages/diskcache/core.py", line 857, in _row_insert
sql(
sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes?
Steps to reproduce
No response
Model Used
No response
Expected Behavior
No response
Screenshots and logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: