-
Notifications
You must be signed in to change notification settings - Fork 0
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
falkor-integration #2
base: main
Are you sure you want to change the base?
Changes from 16 commits
41eeccd
6c3d44b
ca95bed
495a66d
19db2cc
7f3b23d
07de1c4
12da12d
852220a
9a49aa8
c662cdd
563bd7f
c64712a
c9ff6a0
890c0f8
b0940d8
3cb6324
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This example shows how to use graph config to use falkordb graph database | ||
import os | ||
from mem0 import Memory | ||
from dotenv import load_dotenv | ||
|
||
# Loading OpenAI API Key | ||
load_dotenv() | ||
OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY') | ||
USER_ID = "test" | ||
|
||
# Creating the config dict from the environment variables | ||
config = { | ||
"llm": { # This is the language model configuration, use your carditionals | ||
"provider": "openai", | ||
"config": { | ||
"model": "gpt-4o-mini", | ||
"temperature": 0 | ||
} | ||
}, | ||
"graph_store": { # See https://app.falkordb.cloud/ for the carditionals | ||
"provider": "falkordb", | ||
"config": { | ||
"host": os.environ['HOST'], | ||
"username": os.environ['USERNAME'], | ||
"password": os.environ['PASSWORD'], | ||
"port": os.environ['PORT'] | ||
} | ||
}, | ||
"version": "v1.1" | ||
} | ||
|
||
# Create the memory class using from config | ||
memory = Memory.from_config(config_dict=config) | ||
|
||
# Use the Mem0 to add and search memories | ||
memory.add("I like painting", user_id=USER_ID) | ||
memory.add("I hate playing badminton", user_id=USER_ID) | ||
print(memory.get_all(user_id=USER_ID)) | ||
memory.add("My friend name is john and john has a dog named tommy", user_id=USER_ID) | ||
print(memory.search("What I like to do", user_id=USER_ID)) |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -63,11 +63,13 @@ from mem0 import Memory | |||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
config = { | ||||||||||||||||||||||||||||||||||||
"graph_store": { | ||||||||||||||||||||||||||||||||||||
"provider": "neo4j", | ||||||||||||||||||||||||||||||||||||
"provider": "falkordb", | ||||||||||||||||||||||||||||||||||||
"config": { | ||||||||||||||||||||||||||||||||||||
"url": "neo4j+s://---", | ||||||||||||||||||||||||||||||||||||
"username": "neo4j", | ||||||||||||||||||||||||||||||||||||
"password": "---" | ||||||||||||||||||||||||||||||||||||
"Database": "falkordb", | ||||||||||||||||||||||||||||||||||||
"host": "---" | ||||||||||||||||||||||||||||||||||||
"username": "---", | ||||||||||||||||||||||||||||||||||||
"password": "---", | ||||||||||||||||||||||||||||||||||||
"port": "---" | ||||||||||||||||||||||||||||||||||||
Comment on lines
+66
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Follow consistent parameter naming conventions. The configuration parameters should follow consistent naming conventions:
Apply this diff to improve the configuration structure: "provider": "falkordb",
"config": {
- "Database": "falkordb",
- "host": "---"
- "username": "---",
- "password": "---",
- "port": "---"
+ "database": "falkordb",
+ "host": "---",
+ "port": "---",
+ "username": "---",
+ "password": "---"
} 📝 Committable suggestion
Suggested change
💡 Codebase verification Based on the search results, I can now provide a definitive response about the FalkorDB configuration parameters. The The FalkorDB configuration in the documentation has an error. According to
This is evidenced by the config["database"] = "_default_" 🔗 Analysis chainVerify FalkorDB configuration parameters. The configuration structure has changed significantly from Neo4j. Let's verify that these are the correct parameters for FalkorDB integration. Let me try a different search strategy to find FalkorDB configuration information. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Search for FalkorDB configuration examples and parameter definitions in the codebase.
# Test 1: Search for FalkorDB configuration examples
echo "Searching for FalkorDB configuration examples..."
rg -l 'falkordb.*config'
# Test 2: Search for FalkorDB parameter definitions
echo "Searching for FalkorDB parameter definitions..."
ast-grep --pattern 'class $_(FalkorDB|Config|Settings)'
Length of output: 296 Script: #!/bin/bash
# Search for FalkorDB related files and configuration patterns
# Look for any files containing FalkorDB (case-insensitive)
echo "=== Files containing FalkorDB ==="
rg -i "falkordb" -A 5 -B 5
# Look for configuration examples in documentation
echo -e "\n=== Configuration examples in docs ==="
fd . docs -e md -e mdx -e txt -X rg -i "falkordb.*config|database.*config"
# Look for configuration related code files
echo -e "\n=== Configuration related files ==="
fd -e py -e js -e ts -e json -X rg -l "(?i)falkordb.*config|database.*connection"
Length of output: 16346 |
||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||
"version": "v1.1" | ||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve configuration example clarity.
The configuration example could be enhanced:
Database
parameter should be lowercase for consistency📝 Committable suggestion