langchain-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.
Files changed (30) hide show
  1. langchain_goodmem-0.1.0/.github/workflows/release.yml +50 -0
  2. langchain_goodmem-0.1.0/.gitignore +36 -0
  3. langchain_goodmem-0.1.0/LICENSE +21 -0
  4. langchain_goodmem-0.1.0/Makefile +59 -0
  5. langchain_goodmem-0.1.0/PKG-INFO +134 -0
  6. langchain_goodmem-0.1.0/README.md +107 -0
  7. langchain_goodmem-0.1.0/examples/live_smoke_test.py +325 -0
  8. langchain_goodmem-0.1.0/langchain_goodmem/__init__.py +31 -0
  9. langchain_goodmem-0.1.0/langchain_goodmem/_client.py +687 -0
  10. langchain_goodmem-0.1.0/langchain_goodmem/py.typed +0 -0
  11. langchain_goodmem-0.1.0/langchain_goodmem/tools/__init__.py +27 -0
  12. langchain_goodmem-0.1.0/langchain_goodmem/tools/create_memory.py +129 -0
  13. langchain_goodmem-0.1.0/langchain_goodmem/tools/create_space.py +126 -0
  14. langchain_goodmem-0.1.0/langchain_goodmem/tools/delete_memory.py +82 -0
  15. langchain_goodmem-0.1.0/langchain_goodmem/tools/delete_space.py +83 -0
  16. langchain_goodmem-0.1.0/langchain_goodmem/tools/get_memory.py +102 -0
  17. langchain_goodmem-0.1.0/langchain_goodmem/tools/get_space.py +83 -0
  18. langchain_goodmem-0.1.0/langchain_goodmem/tools/list_embedders.py +87 -0
  19. langchain_goodmem-0.1.0/langchain_goodmem/tools/list_memories.py +134 -0
  20. langchain_goodmem-0.1.0/langchain_goodmem/tools/list_spaces.py +87 -0
  21. langchain_goodmem-0.1.0/langchain_goodmem/tools/retrieve_memories.py +207 -0
  22. langchain_goodmem-0.1.0/langchain_goodmem/tools/update_space.py +129 -0
  23. langchain_goodmem-0.1.0/pyproject.toml +107 -0
  24. langchain_goodmem-0.1.0/tests/__init__.py +0 -0
  25. langchain_goodmem-0.1.0/tests/integration_tests/__init__.py +0 -0
  26. langchain_goodmem-0.1.0/tests/integration_tests/test_goodmem_integration.py +181 -0
  27. langchain_goodmem-0.1.0/tests/unit_tests/__init__.py +0 -0
  28. langchain_goodmem-0.1.0/tests/unit_tests/test_imports.py +31 -0
  29. langchain_goodmem-0.1.0/tests/unit_tests/test_tools.py +149 -0
  30. langchain_goodmem-0.1.0/uv.lock +1292 -0
@@ -0,0 +1,50 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+ name: Build distribution
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v3
21
+ with:
22
+ python-version: "3.10"
23
+
24
+ - name: Build sdist + wheel
25
+ run: uv build
26
+
27
+ - name: Upload artifacts
28
+ uses: actions/upload-artifact@v4
29
+ with:
30
+ name: dist
31
+ path: dist/
32
+
33
+ publish:
34
+ name: Publish to PyPI
35
+ needs: build
36
+ runs-on: ubuntu-latest
37
+ environment:
38
+ name: pypi
39
+ url: https://pypi.org/p/langchain-goodmem
40
+ permissions:
41
+ id-token: write
42
+ steps:
43
+ - name: Download artifacts
44
+ uses: actions/download-artifact@v4
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+
49
+ - name: Publish to PyPI via Trusted Publishing
50
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,36 @@
1
+ # Build artifacts
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+ *.egg
6
+
7
+ # Python bytecode
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Tooling caches
18
+ .mypy_cache/
19
+ .pytest_cache/
20
+ .ruff_cache/
21
+ .tox/
22
+ .coverage
23
+ .coverage.*
24
+ htmlcov/
25
+ coverage.xml
26
+
27
+ # Editor / OS
28
+ .idea/
29
+ .vscode/
30
+ .DS_Store
31
+ *.swp
32
+ *~
33
+
34
+ # Environment files
35
+ .env
36
+ .env.local
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LangChain, Inc.
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,59 @@
1
+ .PHONY: all format lint type test tests integration_tests help
2
+
3
+ # Default target executed when no arguments are given to make.
4
+ all: help
5
+
6
+ .EXPORT_ALL_VARIABLES:
7
+ UV_FROZEN = true
8
+
9
+ # Define a variable for the test file path.
10
+ TEST_FILE ?= tests/unit_tests/
11
+
12
+ integration_test integration_tests: TEST_FILE=tests/integration_tests/
13
+
14
+ test tests:
15
+ uv run --group test pytest --disable-socket --allow-unix-socket $(TEST_FILE)
16
+
17
+ integration_test integration_tests:
18
+ uv run --group test pytest $(TEST_FILE)
19
+
20
+ test_watch:
21
+ uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)
22
+
23
+ ######################
24
+ # LINTING AND FORMATTING
25
+ ######################
26
+
27
+ # Define a variable for Python and notebook files.
28
+ PYTHON_FILES=.
29
+ MYPY_CACHE=.mypy_cache
30
+ lint format: PYTHON_FILES=.
31
+ lint_diff format_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$|\.ipynb$$')
32
+ lint_package: PYTHON_FILES=langchain_goodmem
33
+ lint_tests: PYTHON_FILES=tests
34
+ lint_tests: MYPY_CACHE=.mypy_cache_test
35
+
36
+ lint lint_diff lint_package lint_tests:
37
+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check $(PYTHON_FILES)
38
+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES) --diff
39
+ [ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && uv run --all-groups mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)
40
+
41
+ type:
42
+ mkdir -p $(MYPY_CACHE) && uv run --all-groups mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)
43
+
44
+ format format_diff:
45
+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)
46
+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)
47
+
48
+ ######################
49
+ # HELP
50
+ ######################
51
+
52
+ help:
53
+ @echo '----'
54
+ @echo 'format - run code formatters'
55
+ @echo 'lint - run linters'
56
+ @echo 'type - run type checking'
57
+ @echo 'test - run unit tests'
58
+ @echo 'tests - run unit tests'
59
+ @echo 'test TEST_FILE=<test_file> - run all tests in file'
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: langchain-goodmem
3
+ Version: 0.1.0
4
+ Summary: LangChain integration for GoodMem: long-term agent memory with semantic storage and retrieval.
5
+ Project-URL: Homepage, https://github.com/PAIR-Systems-Inc/goodmem-langchain
6
+ Project-URL: Repository, https://github.com/PAIR-Systems-Inc/goodmem-langchain
7
+ Project-URL: Documentation, https://goodmem.ai/docs
8
+ Project-URL: Issues, https://github.com/PAIR-Systems-Inc/goodmem-langchain/issues
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agents,goodmem,langchain,llm,memory,semantic-search,vector-search
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: <4.0.0,>=3.10.0
23
+ Requires-Dist: httpx<1.0.0,>=0.27.0
24
+ Requires-Dist: langchain-core<2.0.0,>=1.0.0
25
+ Requires-Dist: pydantic<3.0.0,>=2.7.4
26
+ Description-Content-Type: text/markdown
27
+
28
+ # langchain-goodmem
29
+
30
+ [![PyPI](https://img.shields.io/pypi/v/langchain-goodmem.svg)](https://pypi.org/project/langchain-goodmem/)
31
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
32
+
33
+ LangChain integration for [GoodMem](https://goodmem.ai) — long-term agent memory with semantic storage and retrieval.
34
+
35
+ GoodMem is a memory layer for AI agents that handles embedding, vector search, reranking, and LLM-powered answering server-side. This package exposes GoodMem operations as LangChain `BaseTool`s that can be wired into any LangChain agent or chain.
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ pip install langchain-goodmem
41
+ ```
42
+
43
+ Requires Python 3.10+.
44
+
45
+ ## Tools
46
+
47
+ | Tool | Description |
48
+ |---|---|
49
+ | `GoodMemListEmbedders` | List available embedder models |
50
+ | `GoodMemListSpaces` | List all spaces in your account |
51
+ | `GoodMemGetSpace` | Fetch a single space by ID |
52
+ | `GoodMemCreateSpace` | Create a new space or reuse an existing one |
53
+ | `GoodMemUpdateSpace` | Update name / public-read / labels on a space |
54
+ | `GoodMemDeleteSpace` | Delete a space (cascades to its memories) |
55
+ | `GoodMemCreateMemory` | Store text or files as memories |
56
+ | `GoodMemListMemories` | Paginate memories within a space |
57
+ | `GoodMemRetrieveMemories` | Semantic search with optional reranker / LLM summary |
58
+ | `GoodMemGetMemory` | Fetch a specific memory by ID |
59
+ | `GoodMemDeleteMemory` | Permanently delete a memory |
60
+
61
+ ## Quick start
62
+
63
+ ```python
64
+ from langchain_goodmem import (
65
+ GoodMemCreateSpace,
66
+ GoodMemCreateMemory,
67
+ GoodMemRetrieveMemories,
68
+ )
69
+
70
+ goodmem_kwargs = {
71
+ "goodmem_base_url": "http://localhost:8080",
72
+ "goodmem_api_key": "your-api-key",
73
+ }
74
+
75
+ tools = [
76
+ GoodMemCreateSpace(**goodmem_kwargs),
77
+ GoodMemCreateMemory(**goodmem_kwargs),
78
+ GoodMemRetrieveMemories(**goodmem_kwargs),
79
+ ]
80
+ ```
81
+
82
+ ## Use with a LangChain agent
83
+
84
+ ```python
85
+ from langchain.chat_models import init_chat_model
86
+ from langchain.agents import create_agent
87
+
88
+ llm = init_chat_model("openai:gpt-4o")
89
+ agent = create_agent(llm, tools)
90
+
91
+ response = agent.invoke({"messages": [{"role": "user", "content": "Save this fact and recall it later."}]})
92
+ ```
93
+
94
+ ## Retrieve with reranking and LLM summary
95
+
96
+ `GoodMemRetrieveMemories` exposes the full server-side post-processor. Set any of these fields to enable reranking, threshold filtering, chronological re-sort, or an LLM-generated `abstractReply` summary:
97
+
98
+ ```python
99
+ result = retrieve.invoke({
100
+ "query": "Which framework develops applications with language models?",
101
+ "space_ids": "space-uuid-1,space-uuid-2",
102
+ "max_results": 5,
103
+ "reranker_id": "reranker-uuid",
104
+ "llm_id": "llm-uuid",
105
+ "llm_temperature": 0.2,
106
+ "relevance_threshold": 0.1,
107
+ "chronological_resort": False,
108
+ })
109
+ ```
110
+
111
+ Leave them all unset for plain semantic search.
112
+
113
+ ## Environment variables
114
+
115
+ | Variable | Description |
116
+ |---|---|
117
+ | `GOODMEM_BASE_URL` | Base URL of the GoodMem API server |
118
+ | `GOODMEM_API_KEY` | API key for authentication |
119
+ | `GOODMEM_VERIFY_SSL` | Set to `false` to skip TLS verification for self-signed dev certs (default: `true`) |
120
+
121
+ ## Examples
122
+
123
+ A live end-to-end smoke test exercising every tool and every post-processor knob is in [examples/live_smoke_test.py](examples/live_smoke_test.py).
124
+
125
+ ```bash
126
+ export GOODMEM_BASE_URL=https://localhost:8080
127
+ export GOODMEM_API_KEY=...
128
+ export GOODMEM_VERIFY_SSL=false
129
+ python examples/live_smoke_test.py
130
+ ```
131
+
132
+ ## License
133
+
134
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,107 @@
1
+ # langchain-goodmem
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/langchain-goodmem.svg)](https://pypi.org/project/langchain-goodmem/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+
6
+ LangChain integration for [GoodMem](https://goodmem.ai) — long-term agent memory with semantic storage and retrieval.
7
+
8
+ GoodMem is a memory layer for AI agents that handles embedding, vector search, reranking, and LLM-powered answering server-side. This package exposes GoodMem operations as LangChain `BaseTool`s that can be wired into any LangChain agent or chain.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install langchain-goodmem
14
+ ```
15
+
16
+ Requires Python 3.10+.
17
+
18
+ ## Tools
19
+
20
+ | Tool | Description |
21
+ |---|---|
22
+ | `GoodMemListEmbedders` | List available embedder models |
23
+ | `GoodMemListSpaces` | List all spaces in your account |
24
+ | `GoodMemGetSpace` | Fetch a single space by ID |
25
+ | `GoodMemCreateSpace` | Create a new space or reuse an existing one |
26
+ | `GoodMemUpdateSpace` | Update name / public-read / labels on a space |
27
+ | `GoodMemDeleteSpace` | Delete a space (cascades to its memories) |
28
+ | `GoodMemCreateMemory` | Store text or files as memories |
29
+ | `GoodMemListMemories` | Paginate memories within a space |
30
+ | `GoodMemRetrieveMemories` | Semantic search with optional reranker / LLM summary |
31
+ | `GoodMemGetMemory` | Fetch a specific memory by ID |
32
+ | `GoodMemDeleteMemory` | Permanently delete a memory |
33
+
34
+ ## Quick start
35
+
36
+ ```python
37
+ from langchain_goodmem import (
38
+ GoodMemCreateSpace,
39
+ GoodMemCreateMemory,
40
+ GoodMemRetrieveMemories,
41
+ )
42
+
43
+ goodmem_kwargs = {
44
+ "goodmem_base_url": "http://localhost:8080",
45
+ "goodmem_api_key": "your-api-key",
46
+ }
47
+
48
+ tools = [
49
+ GoodMemCreateSpace(**goodmem_kwargs),
50
+ GoodMemCreateMemory(**goodmem_kwargs),
51
+ GoodMemRetrieveMemories(**goodmem_kwargs),
52
+ ]
53
+ ```
54
+
55
+ ## Use with a LangChain agent
56
+
57
+ ```python
58
+ from langchain.chat_models import init_chat_model
59
+ from langchain.agents import create_agent
60
+
61
+ llm = init_chat_model("openai:gpt-4o")
62
+ agent = create_agent(llm, tools)
63
+
64
+ response = agent.invoke({"messages": [{"role": "user", "content": "Save this fact and recall it later."}]})
65
+ ```
66
+
67
+ ## Retrieve with reranking and LLM summary
68
+
69
+ `GoodMemRetrieveMemories` exposes the full server-side post-processor. Set any of these fields to enable reranking, threshold filtering, chronological re-sort, or an LLM-generated `abstractReply` summary:
70
+
71
+ ```python
72
+ result = retrieve.invoke({
73
+ "query": "Which framework develops applications with language models?",
74
+ "space_ids": "space-uuid-1,space-uuid-2",
75
+ "max_results": 5,
76
+ "reranker_id": "reranker-uuid",
77
+ "llm_id": "llm-uuid",
78
+ "llm_temperature": 0.2,
79
+ "relevance_threshold": 0.1,
80
+ "chronological_resort": False,
81
+ })
82
+ ```
83
+
84
+ Leave them all unset for plain semantic search.
85
+
86
+ ## Environment variables
87
+
88
+ | Variable | Description |
89
+ |---|---|
90
+ | `GOODMEM_BASE_URL` | Base URL of the GoodMem API server |
91
+ | `GOODMEM_API_KEY` | API key for authentication |
92
+ | `GOODMEM_VERIFY_SSL` | Set to `false` to skip TLS verification for self-signed dev certs (default: `true`) |
93
+
94
+ ## Examples
95
+
96
+ A live end-to-end smoke test exercising every tool and every post-processor knob is in [examples/live_smoke_test.py](examples/live_smoke_test.py).
97
+
98
+ ```bash
99
+ export GOODMEM_BASE_URL=https://localhost:8080
100
+ export GOODMEM_API_KEY=...
101
+ export GOODMEM_VERIFY_SSL=false
102
+ python examples/live_smoke_test.py
103
+ ```
104
+
105
+ ## License
106
+
107
+ MIT — see [LICENSE](LICENSE).