zep-crewai 1.0.0__tar.gz → 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/PKG-INFO +1 -1
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/examples/crewai_graph.py +1 -1
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/examples/crewai_user.py +2 -2
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/examples/test_context_mock.py +4 -4
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/pyproject.toml +1 -1
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/src/zep_crewai/graph_storage.py +1 -1
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/src/zep_crewai/memory.py +2 -2
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/src/zep_crewai/user_storage.py +3 -3
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/tests/test_graph_storage.py +1 -1
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/tests/test_user_storage.py +9 -9
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/.gitignore +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/Makefile +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/README.md +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/examples/crewai_tools.py +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/examples/simple_example.py +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/src/zep_crewai/__init__.py +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/src/zep_crewai/exceptions.py +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/src/zep_crewai/tools.py +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/src/zep_crewai/utils.py +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/tests/test_basic.py +0 -0
- {zep_crewai-1.0.0 → zep_crewai-1.1.1}/tests/test_tools.py +0 -0
@@ -214,7 +214,7 @@ def main():
|
|
214
214
|
search_results = graph_storage.search("Python", limit=5)
|
215
215
|
print(f"Found {len(search_results)} results about Python:")
|
216
216
|
for idx, result in enumerate(search_results[:3], 1):
|
217
|
-
print(f" {idx}. {result.get('
|
217
|
+
print(f" {idx}. {result.get('context', '')[:100]}...")
|
218
218
|
|
219
219
|
except Exception as e:
|
220
220
|
print(f"\n❌ Execution failed: {e}")
|
@@ -72,7 +72,7 @@ def main():
|
|
72
72
|
client=zep_client,
|
73
73
|
user_id=user_id,
|
74
74
|
thread_id=thread_id,
|
75
|
-
mode="summary", # Use summary mode for concise context (or "
|
75
|
+
mode="summary", # Use summary mode for concise context (or "basic" for raw context)
|
76
76
|
)
|
77
77
|
external_memory = ExternalMemory(storage=user_storage)
|
78
78
|
|
@@ -223,7 +223,7 @@ def main():
|
|
223
223
|
print(f"Found {len(search_results)} relevant memories about mobile app:")
|
224
224
|
for idx, result in enumerate(search_results[:3], 1):
|
225
225
|
memory_type = result.get("type", "unknown")
|
226
|
-
content = result.get("
|
226
|
+
content = result.get("context", "")[:100]
|
227
227
|
print(f" {idx}. [{memory_type}] {content}...")
|
228
228
|
|
229
229
|
except Exception as e:
|
@@ -62,8 +62,8 @@ Key Facts:
|
|
62
62
|
logger.info("Context that CrewAI agent receives:")
|
63
63
|
logger.info(context)
|
64
64
|
|
65
|
-
# Example 2:
|
66
|
-
logger.info("\n2.
|
65
|
+
# Example 2: basic mode
|
66
|
+
logger.info("\n2. basic MODE - thread.get_user_context(mode='basic')")
|
67
67
|
logger.info("-" * 60)
|
68
68
|
|
69
69
|
mock_context_raw = MagicMock()
|
@@ -82,7 +82,7 @@ Key Facts:
|
|
82
82
|
mock_zep.thread.get_user_context = MagicMock(return_value=mock_context_raw)
|
83
83
|
|
84
84
|
storage_raw = ZepUserStorage(
|
85
|
-
client=mock_zep, user_id="user_123", thread_id="thread_456", mode="
|
85
|
+
client=mock_zep, user_id="user_123", thread_id="thread_456", mode="basic"
|
86
86
|
)
|
87
87
|
|
88
88
|
context = storage_raw.get_context()
|
@@ -227,7 +227,7 @@ CrewAI agents receive context from Zep in these ways:
|
|
227
227
|
|
228
228
|
1. User Storage (ZepUserStorage):
|
229
229
|
- Retrieves user-specific context from conversation threads
|
230
|
-
- Two modes: 'summary' (default) or '
|
230
|
+
- Two modes: 'summary' (default) or 'basic'
|
231
231
|
- Context includes user profile, preferences, conversation history
|
232
232
|
- Directly uses thread.get_user_context() from Zep SDK
|
233
233
|
|
@@ -127,7 +127,7 @@ class ZepGraphStorage(Storage):
|
|
127
127
|
if context:
|
128
128
|
self._logger.info(f"Composed context for query: {query}")
|
129
129
|
return [
|
130
|
-
{"
|
130
|
+
{"context": context, "type": "graph_context", "source": "graph", "query": query}
|
131
131
|
]
|
132
132
|
|
133
133
|
self._logger.info(f"No results found for query: {query}")
|
@@ -156,10 +156,10 @@ class ZepStorage(Storage):
|
|
156
156
|
self._logger.debug(f"Failed to search user memories: {e}")
|
157
157
|
|
158
158
|
if thread_context and hasattr(thread_context, "context") and thread_context.context:
|
159
|
-
results.append({"
|
159
|
+
results.append({"context": thread_context.context})
|
160
160
|
|
161
161
|
for result in edges_search_results:
|
162
|
-
results.append({"
|
162
|
+
results.append({"context": result})
|
163
163
|
|
164
164
|
return results
|
165
165
|
|
@@ -31,7 +31,7 @@ class ZepUserStorage(Storage):
|
|
31
31
|
search_filters: SearchFilters | None = None,
|
32
32
|
facts_limit: int = 20,
|
33
33
|
entity_limit: int = 5,
|
34
|
-
mode: Literal["summary", "
|
34
|
+
mode: Literal["summary", "basic"] = "summary",
|
35
35
|
**kwargs: Any,
|
36
36
|
) -> None:
|
37
37
|
"""
|
@@ -44,7 +44,7 @@ class ZepUserStorage(Storage):
|
|
44
44
|
search_filters: Optional filters for search operations
|
45
45
|
facts_limit: Maximum number of facts (edges) to retrieve for context
|
46
46
|
entity_limit: Maximum number of entities (nodes) to retrieve for context
|
47
|
-
mode: Mode for thread context retrieval ("summary" or "
|
47
|
+
mode: Mode for thread context retrieval ("summary" or "basic")
|
48
48
|
**kwargs: Additional configuration options
|
49
49
|
"""
|
50
50
|
if not isinstance(client, Zep):
|
@@ -155,7 +155,7 @@ class ZepUserStorage(Storage):
|
|
155
155
|
self._logger.info(f"Composed context for query: {query}")
|
156
156
|
return [
|
157
157
|
{
|
158
|
-
"
|
158
|
+
"context": context,
|
159
159
|
"type": "user_graph_context",
|
160
160
|
"source": "user_graph",
|
161
161
|
"query": query,
|
@@ -125,7 +125,7 @@ class TestZepGraphStorage:
|
|
125
125
|
assert len(results) == 1 # Single composed result
|
126
126
|
|
127
127
|
# Check the composed result
|
128
|
-
assert results[0]["
|
128
|
+
assert results[0]["context"] == (
|
129
129
|
"Facts:\n- Python is used for AI\n\n"
|
130
130
|
"Entities:\n- Python: A programming language\n\n"
|
131
131
|
"Episodes:\n- Discussion about Python"
|
@@ -180,7 +180,7 @@ class TestZepUserStorage:
|
|
180
180
|
assert isinstance(results, list)
|
181
181
|
assert len(results) == 1
|
182
182
|
assert results[0]["type"] == "user_graph_context"
|
183
|
-
assert results[0]["
|
183
|
+
assert results[0]["context"] == "Context: User likes Python"
|
184
184
|
|
185
185
|
@patch("zep_crewai.utils.compose_context_string")
|
186
186
|
@patch("zep_crewai.utils.ThreadPoolExecutor")
|
@@ -256,8 +256,8 @@ class TestZepUserStorage:
|
|
256
256
|
# Verify results
|
257
257
|
assert len(results) == 1
|
258
258
|
assert results[0]["type"] == "user_graph_context"
|
259
|
-
assert "User prefers Python" in results[0]["
|
260
|
-
assert "UserPreference" in results[0]["
|
259
|
+
assert "User prefers Python" in results[0]["context"]
|
260
|
+
assert "UserPreference" in results[0]["context"]
|
261
261
|
|
262
262
|
def test_get_context_with_thread(self):
|
263
263
|
"""Test get_context retrieves context using thread.get_user_context."""
|
@@ -285,28 +285,28 @@ class TestZepUserStorage:
|
|
285
285
|
|
286
286
|
assert context == "User's conversation context with summary"
|
287
287
|
|
288
|
-
def
|
289
|
-
"""Test get_context with
|
288
|
+
def test_get_context_with_basic_mode(self):
|
289
|
+
"""Test get_context with basic mode."""
|
290
290
|
from zep_cloud.client import Zep
|
291
291
|
|
292
292
|
mock_client = MagicMock(spec=Zep)
|
293
293
|
mock_client.thread = MagicMock()
|
294
294
|
|
295
|
-
# Mock thread context response with
|
295
|
+
# Mock thread context response with basic
|
296
296
|
mock_context = MagicMock()
|
297
297
|
mock_context.context = "User: Hello\nAssistant: Hi there!\nUser: How are you?"
|
298
298
|
mock_client.thread.get_user_context.return_value = mock_context
|
299
299
|
|
300
300
|
storage = ZepUserStorage(
|
301
|
-
client=mock_client, user_id="test-user", thread_id="test-thread", mode="
|
301
|
+
client=mock_client, user_id="test-user", thread_id="test-thread", mode="basic"
|
302
302
|
)
|
303
303
|
|
304
304
|
# Get context
|
305
305
|
context = storage.get_context()
|
306
306
|
|
307
|
-
# Verify thread.get_user_context was called with
|
307
|
+
# Verify thread.get_user_context was called with basic mode
|
308
308
|
mock_client.thread.get_user_context.assert_called_once_with(
|
309
|
-
thread_id="test-thread", mode="
|
309
|
+
thread_id="test-thread", mode="basic"
|
310
310
|
)
|
311
311
|
|
312
312
|
assert context == "User: Hello\nAssistant: Hi there!\nUser: How are you?"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|