API Reference
Complete API reference for cognity-ai. All public classes, methods, and configuration options.
Modules
cognity-ai is organized into focused modules. Each module exposes a clean public API. Click any card to see the full reference for that module.
LibraryConfig and all provider config dataclasses for embedders, stores, generators, and OCR providers.LoaderFactory.Common Import Patterns
The most frequently used symbols are importable directly from cognity-ai and its top-level submodules.
# Core facade — start here
from cognity_ai import RAGLibrary
# Full configuration via dataclasses
from cognity_ai.config import LibraryConfig
# Loader factory for custom pipelines
from cognity_ai.loaders import LoaderFactory
# Core data models
from cognity_ai.models import Document, SemanticChunk, RetrievalResult
Base classes for plugin authors
Extend these abstract base classes to register custom implementations via register_* methods.
from cognity_ai.loaders import BaseLoader
from cognity_ai.embedders import BaseEmbedder
from cognity_ai.generators import BaseGenerator
from cognity_ai.retrievers import BaseRetriever
from cognity_ai.stores import BaseVectorStore, BaseGraphStore
Core Data Models
All data exchanged between components uses these typed dataclasses from cognity_ai.models.
Document
Represents a raw ingested source document before chunking.
| Field | Type | Description |
|---|---|---|
doc_id | str | Unique document identifier. Derived from filename or supplied by caller. |
content | str | Full extracted text content of the document. |
metadata | dict | Arbitrary key-value metadata (source path, page count, author, etc.). |
source_path | str | None | Filesystem path or URI to the original file. |
status | str | Lifecycle status: active, confirmed, or deprecated. |
SemanticChunk
A chunk of text produced by a chunker, with embeddings and graph metadata attached.
| Field | Type | Description |
|---|---|---|
chunk_id | str | Unique chunk identifier. |
doc_id | str | Parent document identifier. |
text | str | The chunk's text content. |
embedding | list[float] | None | Dense vector embedding. Populated after the embed step. |
entities | list[str] | Named entities extracted from this chunk. |
metadata | dict | Position, page number, section heading, and other loader-specific metadata. |
RetrievalResult
A single ranked result returned by a retriever, combining a chunk with its relevance score.
| Field | Type | Description |
|---|---|---|
chunk | SemanticChunk | The matched chunk. |
score | float | Relevance score in [0, 1]; higher is more relevant. |
method | str | The retrieval method that produced this result. |
graph_context | dict | None | Graph neighbourhood context (entities, relationships) when using graph-aware methods. |
Next Steps
Start with the RAGLibrary reference for the complete facade API, or dive into a specific subsystem below.