Create A Space¶
Use GoodMemVectorStore.create(...) when you want this package to create a new
GoodMem space and immediately hand back a bound LangChain VectorStore.
This helper is intentionally narrow. It focuses on the LangChain-facing pieces that this repository can explain clearly:
the space name
which GoodMem embedder or embedders should be attached
whether the returned store should also retain a usable LangChain
Embeddingsobject
Choose the create-time embedder input this way:
use
embedders=[GoodMemSpaceEmbedder(...)]when you already know the GoodMem embedder IDs that should be attached to the space and you only need server-side retrievaluse
embedding=GoodMemEmbeddings(...)when the same GoodMem embedder should both back the new space and remain available locally asstore.embeddings
If you need to manage the GoodMem resources around the normal LangChain
workflow, use GoodMemResources. It can create spaces with labels, list/get
spaces, delete spaces, and bootstrap a vector store. Broader platform
administration remains in GoodMem’s SDK, CLI, and UI.
- classmethod GoodMemVectorStore.create(*, name, embedders=None, connection, embedding=None)[source]
Create a new GoodMem space and return a bound vector store.
Exactly one create-time embedder source is allowed:
embedders=[GoodMemSpaceEmbedder(...)]embedding=GoodMemEmbeddings(...)
Choose
embedders=...when you already know the GoodMem embedder ID or IDs that should be attached to the new space and you only need server-side retrieval behavior.Choose
embedding=...when you want the same GoodMem embedder to serve both roles:attach its
embedder_idto the new spaceremain available locally as
store.embeddingsfor LangChain code that also callsembed_query(...)orembed_documents(...)
In other words,
embedding=GoodMemEmbeddings(...)is the single-embedder shorthand that also preserves a usable LangChainEmbeddingsobject on the returned store.- Parameters:
name (
str) – Requested GoodMem space name.embedders (
list[GoodMemSpaceEmbedder] |None) – Explicit GoodMem space-embedder declarations. Use this when you want to declare one or more existing GoodMem embedder IDs directly.connection (
GoodMemConnection) – Shared GoodMem transport configuration.embedding (
GoodMemEmbeddings|None) – GoodMem-managed embeddings adapter whose embedder ID should be attached to the new space and then retained on the returned store asstore.embeddings.
- Returns:
GoodMemVectorStore– A vector store bound to the created space.- Raises:
GoodMemConfigurationError – If embedder inputs are missing, mixed, or incompatible with the create helper.
GoodMemAPIError – If GoodMem rejects the create request.
- class GoodMemSpaceEmbedder(embedder_id, default_retrieval_weight=None)[source]
Public create-time embedder declaration.
Use this dataclass when
GoodMemVectorStore.create(...)should create a new space from one or more explicit GoodMem embedder IDs instead of inferring a single embedder fromGoodMemEmbeddings.This is the right choice when you already know which GoodMem embedder IDs the space should use for retrieval and you do not need a retained local LangChain
Embeddingsobject on the returned store.- Parameters:
embedder_id (
str) – Non-empty GoodMem embedder identifier.default_retrieval_weight (
float|None) – Optional retrieval weight attached to this embedder in the created space. GoodMem uses these weights when a space has multiple embedders and retrieval needs to blend their results. Omit the value to let GoodMem apply its default weight.
- embedder_id
Trimmed GoodMem embedder identifier.
- default_retrieval_weight
Retrieval weight normalized to
floatwhen provided.
- Raises:
GoodMemConfigurationError – If
embedder_idis blank ordefault_retrieval_weightis not numeric.