Microsoft NLWeb
Expose the GoodMem RAG API as NLWeb-style operation classes for any NLWeb handler or tool dispatcher.
Overview
GoodMem is a memory layer for AI agents that handles embedding, vector search, reranking, and
LLM-powered answering server-side. The NLWeb integration wraps those operations — creating spaces,
storing memories, and semantic retrieval with optional reranking and LLM summaries — as NLWeb-style
operation classes. Each operation exposes a run(...) method that returns a JSON string, so the
classes can be called from any NLWeb handler or tool dispatcher.
Installation
pip install nlweb-goodmemThe pip package is nlweb-goodmem; the import name is nlweb_goodmem.
Configuration
| Variable | Description |
|---|---|
GOODMEM_BASE_URL | Base URL of the GoodMem API server, e.g. https://your-goodmem-server.example.com. |
GOODMEM_API_KEY | API key sent as the X-API-Key header to authenticate requests. |
GOODMEM_VERIFY_SSL | Set to false to skip TLS verification for self-signed dev certs (default: true). |
When the environment variables are set, every operation constructor can be called with no arguments.
Quick start
import json
import os
os.environ["GOODMEM_BASE_URL"] = "https://your-goodmem-server.example.com"
os.environ["GOODMEM_API_KEY"] = "gm_xxxxxxxxxxxxxxxxxxxxxxxx"
os.environ["GOODMEM_VERIFY_SSL"] = "false" # self-signed local server
from nlweb_goodmem import (
GoodMemCreateMemory,
GoodMemCreateSpace,
GoodMemListEmbedders,
GoodMemRetrieveMemories,
)
embedders = json.loads(GoodMemListEmbedders().run())
embedder_id = embedders["embedders"][0]["embedderId"]
space = json.loads(
GoodMemCreateSpace().run(name="quickstart", embedder_id=embedder_id)
)
space_id = space["spaceId"]
GoodMemCreateMemory().run(
space_id=space_id,
text_content="The capital of France is Paris.",
)
results = json.loads(
GoodMemRetrieveMemories().run(
query="What is the capital of France?",
space_ids=space_id,
max_results=3,
)
)
print(results)Local development. The example above uses a TLS-verified production URL. If you are running
GoodMem locally with a self-signed certificate, use https://localhost:8080 and disable TLS
verification with the client's verify-SSL option (see the Configuration table above). Keep TLS
verification enabled for any deployed server.
Retrieval post-processing
GoodMem's retrieval call accepts these optional post-processing parameters (each framework exposes them under its own naming convention):
| Parameter | Range | Description |
|---|---|---|
reranker_id | UUID | Reranker model that reorders matched chunks by relevance. |
llm_id | UUID | LLM that generates a contextual answer (abstractReply) alongside the chunks. |
relevance_threshold | 0–1 | Minimum relevance score for a result to be included. |
llm_temperature | 0–2 | Sampling temperature for the LLM post-processor. |
max_results | integer | Maximum number of results to return. |
chronological_resort | boolean | Re-sort the final results by creation time instead of relevance. |
Learn more
The full README, examples, and API reference are available on the PyPI package page.