Skip to content

collections

FastAPI endpoint functions for managing memory collection resources.

Attributes

GRAPH_PREFIX module-attribute

GRAPH_PREFIX = 'graph'

RESOURCE_COLLECTIONS module-attribute

RESOURCE_COLLECTIONS = 'Collections'

collections_router module-attribute

collections_router = APIRouter(
    prefix=format_path(RESOURCE_COLLECTIONS),
    tags=[RESOURCE_COLLECTIONS],
    responses=DEFAULT_HTTP_ERROR_RESPONSES,
)

Classes

Functions

create_collection async

create_collection(
    fastapi_request: Request,
    request: CollectionCreateRequestV1,
    namespace_pkid: str = namespace_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Create a new collection in the namespace

export_memories async

export_memories(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Export all memories in a collection to JSON

generate_all_collection_graphs async

generate_all_collection_graphs(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Generates graphs for all collections in the namespace

generate_collection_graph async

generate_collection_graph(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Generates graph for a collection

get_collection async

get_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Get a collection resource

hard_delete_collection async

hard_delete_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    dry_run: bool = dry_run_query_param,
    delete_vectors: bool = Query(
        default=True,
        title="Delete Vectors",
        description="When set to true, vector data will also be deleted",
    ),
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Hard delete a collection resource and associated memories

list_collections async

list_collections(
    fastapi_request: Request,
    namespace_pkid: str = namespace_path_param,
    include_deleted: bool = Query(
        False,
        description="Include deleted memory collections in the response",
    ),
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

List all collections in the namespace

rebuild_all_collections async

rebuild_all_collections(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    queue: str | None = checkmate_queue_query_param,
    tags: List[str] | None = checkmate_tags_query_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Rebuilds all memory collection in a namespace. This method will disable agents temporarily as their memory collections are rebuilt.

rebuild_collection async

rebuild_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Rebuilds a memory collection

soft_delete_collection async

soft_delete_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Soft delete a collection resource

truncate_collection async

truncate_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Hard delete all memories in the collection (truncate), the collection itself is not deleted. This action is immediate and irreversible.

undelete_collection async

undelete_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Undeletes a soft-deleted collection resource

update_collection async

update_collection(
    fastapi_request: Request,
    request: CollectionUpdateRequestV1,
    namespace: str = namespace_path_param,
    memory_collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Update a collection resource