llamaindex-goodmem 0.1.0__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.
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .venv-*/
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .coverage
12
+ htmlcov/
13
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bashareid
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: llamaindex-goodmem
3
+ Version: 0.1.0
4
+ Summary: LlamaIndex tools integration for GoodMem: long-term agent memory.
5
+ Author: bashareid
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: agents,goodmem,llama-index,llm,memory,semantic-search,vector-search
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: <4.0,>=3.10
20
+ Requires-Dist: httpx>=0.24.0
21
+ Requires-Dist: llama-index-core<0.15,>=0.13.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest-asyncio>=1.0.0; extra == 'dev'
24
+ Requires-Dist: pytest-mock>=3.0.0; extra == 'dev'
25
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # llama-index-tools-goodmem
29
+
30
+ [GoodMem](https://goodmem.ai) is a server-side memory layer for AI agents with semantic storage, retrieval, and LLM-powered summarization. This package exposes GoodMem's API as a [LlamaIndex](https://docs.llamaindex.ai) `BaseToolSpec`, so any LlamaIndex agent can store, search, and manage long-term memories.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install llamaindex-goodmem
36
+ ```
37
+
38
+ The PyPI distribution is `llamaindex-goodmem`; the Python import path is `llama_index.tools.goodmem` (the `llama_index.*` namespace is shared with the LlamaIndex ecosystem).
39
+
40
+ For local development from this repo:
41
+
42
+ ```bash
43
+ pip install -e . # editable install
44
+ pip install -e ".[dev]" # editable install + test deps
45
+ ```
46
+
47
+ ## Quick start
48
+
49
+ ```python
50
+ from llama_index.tools.goodmem import GoodMemToolSpec
51
+
52
+ tool_spec = GoodMemToolSpec(
53
+ api_key="gm_xxx",
54
+ base_url="https://api.goodmem.ai",
55
+ verify_ssl=True, # set False for a self-signed dev cert
56
+ )
57
+
58
+ # Use with a LlamaIndex agent
59
+ tools = tool_spec.to_tool_list()
60
+ ```
61
+
62
+ ### Constructor parameters
63
+
64
+ | Parameter | Type | Required | Description |
65
+ |--------------|-------|----------|----------------------------------------------------------|
66
+ | `api_key` | str | yes | GoodMem API key (sent as `X-API-Key`) |
67
+ | `base_url` | str | yes | Base URL of your GoodMem server |
68
+ | `verify_ssl` | bool | no | Verify TLS certificates. Default `True`. |
69
+ | `timeout` | float | no | Per-request timeout in seconds. Default `120` (LLM-summary retrievals can take tens of seconds). |
70
+
71
+ ## Tools
72
+
73
+ The tool spec exposes 11 sync/async tool pairs. The names below are the sync entry points; each has an async counterpart prefixed with `a` (e.g. `aretrieve_memories`).
74
+
75
+ | Tool | Purpose |
76
+ |----------------------|-------------------------------------------------------------------------|
77
+ | `list_embedders` | List server-managed embedder models. |
78
+ | `list_spaces` | List spaces. |
79
+ | `get_space` | Fetch one space by ID. |
80
+ | `create_space` | Create a new space (or reuse one with the same name). |
81
+ | `update_space` | Rename a space, toggle `publicRead`, or merge/replace labels. |
82
+ | `delete_space` | Delete a space (cascades to its memories). |
83
+ | `create_memory` | Store a text or file payload as a memory. |
84
+ | `list_memories` | Paginate memories in a space (with optional status / metadata filters). |
85
+ | `retrieve_memories` | Semantic search; optional rerank, threshold, LLM summary, chrono-resort. |
86
+ | `get_memory` | Fetch one memory and (optionally) its original content. |
87
+ | `delete_memory` | Delete a memory. |
88
+
89
+ `retrieve_memories` returns `List[llama_index.core.schema.Document]`. Each `Document.text` is a matched chunk; `Document.metadata` includes `chunkId`, `memoryId`, `relevanceScore`, `resultSetId`, `query`, plus `abstractReply` if an `llm_id` was passed.
90
+
91
+ ### Post-processor knobs (`retrieve_memories`)
92
+
93
+ | Argument | Type | Notes |
94
+ |-------------------------|-----------------|----------------------------------------------------------------|
95
+ | `reranker_id` | UUID | Reranks results by direct query–chunk scoring. |
96
+ | `llm_id` | UUID | Generates an `abstractReply` summary across the result set. |
97
+ | `relevance_threshold` | float `0..1` | Drops results below this score. |
98
+ | `llm_temperature` | float `0..2` | LLM creativity (sent on the wire as `llm_temp`). |
99
+ | `chronological_resort` | bool | Re-sort the post-processor output by creation time. |
100
+
101
+ ## Examples
102
+
103
+ ```python
104
+ # Create a space
105
+ space = tool_spec.create_space(name="my-research", embedder_id="<uuid>")
106
+
107
+ # Add memories
108
+ tool_spec.create_memory(space_id=space["spaceId"], text_content="...")
109
+ tool_spec.create_memory(space_id=space["spaceId"], file_path="/path/to/doc.pdf")
110
+
111
+ # Search
112
+ docs = tool_spec.retrieve_memories(
113
+ query="What's the conclusion?",
114
+ space_ids=[space["spaceId"]],
115
+ max_results=5,
116
+ llm_id="<llm-uuid>",
117
+ llm_temperature=0.2,
118
+ )
119
+ for d in docs:
120
+ print(d.metadata["relevanceScore"], d.text[:120])
121
+
122
+ # LLM summary (when llm_id is set)
123
+ print(docs[0].metadata["abstractReply"]["text"])
124
+ ```
125
+
126
+ ## Use inside a LlamaIndex agent
127
+
128
+ ```python
129
+ from llama_index.tools.goodmem import GoodMemToolSpec
130
+ from llama_index.core.agent import ReActAgent
131
+ from llama_index.llms.openai import OpenAI
132
+
133
+ tool_spec = GoodMemToolSpec(api_key="gm_xxx", base_url="https://api.goodmem.ai")
134
+ agent = ReActAgent.from_tools(tool_spec.to_tool_list(), llm=OpenAI(model="gpt-4o-mini"))
135
+
136
+ response = agent.chat("Remember that the project deadline is May 14.")
137
+ ```
138
+
139
+ ## Testing
140
+
141
+ ### Unit tests (no live server)
142
+
143
+ ```bash
144
+ pip install -e ".[dev]"
145
+ pytest tests/test_tools_goodmem.py -v
146
+ ```
147
+
148
+ ### Live e2e smoke test
149
+
150
+ Exercises every one of the 11 tools and every post-processor knob against a running GoodMem server. Mirrors the §7 smoke-test plan in the GoodMem build guide.
151
+
152
+ ```bash
153
+ GOODMEM_API_KEY=gm_xxx \
154
+ GOODMEM_BASE_URL=https://localhost:8080 \
155
+ GOODMEM_EMBEDDER_ID=<embedder-uuid> \
156
+ GOODMEM_RERANKER_ID=<reranker-uuid> \
157
+ GOODMEM_LLM_ID=<llm-uuid> \
158
+ GOODMEM_VERIFY_SSL=false \
159
+ pytest tests/test_tools_goodmem_e2e.py -v
160
+ ```
161
+
162
+ `GOODMEM_RERANKER_ID` and `GOODMEM_LLM_ID` are optional — the variants that need them are auto-skipped if unset. The full 18-step smoke test passes when all three are configured.
163
+
164
+ ## License
165
+
166
+ MIT
@@ -0,0 +1,139 @@
1
+ # llama-index-tools-goodmem
2
+
3
+ [GoodMem](https://goodmem.ai) is a server-side memory layer for AI agents with semantic storage, retrieval, and LLM-powered summarization. This package exposes GoodMem's API as a [LlamaIndex](https://docs.llamaindex.ai) `BaseToolSpec`, so any LlamaIndex agent can store, search, and manage long-term memories.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install llamaindex-goodmem
9
+ ```
10
+
11
+ The PyPI distribution is `llamaindex-goodmem`; the Python import path is `llama_index.tools.goodmem` (the `llama_index.*` namespace is shared with the LlamaIndex ecosystem).
12
+
13
+ For local development from this repo:
14
+
15
+ ```bash
16
+ pip install -e . # editable install
17
+ pip install -e ".[dev]" # editable install + test deps
18
+ ```
19
+
20
+ ## Quick start
21
+
22
+ ```python
23
+ from llama_index.tools.goodmem import GoodMemToolSpec
24
+
25
+ tool_spec = GoodMemToolSpec(
26
+ api_key="gm_xxx",
27
+ base_url="https://api.goodmem.ai",
28
+ verify_ssl=True, # set False for a self-signed dev cert
29
+ )
30
+
31
+ # Use with a LlamaIndex agent
32
+ tools = tool_spec.to_tool_list()
33
+ ```
34
+
35
+ ### Constructor parameters
36
+
37
+ | Parameter | Type | Required | Description |
38
+ |--------------|-------|----------|----------------------------------------------------------|
39
+ | `api_key` | str | yes | GoodMem API key (sent as `X-API-Key`) |
40
+ | `base_url` | str | yes | Base URL of your GoodMem server |
41
+ | `verify_ssl` | bool | no | Verify TLS certificates. Default `True`. |
42
+ | `timeout` | float | no | Per-request timeout in seconds. Default `120` (LLM-summary retrievals can take tens of seconds). |
43
+
44
+ ## Tools
45
+
46
+ The tool spec exposes 11 sync/async tool pairs. The names below are the sync entry points; each has an async counterpart prefixed with `a` (e.g. `aretrieve_memories`).
47
+
48
+ | Tool | Purpose |
49
+ |----------------------|-------------------------------------------------------------------------|
50
+ | `list_embedders` | List server-managed embedder models. |
51
+ | `list_spaces` | List spaces. |
52
+ | `get_space` | Fetch one space by ID. |
53
+ | `create_space` | Create a new space (or reuse one with the same name). |
54
+ | `update_space` | Rename a space, toggle `publicRead`, or merge/replace labels. |
55
+ | `delete_space` | Delete a space (cascades to its memories). |
56
+ | `create_memory` | Store a text or file payload as a memory. |
57
+ | `list_memories` | Paginate memories in a space (with optional status / metadata filters). |
58
+ | `retrieve_memories` | Semantic search; optional rerank, threshold, LLM summary, chrono-resort. |
59
+ | `get_memory` | Fetch one memory and (optionally) its original content. |
60
+ | `delete_memory` | Delete a memory. |
61
+
62
+ `retrieve_memories` returns `List[llama_index.core.schema.Document]`. Each `Document.text` is a matched chunk; `Document.metadata` includes `chunkId`, `memoryId`, `relevanceScore`, `resultSetId`, `query`, plus `abstractReply` if an `llm_id` was passed.
63
+
64
+ ### Post-processor knobs (`retrieve_memories`)
65
+
66
+ | Argument | Type | Notes |
67
+ |-------------------------|-----------------|----------------------------------------------------------------|
68
+ | `reranker_id` | UUID | Reranks results by direct query–chunk scoring. |
69
+ | `llm_id` | UUID | Generates an `abstractReply` summary across the result set. |
70
+ | `relevance_threshold` | float `0..1` | Drops results below this score. |
71
+ | `llm_temperature` | float `0..2` | LLM creativity (sent on the wire as `llm_temp`). |
72
+ | `chronological_resort` | bool | Re-sort the post-processor output by creation time. |
73
+
74
+ ## Examples
75
+
76
+ ```python
77
+ # Create a space
78
+ space = tool_spec.create_space(name="my-research", embedder_id="<uuid>")
79
+
80
+ # Add memories
81
+ tool_spec.create_memory(space_id=space["spaceId"], text_content="...")
82
+ tool_spec.create_memory(space_id=space["spaceId"], file_path="/path/to/doc.pdf")
83
+
84
+ # Search
85
+ docs = tool_spec.retrieve_memories(
86
+ query="What's the conclusion?",
87
+ space_ids=[space["spaceId"]],
88
+ max_results=5,
89
+ llm_id="<llm-uuid>",
90
+ llm_temperature=0.2,
91
+ )
92
+ for d in docs:
93
+ print(d.metadata["relevanceScore"], d.text[:120])
94
+
95
+ # LLM summary (when llm_id is set)
96
+ print(docs[0].metadata["abstractReply"]["text"])
97
+ ```
98
+
99
+ ## Use inside a LlamaIndex agent
100
+
101
+ ```python
102
+ from llama_index.tools.goodmem import GoodMemToolSpec
103
+ from llama_index.core.agent import ReActAgent
104
+ from llama_index.llms.openai import OpenAI
105
+
106
+ tool_spec = GoodMemToolSpec(api_key="gm_xxx", base_url="https://api.goodmem.ai")
107
+ agent = ReActAgent.from_tools(tool_spec.to_tool_list(), llm=OpenAI(model="gpt-4o-mini"))
108
+
109
+ response = agent.chat("Remember that the project deadline is May 14.")
110
+ ```
111
+
112
+ ## Testing
113
+
114
+ ### Unit tests (no live server)
115
+
116
+ ```bash
117
+ pip install -e ".[dev]"
118
+ pytest tests/test_tools_goodmem.py -v
119
+ ```
120
+
121
+ ### Live e2e smoke test
122
+
123
+ Exercises every one of the 11 tools and every post-processor knob against a running GoodMem server. Mirrors the §7 smoke-test plan in the GoodMem build guide.
124
+
125
+ ```bash
126
+ GOODMEM_API_KEY=gm_xxx \
127
+ GOODMEM_BASE_URL=https://localhost:8080 \
128
+ GOODMEM_EMBEDDER_ID=<embedder-uuid> \
129
+ GOODMEM_RERANKER_ID=<reranker-uuid> \
130
+ GOODMEM_LLM_ID=<llm-uuid> \
131
+ GOODMEM_VERIFY_SSL=false \
132
+ pytest tests/test_tools_goodmem_e2e.py -v
133
+ ```
134
+
135
+ `GOODMEM_RERANKER_ID` and `GOODMEM_LLM_ID` are optional — the variants that need them are auto-skipped if unset. The full 18-step smoke test passes when all three are configured.
136
+
137
+ ## License
138
+
139
+ MIT
@@ -0,0 +1,5 @@
1
+ """GoodMem tool integration for LlamaIndex."""
2
+
3
+ from llama_index.tools.goodmem.base import GoodMemToolSpec
4
+
5
+ __all__ = ["GoodMemToolSpec"]