Skip to content
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]: Error with falkordb usage #177

Closed
ohdearquant opened this issue Dec 10, 2024 · 3 comments
Closed

[Bug]: Error with falkordb usage #177

ohdearquant opened this issue Dec 10, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ohdearquant
Copy link
Collaborator

ohdearquant commented Dec 10, 2024

Describe the bug

ResponseError: unknown command 'GRAPH.QUERY', with args beginning with: 'test_memory_ontology' 'MERGE (n:Event {type: "string!*"}) SET n += {timestamp: "string*"} RETURN n' '--compact'

Steps to reproduce

First run falkordb

docker run -p 6379:6379 falkordb/falkordb:latest

second run the following codes in .ipynb

from pathlib import Path
import json
from datetime import datetime
from typing import List, Dict, Any, Optional

from graphrag_sdk import Attribute, AttributeType, Entity, Ontology, Relation
from autogen.agentchat.contrib.graph_rag.document import Document, DocumentType
from autogen.agentchat.contrib.graph_rag.falkor_graph_query_engine import FalkorGraphQueryEngine
from autogen.agentchat.contrib.graph_rag.falkor_graph_rag_capability import FalkorGraphRagCapability
from autogen import ConversableAgent

class MemoryGraphEngine:
    """Knowledge graph engine for maintaining conversation memory"""
    
    def __init__(self, name: str = "memory_graph", host: str = "localhost", port: int = 6379):
        # Create knowledge base directory
        self.memory_dir = Path("memory_store")
        self.memory_dir.mkdir(exist_ok=True)
        
        # Create query engine
        self.query_engine = FalkorGraphQueryEngine(
            name=name,
            host=host,
            port=port
        )
        
        # Initialize with empty memory if needed
        self._init_if_empty()
        
    def _init_if_empty(self):
        """Initialize memory store if empty"""
        if not list(self.memory_dir.glob("*.txt")):
            empty_doc = self._create_memory_file({
                "type": "memory_init",
                "timestamp": datetime.now().isoformat()
            })
            self.query_engine.init_db(input_doc=[empty_doc])
    
    def _create_memory_file(self, content: Dict) -> Document:
        """Create a memory document file"""
        timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
        filepath = self.memory_dir / f"memory_{timestamp}.txt"
        
        # Save formatted content
        with open(filepath, 'w') as f:
            json.dump(content, f, indent=2)
            
        return Document(doctype=DocumentType.TEXT, path_or_url=str(filepath))

    def store_memory(self, summary: str, topics: List[str], facts: List[Dict[str, Any]], 
                    prev_conversation_id: Optional[str] = None) -> str:
        """Store new memory as a document"""
        timestamp = datetime.now().isoformat()
        
        # Format memory content
        memory_content = {
            "type": "memory",
            "timestamp": timestamp,
            "summary": summary,
            "topics": topics,
            "facts": facts,
            "previous_memory": prev_conversation_id
        }
        
        # Create memory document
        memory_doc = self._create_memory_file(memory_content)
        
        # Initialize DB if this is first memory, otherwise load as new document
        if len(list(self.memory_dir.glob("*.txt"))) == 1:
            self.query_engine.init_db(input_doc=[memory_doc])
        else:
            existing_docs = [
                Document(doctype=DocumentType.TEXT, path_or_url=str(p))
                for p in self.memory_dir.glob("*.txt")
            ]
            self.query_engine.init_db(input_doc=existing_docs)
        
        return timestamp

    async def query_knowledge(self, query: str) -> List[Dict[str, Any]]:
        """Query the knowledge base"""
        return await self.query_engine.query(query)

def create_memory_agent(
    name: str = "memory_agent",
    llm_config: Optional[Dict[str, Any]] = None,
    memory_config: Optional[Dict[str, Any]] = None
) -> ConversableAgent:
    """Create an agent with memory capability"""
    
    # Create base agent
    agent = ConversableAgent(
        name=name,
        llm_config=llm_config,
        human_input_mode="NEVER",
        system_message="""You are a helpful agent with long-term memory capabilities.
        You can store and recall information using your memory.
        When asked about topics, try to reference relevant information from your memory."""
    )
    
    # Create memory engine
    memory_engine = MemoryGraphEngine(**(memory_config or {}))
    
    # Add graph capability
    graph_capability = FalkorGraphRagCapability(memory_engine.query_engine)
    graph_capability.add_to_agent(agent)
    
    # Add memory engine reference
    setattr(agent, "memory_engine", memory_engine)
    
    return agent


import os
import autogen
from autogen import UserProxyAgent

# Configure OpenAI
config_list = autogen.config_list_from_json(env_or_file="OAI_CONFIG_LIST")
os.environ["OPENAI_API_KEY"] = config_list[0]["api_key"]

# Create memory agent
memory_agent = create_memory_agent(
    name="memory_assistant",
    memory_config={
        "name": "test_memory",
        "host": "localhost",
        "port": 6379  # Match your FalkorDB port
    }
)

# Create user proxy
user_proxy = UserProxyAgent(
    name="user",
    human_input_mode="ALWAYS",
    code_execution_config=False
)

# Store quantum computing knowledge
quantum_knowledge = {
    "summary": "Introduction to quantum computing concepts",
    "topics": ["quantum computing", "qubits", "quantum gates"],
    "facts": [
        {
            "content": "Qubits can exist in multiple states simultaneously due to superposition",
            "confidence": 1.0,
            "topics": ["qubits", "quantum computing"]
        },
        {
            "content": "Quantum gates manipulate qubits to perform computations",
            "confidence": 1.0,
            "topics": ["quantum gates", "quantum computing"]
        }
    ]
}

# Store the knowledge
memory_agent.memory_engine.store_memory(**quantum_knowledge)

# Test retrieving knowledge
user_proxy.initiate_chat(
    memory_agent,
    message="What do you know about quantum computing?"
)

Error:

---------------------------------------------------------------------------
ResponseError                             Traceback (most recent call last)
Cell In[2], [line 45](vscode-notebook-cell:?execution_count=2&line=45)
     [27](vscode-notebook-cell:?execution_count=2&line=27) quantum_knowledge = {
     [28](vscode-notebook-cell:?execution_count=2&line=28)     "summary": "Introduction to quantum computing concepts",
     [29](vscode-notebook-cell:?execution_count=2&line=29)     "topics": ["quantum computing", "qubits", "quantum gates"],
   (...)
     [41](vscode-notebook-cell:?execution_count=2&line=41)     ]
     [42](vscode-notebook-cell:?execution_count=2&line=42) }
     [44](vscode-notebook-cell:?execution_count=2&line=44) # Store the knowledge
---> [45](vscode-notebook-cell:?execution_count=2&line=45) memory_agent.memory_engine.store_memory(**quantum_knowledge)
     [47](vscode-notebook-cell:?execution_count=2&line=47) # Test retrieving knowledge
     [48](vscode-notebook-cell:?execution_count=2&line=48) user_proxy.initiate_chat(
     [49](vscode-notebook-cell:?execution_count=2&line=49)     memory_agent,
     [50](vscode-notebook-cell:?execution_count=2&line=50)     message="What do you know about quantum computing?"
     [51](vscode-notebook-cell:?execution_count=2&line=51) )

Cell In[1], [line 76](vscode-notebook-cell:?execution_count=1&line=76)
     [71](vscode-notebook-cell:?execution_count=1&line=71) else:
     [72](vscode-notebook-cell:?execution_count=1&line=72)     existing_docs = [
     [73](vscode-notebook-cell:?execution_count=1&line=73)         Document(doctype=DocumentType.TEXT, path_or_url=str(p))
     [74](vscode-notebook-cell:?execution_count=1&line=74)         for p in self.memory_dir.glob("*.txt")
     [75](vscode-notebook-cell:?execution_count=1&line=75)     ]
---> [76](vscode-notebook-cell:?execution_count=1&line=76)     self.query_engine.init_db(input_doc=existing_docs)
     [78](vscode-notebook-cell:?execution_count=1&line=78) return timestamp

File ~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:123, in FalkorGraphQueryEngine.init_db(self, input_doc)
    [120](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:120)     self._chat_session = self.knowledge_graph.chat_session()
    [122](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:122)     # Save Ontology to graph for future access.
--> [123](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:123)     self._save_ontology_to_db(self.name, self.ontology)
    [124](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:124) else:
    [125](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:125)     raise ValueError("No input documents could be loaded.")

File ~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:161, in FalkorGraphQueryEngine._save_ontology_to_db(self, graph_name, ontology)
    [157](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:157) """
    [158](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:158) Save graph ontology to a separate table with {graph_name}_ontology
    [159](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:159) """
    [160](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:160) graph = self.__get_ontology_storage_graph(graph_name)
--> [161](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/autogen/agentchat/contrib/graph_rag/falkor_graph_query_engine.py:161) ontology.save_to_graph(graph)

File ~/playground/.venv/lib/python3.12/site-packages/graphrag_sdk/ontology.py:327, in Ontology.save_to_graph(self, graph)
    [325](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/graphrag_sdk/ontology.py:325)     query = entity.to_graph_query()
    [326](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/graphrag_sdk/ontology.py:326)     logger.debug(f"Query: {query}")
--> [327](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/graphrag_sdk/ontology.py:327)     graph.query(query)
    [329](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/graphrag_sdk/ontology.py:329) for relation in self.relations:
    [330](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/graphrag_sdk/ontology.py:330)     query = relation.to_graph_query()

File ~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:115, in Graph.query(self, q, params, timeout)
     [99](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:99) def query(self, q: str, params: Optional[Dict[str, object]] = None,
    [100](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:100)           timeout: Optional[int] = None) -> QueryResult:
    [101](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:101)     """
    [102](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:102)     Executes a query against the graph.
    [103](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:103)     See: https://docs.falkordb.com/commands/graph.query.html
   (...)
    [112](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:112) 
    [113](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:113)     """
--> [115](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:115)     return self._query(q, params=params, timeout=timeout, read_only=False)

File ~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:91, in Graph._query(self, q, params, timeout, read_only)
     [89](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:89) # issue query
     [90](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:90) try:
---> [91](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:91)     response = self.execute_command(*command)
     [92](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:92)     return QueryResult(self, response)
     [93](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:93) except SchemaVersionMismatchException as e:
     [94](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:94)     # client view over the graph schema is out of sync
     [95](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/falkordb/graph.py:95)     # set client version and refresh local schema

File ~/playground/.venv/lib/python3.12/site-packages/redis/client.py:559, in Redis.execute_command(self, *args, **options)
    [558](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:558) def execute_command(self, *args, **options):
--> [559](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:559)     return self._execute_command(*args, **options)

File ~/playground/.venv/lib/python3.12/site-packages/redis/client.py:567, in Redis._execute_command(self, *args, **options)
    [565](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:565) conn = self.connection or pool.get_connection(command_name, **options)
    [566](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:566) try:
--> [567](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:567)     return conn.retry.call_with_retry(
    [568](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:568)         lambda: self._send_command_parse_response(
    [569](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:569)             conn, command_name, *args, **options
    [570](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:570)         ),
    [571](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:571)         lambda error: self._disconnect_raise(conn, error),
    [572](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:572)     )
    [573](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:573) finally:
    [574](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:574)     if not self.connection:

File ~/playground/.venv/lib/python3.12/site-packages/redis/retry.py:62, in Retry.call_with_retry(self, do, fail)
     [60](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/retry.py:60) while True:
     [61](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/retry.py:61)     try:
---> [62](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/retry.py:62)         return do()
     [63](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/retry.py:63)     except self._supported_errors as error:
     [64](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/retry.py:64)         failures += 1

File ~/playground/.venv/lib/python3.12/site-packages/redis/client.py:568, in Redis._execute_command.<locals>.<lambda>()
    [565](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:565) conn = self.connection or pool.get_connection(command_name, **options)
    [566](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:566) try:
    [567](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:567)     return conn.retry.call_with_retry(
--> [568](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:568)         lambda: self._send_command_parse_response(
    [569](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:569)             conn, command_name, *args, **options
    [570](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:570)         ),
    [571](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:571)         lambda error: self._disconnect_raise(conn, error),
    [572](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:572)     )
    [573](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:573) finally:
    [574](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:574)     if not self.connection:

File ~/playground/.venv/lib/python3.12/site-packages/redis/client.py:542, in Redis._send_command_parse_response(self, conn, command_name, *args, **options)
    [538](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:538) """
    [539](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:539) Send a command and parse the response
    [540](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:540) """
    [541](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:541) conn.send_command(*args, **options)
--> [542](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:542) return self.parse_response(conn, command_name, **options)

File ~/playground/.venv/lib/python3.12/site-packages/redis/client.py:584, in Redis.parse_response(self, connection, command_name, **options)
    [582](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:582)         options.pop(NEVER_DECODE)
    [583](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:583)     else:
--> [584](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:584)         response = connection.read_response()
    [585](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:585) except ResponseError:
    [586](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/client.py:586)     if EMPTY_RESPONSE in options:

File ~/playground/.venv/lib/python3.12/site-packages/redis/connection.py:616, in AbstractConnection.read_response(self, disable_decoding, disconnect_on_error, push_request)
    [614](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/connection.py:614) if isinstance(response, ResponseError):
    [615](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/connection.py:615)     try:
--> [616](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/connection.py:616)         raise response
    [617](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/connection.py:617)     finally:
    [618](https://file+.vscode-resource.vscode-cdn.net/Users/lion/playground/test_memory/~/playground/.venv/lib/python3.12/site-packages/redis/connection.py:618)         del response  # avoid creating ref cycles

ResponseError: unknown command 'GRAPH.QUERY', with args beginning with: 'test_memory_ontology' 'MERGE (n:Event {type: "string!*"}) SET n += {timestamp: "string*"} RETURN n' '--compact'

Model Used

gpt-4o

Expected Behavior

should be able to run without errors as exact same codes worked in version 0.4.1

Screenshots and logs

No response

Additional Information

No response

@ohdearquant ohdearquant added the bug Something isn't working label Dec 10, 2024
@ohdearquant ohdearquant changed the title [Bug]: [Bug]: Error with falkordb usage Dec 10, 2024
@AgentGenie AgentGenie self-assigned this Dec 10, 2024
@AgentGenie
Copy link
Collaborator

@ohdearquant I think this is not a bug.
In the example, you called init_db() twice which is supposed to be only called once. I will make this more explicit.
Currently FalkorDB does not support add_records() method. You may try use Neo4j if you would like add_records().

@ohdearquant
Copy link
Collaborator Author

@AgentGenie thank you, will dig in more

@AgentGenie
Copy link
Collaborator

AgentGenie commented Dec 10, 2024

FYI @ohdearquant #178
Added delete method. If you still want to use FalkorDB, one way is to delete and recreate the knowledge graph every time you add new memory to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants