Skip to content

Sections

Section builders for MemoryManagerConfigBuilder.

This module contains the fluent subsection builders used by the public memory manager builder.

MemoryManagerEmbeddingBuilder(root_builder)

Configure embedding sections for MemoryManagerConfigBuilder.

Attributes:

Name Type Description
_root_builder RootBuilderProtocol

Root builder used for fluent writes.

Initializes a new instance of the builder.

Parameters:

Name Type Description Default
root_builder RootBuilderProtocol

Root builder.

required

openai(*, model=DEFAULTS.openai_embedder_model, api_key=None)

Configure OpenAI embedding provider.

Parameters:

Name Type Description Default
model str

OpenAI embedding model name. Defaults to DEFAULTS.openai_embedder_model.

openai_embedder_model
api_key str | None

Optional OpenAI API key. Defaults to None.

None

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

register(em_invoker, *, embedding_dims=None, invoke_kwargs=None, **kwargs)

Register one gllm_inference embedding invoker.

Parameters:

Name Type Description Default
em_invoker Any

Embedding invoker instance.

required
embedding_dims int | None

Optional embedding dimension count. Defaults to None.

None
invoke_kwargs dict[str, Any] | None

Optional invoke kwargs. Defaults to None.

None
**kwargs Any

Deprecated or unexpected keyword arguments.

{}

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

Raises:

Type Description
ValueError

If em_invoker is None.

TypeError

If one deprecated or unexpected keyword argument is provided.

MemoryManagerKnowledgeGraphBuilder(root_builder)

Knowledge-graph builder for MemoryManagerConfigBuilder.

Attributes:

Name Type Description
text_to_graph MemoryManagerKnowledgeGraphTextToGraphBuilder

Text-to-graph section builder.

graph_data_store MemoryManagerKnowledgeGraphDataStoreBuilder

Graph data store section builder.

Initializes a new instance of the builder.

Parameters:

Name Type Description Default
root_builder RootBuilderProtocol

Root builder.

required

enable(*, lm_invoker, graph_store)

Configure the common KG happy path with one LM invoker and one Neo4j store.

Parameters:

Name Type Description Default
lm_invoker Any

Language-model invoker used for KG extraction.

required
graph_store Neo4jGraphStoreConfig

Caller-facing Neo4j graph-store config object.

required

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

Raises:

Type Description
ValueError

If lm_invoker or graph_store is missing.

TypeError

If graph_store is not a Neo4jGraphStoreConfig instance.

MemoryManagerKnowledgeGraphDataStoreBuilder(root_builder)

Configure graph data store settings for knowledge-graph integration.

Initializes a new instance of the builder.

Parameters:

Name Type Description Default
root_builder RootBuilderProtocol

Root builder.

required

neo4j(*, uri, user, password, max_connection_pool_size=DEFAULTS.knowledge_graph_neo4j_max_connection_pool_size)

Configure a Neo4j graph data store.

Parameters:

Name Type Description Default
uri str

Neo4j connection URI.

required
user str

Neo4j username.

required
password str

Neo4j password.

required
max_connection_pool_size int

Maximum Neo4j connection pool size. Defaults to 100.

knowledge_graph_neo4j_max_connection_pool_size

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

MemoryManagerKnowledgeGraphTextToGraphBuilder(root_builder)

Configure text-to-graph settings for knowledge-graph integration.

Initializes a new instance of the builder.

Parameters:

Name Type Description Default
root_builder RootBuilderProtocol

Root builder.

required

openai(*, model_id, api_key=None, base_url=None, allowed_nodes=None, allowed_relationships=None, strict_mode=DEFAULTS.knowledge_graph_strict_mode, use_structured_output=DEFAULTS.knowledge_graph_use_structured_output)

Configure text-to-graph extraction using an explicit OpenAI LM invoker.

Parameters:

Name Type Description Default
model_id str

OpenAI model name for KG extraction.

required
api_key str | None

Optional OpenAI API key. Defaults to None.

None
base_url str | None

Optional OpenAI-compatible base URL. Defaults to None.

None
allowed_nodes list[str] | None

Optional allowed node labels. Defaults to None.

None
allowed_relationships list[str] | list[tuple[str, str, str]] | None

Optional allowed relationship constraints. Defaults to None.

None
strict_mode bool

Whether extraction should apply strict filtering. Defaults to True.

knowledge_graph_strict_mode
use_structured_output bool

Whether structured model output should be requested. Defaults to False.

knowledge_graph_use_structured_output

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

register(lm_invoker, *, model_id=None, credentials=None, config=None, allowed_nodes=None, allowed_relationships=None, strict_mode=DEFAULTS.knowledge_graph_strict_mode, use_structured_output=DEFAULTS.knowledge_graph_use_structured_output)

Register one LM invoker-backed text-to-graph configuration.

Parameters:

Name Type Description Default
lm_invoker Any

Language-model invoker used by the graph transformer.

required
model_id str | None

Optional provider-qualified model identifier. Defaults to None.

None
credentials str | dict[str, Any] | None

Optional model credentials payload. Defaults to None.

None
config dict[str, Any] | None

Optional model runtime config. Defaults to None.

None
allowed_nodes list[str] | None

Optional allowed node labels. Defaults to None.

None
allowed_relationships list[str] | list[tuple[str, str, str]] | None

Optional allowed relationship constraints. Defaults to None.

None
strict_mode bool

Whether extraction should apply strict filtering. Defaults to True.

knowledge_graph_strict_mode
use_structured_output bool

Whether structured model output should be requested. Defaults to False.

knowledge_graph_use_structured_output

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

Raises:

Type Description
ValueError

If lm_invoker is None.

MemoryManagerLLMBuilder(root_builder)

Configure LLM sections for MemoryManagerConfigBuilder.

Attributes:

Name Type Description
_root_builder RootBuilderProtocol

Root builder used for fluent writes.

Initializes a new instance of the builder.

Parameters:

Name Type Description Default
root_builder RootBuilderProtocol

Root builder.

required

register(lm_invoker, *, model=None, temperature=0.1, invoke_kwargs=None)

Register one gllm_inference LM invoker.

This path is kept for direct-invoker compatibility. New integrations that need prompt ownership or fallback behavior should prefer register_component(...) and build the LMComponent on the caller side.

Parameters:

Name Type Description Default
lm_invoker Any

Language-model invoker instance.

required
model str | None

Optional model name override. Defaults to None.

None
temperature float

Default model temperature. Defaults to 0.1.

0.1
invoke_kwargs dict[str, Any] | None

Optional invoke kwargs. Defaults to None.

None

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

Raises:

Type Description
ValueError

If lm_invoker is None.

register_component(lm_component)

Register one memory-compatible LM component runtime object.

This is the preferred path for new integrations. The recommended input is gllm_memory's MemoryLMComponent or another BaseMemoryLMComponent subclass. Legacy raw LMComponent objects remain supported for compatibility.

Parameters:

Name Type Description Default
lm_component Any

LM component exposing a callable run method.

required

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

Raises:

Type Description
ValueError

If lm_component is missing or invalid.

MemoryManagerRerankerBuilder(root_builder)

Configure reranker sections for MemoryManagerConfigBuilder.

Attributes:

Name Type Description
_root_builder RootBuilderProtocol

Root builder used for fluent writes.

Initializes a new instance of the builder.

Parameters:

Name Type Description Default
root_builder RootBuilderProtocol

Root builder.

required

llm_reranker(*, llm_provider=PROVIDERS.openai, model=None, api_key=None, top_k=None, temperature=0.0, max_tokens=100, scoring_prompt=None, llm_config=None)

Configure an LLM-based reranker.

Parameters:

Name Type Description Default
llm_provider str

Reranker LLM provider name. Defaults to PROVIDERS.openai.

openai
model str | None

Optional model name override. Defaults to None.

None
api_key str | None

Optional provider API key. Defaults to None.

None
top_k int | None

Optional reranker output limit. Defaults to None.

None
temperature float

Reranker model temperature. Defaults to 0.0.

0.0
max_tokens int

Maximum token budget for reranker generation. Defaults to 100.

100
scoring_prompt str | None

Optional custom scoring prompt. Defaults to None.

None
llm_config dict[str, Any] | None

Optional nested LLM config. Defaults to None.

None

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

register(provider, config=None)

Register one generic reranker provider.

Parameters:

Name Type Description Default
provider str

Provider identifier to register.

required
config dict[str, Any] | None

Provider config payload. Defaults to None.

None

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

similarity_based(em_invoker, *, top_k=None, invoke_kwargs=None)

Configure one local similarity-based reranker.

Parameters:

Name Type Description Default
em_invoker Any

Embedding invoker instance used by the reranker.

required
top_k int | None

Optional final output limit applied after local reranking. Defaults to None.

None
invoke_kwargs dict[str, Any] | None

Optional keyword arguments forwarded to the embedding invoker during reranking. Defaults to None.

None

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

Raises:

Type Description
ValueError

If em_invoker is None.

MemoryManagerStoreBuilder(root_builder)

Configure memory-store sections for MemoryManagerConfigBuilder.

Attributes:

Name Type Description
_root_builder RootBuilderProtocol

Root builder used for fluent writes.

Initializes a new instance of the builder.

Parameters:

Name Type Description Default
root_builder RootBuilderProtocol

Root builder.

required

elasticsearch(*, host, port, collection_name, embedding_model_dims, user=None, password=None, auto_create_index=DEFAULTS.elasticsearch_auto_create_index, use_ssl=DEFAULTS.elasticsearch_use_ssl, verify_certs=DEFAULTS.elasticsearch_verify_certs)

Configure Elasticsearch-backed memory storage.

Parameters:

Name Type Description Default
host str

Elasticsearch host name or URL prefix.

required
port int

Elasticsearch port number.

required
collection_name str

Target Elasticsearch index name.

required
embedding_model_dims int

Embedding vector dimension count.

required
user str | None

Optional Elasticsearch username. Defaults to None.

None
password str | None

Optional Elasticsearch password. Defaults to None.

None
auto_create_index bool

Whether the index may be created automatically. Defaults to DEFAULTS.elasticsearch_auto_create_index.

elasticsearch_auto_create_index
use_ssl bool

Whether SSL should be used. Defaults to DEFAULTS.elasticsearch_use_ssl.

elasticsearch_use_ssl
verify_certs bool

Whether SSL certificates should be verified. Defaults to DEFAULTS.elasticsearch_verify_certs.

elasticsearch_verify_certs

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

register(provider, config=None)

Register one generic memory-store provider.

Parameters:

Name Type Description Default
provider str

Provider identifier to register.

required
config dict[str, Any] | None

Provider config payload. Defaults to None.

None

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

RootBuilderProtocol

Bases: Protocol

Define root-builder operations required by subsection builders.

Subsection builders only depend on this minimal protocol so they stay decoupled from the concrete MemoryManagerConfigBuilder implementation.

merge_backend_option(key, value)

Merge one backend option section on the root builder.

Parameters:

Name Type Description Default
key str

Backend option key.

required
value dict[str, Any]

Partial backend option payload to merge.

required

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.

set_provider_config(section, provider, config)

Set one provider section on the root builder.

Parameters:

Name Type Description Default
section str

Target configuration section name.

required
provider str

Provider identifier for the section.

required
config dict[str, Any]

Provider-specific config payload.

required

Returns:

Name Type Description
Any Any

Root builder instance for fluent chaining.