Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Load model directly
|
| 2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
|
|
|
|
| 1 |
+
#memlayer
|
| 2 |
+
from memlayer import OpenAI
|
| 3 |
+
|
| 4 |
+
# Initialize with memory capabilities
|
| 5 |
+
client = OpenAI(
|
| 6 |
+
model="gpt-4.1-mini",
|
| 7 |
+
storage_path="./memories",
|
| 8 |
+
user_id="user_123"
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
# Store information automatically
|
| 12 |
+
client.chat([
|
| 13 |
+
{"role": "user", "content": "My name is Alice and I work at TechCorp"}
|
| 14 |
+
])
|
| 15 |
+
|
| 16 |
+
# Retrieve information automatically (no manual prompting needed!)
|
| 17 |
+
response = client.chat([
|
| 18 |
+
{"role": "user", "content": "Where do I work?"}
|
| 19 |
+
])
|
| 20 |
+
# Response: "You work at TechCorp."
|
| 21 |
# Load model directly
|
| 22 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 23 |
|