memmachine-client 0.2.6__tar.gz → 0.3.2__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.
- memmachine_client-0.3.2/PKG-INFO +254 -0
- {memmachine_client-0.2.6/src/memmachine/rest_client → memmachine_client-0.3.2}/README.md +11 -11
- memmachine_client-0.3.2/client_tests/__init__.py +1 -0
- memmachine_client-0.3.2/client_tests/test_client.py +453 -0
- memmachine_client-0.3.2/client_tests/test_config.py +572 -0
- memmachine_client-0.3.2/client_tests/test_integration_complete.py +1913 -0
- memmachine_client-0.3.2/client_tests/test_langgraph.py +372 -0
- memmachine_client-0.3.2/client_tests/test_memory.py +2665 -0
- {memmachine_client-0.2.6 → memmachine_client-0.3.2}/pyproject.toml +12 -7
- {memmachine_client-0.2.6/src/memmachine/rest_client → memmachine_client-0.3.2/src/memmachine_client}/client.py +7 -13
- {memmachine_client-0.2.6/src/memmachine/rest_client → memmachine_client-0.3.2/src/memmachine_client}/config.py +325 -3
- {memmachine_client-0.2.6/src/memmachine/rest_client → memmachine_client-0.3.2/src/memmachine_client}/langgraph.py +2 -2
- memmachine_client-0.3.2/src/memmachine_client/memory.py +1824 -0
- {memmachine_client-0.2.6/src/memmachine/rest_client → memmachine_client-0.3.2/src/memmachine_client}/project.py +3 -3
- memmachine_client-0.3.2/src/memmachine_client.egg-info/PKG-INFO +254 -0
- memmachine_client-0.3.2/src/memmachine_client.egg-info/SOURCES.txt +20 -0
- {memmachine_client-0.2.6 → memmachine_client-0.3.2}/src/memmachine_client.egg-info/requires.txt +1 -1
- memmachine_client-0.3.2/src/memmachine_client.egg-info/top_level.txt +1 -0
- memmachine_client-0.2.6/PKG-INFO +0 -146
- memmachine_client-0.2.6/README.md +0 -120
- memmachine_client-0.2.6/src/memmachine/__init__.py +0 -41
- memmachine_client-0.2.6/src/memmachine/common/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/common/api/__init__.py +0 -19
- memmachine_client-0.2.6/src/memmachine/common/api/config_spec.py +0 -413
- memmachine_client-0.2.6/src/memmachine/common/api/doc.py +0 -862
- memmachine_client-0.2.6/src/memmachine/common/api/spec.py +0 -922
- memmachine_client-0.2.6/src/memmachine/common/api/version.py +0 -21
- memmachine_client-0.2.6/src/memmachine/common/configuration/__init__.py +0 -510
- memmachine_client-0.2.6/src/memmachine/common/configuration/database_conf.py +0 -269
- memmachine_client-0.2.6/src/memmachine/common/configuration/default_episode_summary_system_prompt.txt +0 -5
- memmachine_client-0.2.6/src/memmachine/common/configuration/default_episode_summary_user_prompt.txt +0 -19
- memmachine_client-0.2.6/src/memmachine/common/configuration/embedder_conf.py +0 -222
- memmachine_client-0.2.6/src/memmachine/common/configuration/episodic_config.py +0 -255
- memmachine_client-0.2.6/src/memmachine/common/configuration/language_model_conf.py +0 -261
- memmachine_client-0.2.6/src/memmachine/common/configuration/log_conf.py +0 -148
- memmachine_client-0.2.6/src/memmachine/common/configuration/mixin_confs.py +0 -261
- memmachine_client-0.2.6/src/memmachine/common/configuration/reranker_conf.py +0 -222
- memmachine_client-0.2.6/src/memmachine/common/data_types.py +0 -19
- memmachine_client-0.2.6/src/memmachine/common/embedder/__init__.py +0 -7
- memmachine_client-0.2.6/src/memmachine/common/embedder/amazon_bedrock_embedder.py +0 -218
- memmachine_client-0.2.6/src/memmachine/common/embedder/embedder.py +0 -46
- memmachine_client-0.2.6/src/memmachine/common/embedder/openai_embedder.py +0 -337
- memmachine_client-0.2.6/src/memmachine/common/embedder/sentence_transformer_embedder.py +0 -167
- memmachine_client-0.2.6/src/memmachine/common/episode_store/__init__.py +0 -23
- memmachine_client-0.2.6/src/memmachine/common/episode_store/count_caching_episode_storage.py +0 -154
- memmachine_client-0.2.6/src/memmachine/common/episode_store/episode_model.py +0 -105
- memmachine_client-0.2.6/src/memmachine/common/episode_store/episode_sqlalchemy_store.py +0 -415
- memmachine_client-0.2.6/src/memmachine/common/episode_store/episode_storage.py +0 -74
- memmachine_client-0.2.6/src/memmachine/common/errors.py +0 -140
- memmachine_client-0.2.6/src/memmachine/common/filter/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/common/filter/filter_parser.py +0 -276
- memmachine_client-0.2.6/src/memmachine/common/filter/sql_filter_util.py +0 -72
- memmachine_client-0.2.6/src/memmachine/common/language_model/__init__.py +0 -7
- memmachine_client-0.2.6/src/memmachine/common/language_model/amazon_bedrock_language_model.py +0 -589
- memmachine_client-0.2.6/src/memmachine/common/language_model/language_model.py +0 -96
- memmachine_client-0.2.6/src/memmachine/common/language_model/openai_chat_completions_language_model.py +0 -316
- memmachine_client-0.2.6/src/memmachine/common/language_model/openai_responses_language_model.py +0 -357
- memmachine_client-0.2.6/src/memmachine/common/metrics_factory/__init__.py +0 -9
- memmachine_client-0.2.6/src/memmachine/common/metrics_factory/metrics_factory.py +0 -96
- memmachine_client-0.2.6/src/memmachine/common/metrics_factory/prometheus_metrics_factory.py +0 -158
- memmachine_client-0.2.6/src/memmachine/common/neo4j_utils.py +0 -116
- memmachine_client-0.2.6/src/memmachine/common/reranker/__init__.py +0 -7
- memmachine_client-0.2.6/src/memmachine/common/reranker/amazon_bedrock_reranker.py +0 -238
- memmachine_client-0.2.6/src/memmachine/common/reranker/bm25_reranker.py +0 -64
- memmachine_client-0.2.6/src/memmachine/common/reranker/cohere_reranker.py +0 -72
- memmachine_client-0.2.6/src/memmachine/common/reranker/cross_encoder_reranker.py +0 -66
- memmachine_client-0.2.6/src/memmachine/common/reranker/embedder_reranker.py +0 -73
- memmachine_client-0.2.6/src/memmachine/common/reranker/identity_reranker.py +0 -13
- memmachine_client-0.2.6/src/memmachine/common/reranker/reranker.py +0 -23
- memmachine_client-0.2.6/src/memmachine/common/reranker/rrf_hybrid_reranker.py +0 -47
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/__init__.py +0 -60
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/base_manager.py +0 -183
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/database_manager.py +0 -256
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/embedder_manager.py +0 -235
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/language_model_manager.py +0 -267
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/reranker_manager.py +0 -276
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/resource_manager.py +0 -247
- memmachine_client-0.2.6/src/memmachine/common/resource_manager/semantic_manager.py +0 -154
- memmachine_client-0.2.6/src/memmachine/common/rw_locks.py +0 -145
- memmachine_client-0.2.6/src/memmachine/common/session_manager/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/common/session_manager/session_data_manager.py +0 -84
- memmachine_client-0.2.6/src/memmachine/common/session_manager/session_data_manager_sql_impl.py +0 -357
- memmachine_client-0.2.6/src/memmachine/common/utils.py +0 -175
- memmachine_client-0.2.6/src/memmachine/common/vector_graph_store/__init__.py +0 -12
- memmachine_client-0.2.6/src/memmachine/common/vector_graph_store/data_types.py +0 -117
- memmachine_client-0.2.6/src/memmachine/common/vector_graph_store/neo4j_vector_graph_store.py +0 -1723
- memmachine_client-0.2.6/src/memmachine/common/vector_graph_store/vector_graph_store.py +0 -290
- memmachine_client-0.2.6/src/memmachine/episodic_memory/__init__.py +0 -7
- memmachine_client-0.2.6/src/memmachine/episodic_memory/declarative_memory/__init__.py +0 -14
- memmachine_client-0.2.6/src/memmachine/episodic_memory/declarative_memory/data_types.py +0 -99
- memmachine_client-0.2.6/src/memmachine/episodic_memory/declarative_memory/declarative_memory.py +0 -763
- memmachine_client-0.2.6/src/memmachine/episodic_memory/episodic_memory.py +0 -483
- memmachine_client-0.2.6/src/memmachine/episodic_memory/episodic_memory_manager.py +0 -361
- memmachine_client-0.2.6/src/memmachine/episodic_memory/instance_lru_cache.py +0 -236
- memmachine_client-0.2.6/src/memmachine/episodic_memory/long_term_memory/__init__.py +0 -8
- memmachine_client-0.2.6/src/memmachine/episodic_memory/long_term_memory/long_term_memory.py +0 -366
- memmachine_client-0.2.6/src/memmachine/episodic_memory/long_term_memory/service_locator.py +0 -27
- memmachine_client-0.2.6/src/memmachine/episodic_memory/service_locator.py +0 -50
- memmachine_client-0.2.6/src/memmachine/episodic_memory/short_term_memory/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/episodic_memory/short_term_memory/service_locator.py +0 -26
- memmachine_client-0.2.6/src/memmachine/episodic_memory/short_term_memory/short_term_memory.py +0 -648
- memmachine_client-0.2.6/src/memmachine/installation/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/installation/configuration_wizard.py +0 -384
- memmachine_client-0.2.6/src/memmachine/installation/memmachine_configure.py +0 -448
- memmachine_client-0.2.6/src/memmachine/installation/utilities.py +0 -88
- memmachine_client-0.2.6/src/memmachine/main/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/main/memmachine.py +0 -546
- memmachine_client-0.2.6/src/memmachine/rest_client/memory.py +0 -705
- memmachine_client-0.2.6/src/memmachine/semantic_memory/__init__.py +0 -3
- memmachine_client-0.2.6/src/memmachine/semantic_memory/semantic_ingestion.py +0 -363
- memmachine_client-0.2.6/src/memmachine/semantic_memory/semantic_llm.py +0 -114
- memmachine_client-0.2.6/src/memmachine/semantic_memory/semantic_memory.py +0 -286
- memmachine_client-0.2.6/src/memmachine/semantic_memory/semantic_model.py +0 -145
- memmachine_client-0.2.6/src/memmachine/semantic_memory/semantic_session_manager.py +0 -322
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/env.py +0 -117
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/script.py.mako +0 -28
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/versions/001_initial_migration.py +0 -89
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/versions/3d6aaebdc526_sync_sqlalchemy_schema.py +0 -372
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/versions/62dff1150a46_add_created_at_to_history_add.py +0 -37
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/versions/79f00a9f2409_change_history_id_to_string.py +0 -59
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/versions/843f6d216d10_rename_semantic_type_to_semantic_.py +0 -254
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/versions/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/alembic_pg/versions/adb5618bd4ee_remove_history_table.py +0 -77
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/neo4j_semantic_storage.py +0 -1341
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/sqlalchemy_pgvector_semantic.py +0 -759
- memmachine_client-0.2.6/src/memmachine/semantic_memory/storage/storage_base.py +0 -180
- memmachine_client-0.2.6/src/memmachine/semantic_memory/util/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/semantic_memory/util/semantic_prompt_template.py +0 -216
- memmachine_client-0.2.6/src/memmachine/server/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/server/api_v2/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/server/api_v2/config_router.py +0 -242
- memmachine_client-0.2.6/src/memmachine/server/api_v2/config_service.py +0 -508
- memmachine_client-0.2.6/src/memmachine/server/api_v2/exceptions.py +0 -108
- memmachine_client-0.2.6/src/memmachine/server/api_v2/mcp.py +0 -572
- memmachine_client-0.2.6/src/memmachine/server/api_v2/router.py +0 -310
- memmachine_client-0.2.6/src/memmachine/server/api_v2/service.py +0 -174
- memmachine_client-0.2.6/src/memmachine/server/app.py +0 -200
- memmachine_client-0.2.6/src/memmachine/server/mcp_http.py +0 -79
- memmachine_client-0.2.6/src/memmachine/server/mcp_stdio.py +0 -35
- memmachine_client-0.2.6/src/memmachine/server/middleware.py +0 -91
- memmachine_client-0.2.6/src/memmachine/server/prompt/__init__.py +0 -1
- memmachine_client-0.2.6/src/memmachine/server/prompt/coding_style_prompt.py +0 -49
- memmachine_client-0.2.6/src/memmachine/server/prompt/crm_prompt.py +0 -562
- memmachine_client-0.2.6/src/memmachine/server/prompt/default_prompts.py +0 -24
- memmachine_client-0.2.6/src/memmachine/server/prompt/financial_analyst_prompt.py +0 -532
- memmachine_client-0.2.6/src/memmachine/server/prompt/health_assistant_prompt.py +0 -393
- memmachine_client-0.2.6/src/memmachine/server/prompt/profile_prompt.py +0 -56
- memmachine_client-0.2.6/src/memmachine/server/prompt/prompt_utilities.py +0 -19
- memmachine_client-0.2.6/src/memmachine/server/prompt/writing_assistant_prompt.py +0 -479
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/.gitignore +0 -30
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/.prettierignore +0 -18
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/.prettierrc +0 -15
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/README.md +0 -156
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/eslint.config.mjs +0 -19
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/jest.config.ts +0 -20
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/package-lock.json +0 -10073
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/package.json +0 -93
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/client/index.ts +0 -9
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/client/memmachine-client.ts +0 -118
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/client/memmachine-client.types.ts +0 -34
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/env.d.ts +0 -1
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/errors/api-error-handler.ts +0 -20
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/errors/index.ts +0 -8
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/errors/memmachine-api-error.ts +0 -14
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/index.ts +0 -13
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/memory/index.ts +0 -20
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/memory/memmachine-memory.ts +0 -315
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/memory/memmachine-memory.types.ts +0 -166
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/project/index.ts +0 -9
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/project/memmachine-project.ts +0 -167
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/project/memmachine-project.types.ts +0 -41
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/src/version.ts +0 -1
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/tests/api-error-handler.spec.ts +0 -36
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/tests/index.spec.ts +0 -11
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/tests/memmachine-client.spec.ts +0 -52
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/tests/memmachine-memory.spec.ts +0 -149
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/tests/memmachine-project.spec.ts +0 -101
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/tsconfig.json +0 -44
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/tsup.config.ts +0 -14
- memmachine_client-0.2.6/src/memmachine-ts/rest_client/typedoc.json +0 -4
- memmachine_client-0.2.6/src/memmachine_client.egg-info/PKG-INFO +0 -146
- memmachine_client-0.2.6/src/memmachine_client.egg-info/SOURCES.txt +0 -176
- memmachine_client-0.2.6/src/memmachine_client.egg-info/top_level.txt +0 -1
- {memmachine_client-0.2.6 → memmachine_client-0.3.2}/LICENSE +0 -0
- {memmachine_client-0.2.6 → memmachine_client-0.3.2}/setup.cfg +0 -0
- {memmachine_client-0.2.6/src/memmachine/rest_client → memmachine_client-0.3.2/src/memmachine_client}/__init__.py +0 -0
- {memmachine_client-0.2.6 → memmachine_client-0.3.2}/src/memmachine_client.egg-info/dependency_links.txt +0 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memmachine-client
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: MemMachine REST Client - A lightweight Python client library for MemMachine memory system
|
|
5
|
+
Author-email: MemMachine <noreply@memmachine.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/MemMachine/MemMachine
|
|
8
|
+
Project-URL: Issues, https://github.com/MemMachine/MemMachine/issues
|
|
9
|
+
Keywords: memmachine,client,memory,ai,agent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: memmachine-common
|
|
21
|
+
Requires-Dist: pydantic>=2.0.0
|
|
22
|
+
Requires-Dist: requests>=2.31.0
|
|
23
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
24
|
+
Requires-Dist: urllib3>=2.6.3
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# MemMachine Client
|
|
28
|
+
|
|
29
|
+
A Python client library for the MemMachine memory system.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Simple API**: Easy-to-use interface
|
|
34
|
+
- **Memory Management**: Add and search episodic and profile memories
|
|
35
|
+
- **Context Awareness**: Automatic context retrieval for better responses
|
|
36
|
+
- **Error Handling**: Robust error handling with retry mechanisms
|
|
37
|
+
- **Type Safety**: Full type hints for better development experience
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Install from source (for development)
|
|
43
|
+
pip install -e .
|
|
44
|
+
|
|
45
|
+
# Or install dependencies
|
|
46
|
+
pip install requests urllib3
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### Basic Usage
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from memmachine_client import MemMachineClient
|
|
55
|
+
|
|
56
|
+
# Initialize client
|
|
57
|
+
client = MemMachineClient(
|
|
58
|
+
base_url="http://localhost:8080",
|
|
59
|
+
timeout=30
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Create a memory instance
|
|
63
|
+
memory = client.memory(
|
|
64
|
+
group_id="my_group",
|
|
65
|
+
agent_id="my_agent",
|
|
66
|
+
user_id="user123",
|
|
67
|
+
session_id="session456"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Add memories
|
|
71
|
+
memory.add("I like pizza", metadata={"type": "preference"})
|
|
72
|
+
memory.add("I work as a software engineer", metadata={"type": "fact"})
|
|
73
|
+
|
|
74
|
+
# Search memories
|
|
75
|
+
results = memory.search("What do I like to eat?")
|
|
76
|
+
print(results)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## API Reference
|
|
80
|
+
|
|
81
|
+
### MemMachineClient
|
|
82
|
+
|
|
83
|
+
The main client class for interacting with MemMachine.
|
|
84
|
+
|
|
85
|
+
#### Constructor
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
MemMachineClient(
|
|
89
|
+
api_key: Optional[str] = None,
|
|
90
|
+
base_url: str = "http://localhost:8080",
|
|
91
|
+
timeout: int = 30,
|
|
92
|
+
max_retries: int = 3,
|
|
93
|
+
**kwargs
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### Methods
|
|
98
|
+
|
|
99
|
+
- `memory(group_id, agent_id, user_id, session_id)` - Create a Memory instance
|
|
100
|
+
- `health_check()` - Check server health
|
|
101
|
+
|
|
102
|
+
### Memory
|
|
103
|
+
|
|
104
|
+
Interface for managing episodic and profile memory.
|
|
105
|
+
|
|
106
|
+
#### Methods
|
|
107
|
+
|
|
108
|
+
- `add(content, producer, produced_for, episode_type, metadata)` - Add a memory
|
|
109
|
+
- `search(query, limit, filter_dict)` - Search memories
|
|
110
|
+
- `get_context()` - Get current context
|
|
111
|
+
|
|
112
|
+
## Examples
|
|
113
|
+
|
|
114
|
+
### Basic Memory Operations
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from memmachine_client import MemMachineClient
|
|
118
|
+
|
|
119
|
+
client = MemMachineClient(base_url="http://localhost:8080")
|
|
120
|
+
|
|
121
|
+
# Create memory instance
|
|
122
|
+
memory = client.memory(
|
|
123
|
+
group_id="demo_group",
|
|
124
|
+
agent_id="demo_agent",
|
|
125
|
+
user_id="user123",
|
|
126
|
+
session_id="demo_session"
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# Add memories with metadata
|
|
130
|
+
memory.add("I like pizza", metadata={"type": "preference", "category": "food"})
|
|
131
|
+
memory.add("I work as a software engineer", metadata={"type": "fact", "category": "work"})
|
|
132
|
+
|
|
133
|
+
# Search memories
|
|
134
|
+
results = memory.search("What do I like to eat?")
|
|
135
|
+
print(f"Episodic memory: {results.get('episodic_memory', [])}")
|
|
136
|
+
print(f"Profile memory: {results.get('profile_memory', [])}")
|
|
137
|
+
|
|
138
|
+
# Search with filters
|
|
139
|
+
work_results = memory.search("Tell me about work", filter_dict={"category": "work"})
|
|
140
|
+
print(f"Work results: {work_results}")
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Multiple Users
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from memmachine_client import MemMachineClient
|
|
147
|
+
|
|
148
|
+
client = MemMachineClient(base_url="http://localhost:8080")
|
|
149
|
+
|
|
150
|
+
# Create memory instances for multiple users
|
|
151
|
+
users = ["alice", "bob", "charlie"]
|
|
152
|
+
memories = {}
|
|
153
|
+
|
|
154
|
+
for user in users:
|
|
155
|
+
memories[user] = client.memory(
|
|
156
|
+
group_id="team_group",
|
|
157
|
+
agent_id="team_agent",
|
|
158
|
+
user_id=user
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
# Add user-specific memories
|
|
162
|
+
memories["alice"].add("I'm a frontend developer", metadata={"role": "frontend"})
|
|
163
|
+
memories["bob"].add("I'm a backend developer", metadata={"role": "backend"})
|
|
164
|
+
memories["charlie"].add("I'm a DevOps engineer", metadata={"role": "devops"})
|
|
165
|
+
|
|
166
|
+
# Search across users
|
|
167
|
+
for user, memory in memories.items():
|
|
168
|
+
results = memory.search("What is your role?")
|
|
169
|
+
print(f"{user}: {results}")
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Error Handling
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from memmachine_client import MemMachineClient
|
|
176
|
+
|
|
177
|
+
try:
|
|
178
|
+
client = MemMachineClient(base_url="http://localhost:8080")
|
|
179
|
+
|
|
180
|
+
# Check server health
|
|
181
|
+
health = client.health_check()
|
|
182
|
+
print(f"Server health: {health}")
|
|
183
|
+
|
|
184
|
+
# Create memory instance
|
|
185
|
+
memory = client.memory(
|
|
186
|
+
group_id="demo_group",
|
|
187
|
+
agent_id="demo_agent",
|
|
188
|
+
user_id="user123"
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# Add memory
|
|
192
|
+
memory.add("Test memory")
|
|
193
|
+
|
|
194
|
+
except Exception as e:
|
|
195
|
+
print(f"Error: {e}")
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Context Manager Usage
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
from memmachine_client import MemMachineClient
|
|
202
|
+
|
|
203
|
+
# Use client as context manager
|
|
204
|
+
with MemMachineClient(base_url="http://localhost:8080") as client:
|
|
205
|
+
memory = client.memory(
|
|
206
|
+
group_id="demo_group",
|
|
207
|
+
agent_id="demo_agent",
|
|
208
|
+
user_id="user123"
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
memory.add("This is a test memory")
|
|
212
|
+
results = memory.search("test")
|
|
213
|
+
print(f"Results: {results}")
|
|
214
|
+
|
|
215
|
+
# Client is automatically closed
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Configuration
|
|
219
|
+
|
|
220
|
+
### Environment Variables
|
|
221
|
+
|
|
222
|
+
- `MEMORY_BACKEND_URL`: Base URL for MemMachine server (default: http://localhost:8080)
|
|
223
|
+
- `MEMORY_API_KEY`: API key for authentication (optional for local development)
|
|
224
|
+
|
|
225
|
+
### Client Configuration
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
client = MemMachineClient(
|
|
229
|
+
api_key="your_api_key", # Optional
|
|
230
|
+
base_url="http://localhost:8080",
|
|
231
|
+
timeout=30, # Request timeout in seconds
|
|
232
|
+
max_retries=3 # Maximum retries for failed requests
|
|
233
|
+
)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
<!-- Comparison section removed: no external product references -->
|
|
237
|
+
|
|
238
|
+
## Running Examples
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Start MemMachine server first
|
|
242
|
+
python -m memmachine_server.server.app
|
|
243
|
+
|
|
244
|
+
# Run examples
|
|
245
|
+
python examples/memmachine_client_example.py
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Contributing
|
|
249
|
+
|
|
250
|
+
Contributions are welcome! Please feel free to submit issues and pull requests.
|
|
251
|
+
|
|
252
|
+
## License
|
|
253
|
+
|
|
254
|
+
This project is licensed under the same license as MemMachine.
|
|
@@ -25,7 +25,7 @@ pip install requests urllib3
|
|
|
25
25
|
### Basic Usage
|
|
26
26
|
|
|
27
27
|
```python
|
|
28
|
-
from
|
|
28
|
+
from memmachine_client import MemMachineClient
|
|
29
29
|
|
|
30
30
|
# Initialize client
|
|
31
31
|
client = MemMachineClient(
|
|
@@ -88,7 +88,7 @@ Interface for managing episodic and profile memory.
|
|
|
88
88
|
### Basic Memory Operations
|
|
89
89
|
|
|
90
90
|
```python
|
|
91
|
-
from
|
|
91
|
+
from memmachine_client import MemMachineClient
|
|
92
92
|
|
|
93
93
|
client = MemMachineClient(base_url="http://localhost:8080")
|
|
94
94
|
|
|
@@ -117,7 +117,7 @@ print(f"Work results: {work_results}")
|
|
|
117
117
|
### Multiple Users
|
|
118
118
|
|
|
119
119
|
```python
|
|
120
|
-
from
|
|
120
|
+
from memmachine_client import MemMachineClient
|
|
121
121
|
|
|
122
122
|
client = MemMachineClient(base_url="http://localhost:8080")
|
|
123
123
|
|
|
@@ -146,25 +146,25 @@ for user, memory in memories.items():
|
|
|
146
146
|
### Error Handling
|
|
147
147
|
|
|
148
148
|
```python
|
|
149
|
-
from
|
|
149
|
+
from memmachine_client import MemMachineClient
|
|
150
150
|
|
|
151
151
|
try:
|
|
152
152
|
client = MemMachineClient(base_url="http://localhost:8080")
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
# Check server health
|
|
155
155
|
health = client.health_check()
|
|
156
156
|
print(f"Server health: {health}")
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
# Create memory instance
|
|
159
159
|
memory = client.memory(
|
|
160
160
|
group_id="demo_group",
|
|
161
161
|
agent_id="demo_agent",
|
|
162
162
|
user_id="user123"
|
|
163
163
|
)
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
# Add memory
|
|
166
166
|
memory.add("Test memory")
|
|
167
|
-
|
|
167
|
+
|
|
168
168
|
except Exception as e:
|
|
169
169
|
print(f"Error: {e}")
|
|
170
170
|
```
|
|
@@ -172,7 +172,7 @@ except Exception as e:
|
|
|
172
172
|
### Context Manager Usage
|
|
173
173
|
|
|
174
174
|
```python
|
|
175
|
-
from
|
|
175
|
+
from memmachine_client import MemMachineClient
|
|
176
176
|
|
|
177
177
|
# Use client as context manager
|
|
178
178
|
with MemMachineClient(base_url="http://localhost:8080") as client:
|
|
@@ -181,7 +181,7 @@ with MemMachineClient(base_url="http://localhost:8080") as client:
|
|
|
181
181
|
agent_id="demo_agent",
|
|
182
182
|
user_id="user123"
|
|
183
183
|
)
|
|
184
|
-
|
|
184
|
+
|
|
185
185
|
memory.add("This is a test memory")
|
|
186
186
|
results = memory.search("test")
|
|
187
187
|
print(f"Results: {results}")
|
|
@@ -213,7 +213,7 @@ client = MemMachineClient(
|
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
215
|
# Start MemMachine server first
|
|
216
|
-
python -m
|
|
216
|
+
python -m memmachine_server.server.app
|
|
217
217
|
|
|
218
218
|
# Run examples
|
|
219
219
|
python examples/memmachine_client_example.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Unit tests for the MemMachine REST client."""
|