cognis-core
Foundation layer for the Cognis LLM framework. Defines the base traits, types, and abstractions that all other workspace crates depend on. This crate has zero dependencies on other workspace crates.
Key Traits and Types
| Trait / Type | Module | Description |
|---|---|---|
BaseChatModel |
language_models |
Interface for chat model providers |
BaseLLM |
language_models |
Interface for completion-style LLMs |
Runnable |
runnables |
Composable unit of async computation |
BaseTool |
tools |
Interface for agent-callable tools |
Embeddings |
embeddings |
Interface for vector embedding providers |
Message |
messages |
Enum: Human, AI, System, Tool, Function |
Document |
documents |
Text document with metadata |
VectorStore |
vectorstores |
Interface for similarity search stores |
Runnables
The Runnable trait and its combinators form the LCEL (LangChain Expression Language) equivalent:
RunnableSequence-- chain runnables with thechain!macroRunnableParallel-- fan-out to multiple runnablesRunnableBranch-- conditional routingRunnableLambda-- wrap a closure as a runnableRunnableWithFallbacks-- automatic fallback on errorRunnableRetry-- retry with configurable policy
Usage
[]
= { = "../cognis-core" }
use Message;
use FakeListChatModel;
let model = new;
let msg = human;
Testing
Fake model implementations (FakeListChatModel, FakeListLLM, ParrotFakeChatModel, etc.)
are provided for testing without network calls.