cognis
LLM providers, chains, agents, memory, and tools for Rust.
cognis is the implementation layer of the Cognis framework. It provides concrete LLM provider integrations, agent execution, composable chains, conversation memory, document processing, and built-in tools — all behind feature flags so you only compile what you use.
Quick Start
[]
= { = "0.1", = ["anthropic"] }
= "0.1"
= { = "1", = ["full"] }
use ChatAnthropic;
use Runnable;
use json;
let model = new;
let result = model.invoke.await?;
LLM Providers
Enable only what you need:
= { = "0.1", = ["openai", "anthropic"] } # pick providers
= { = "0.1", = ["all-providers"] } # or grab everything
| Feature | Provider |
|---|---|
anthropic |
Anthropic Claude |
openai |
OpenAI GPT |
google |
Google Gemini |
ollama |
Ollama (local models) |
azure |
Azure OpenAI |
What's Inside
Agents — Executor with a pluggable middleware pipeline: retry, PII redaction, tool selection, human-in-the-loop, summarization, and more.
Chains — LLM chain, conversation chain, sequential chain, extraction chain, structured output chain, router chain, retrieval QA chain.
Memory — Buffer, window, summary, and entity memory strategies for multi-turn conversations.
Document Loaders — Text, CSV, JSON, and directory loaders for ingesting data.
Text Splitters — Character, recursive, markdown, HTML, JSON, code, and token-aware splitters for chunking documents.
Embeddings — OpenAI and Ollama embedding providers with batch support.
Retrievers — Caching, reranking, query translation, and multi-query retrievers.
Tools — Calculator, shell command, and JSON query tools out of the box.
Additional Feature Flags
| Feature | What it adds |
|---|---|
pdf |
PDF document loader |
yaml |
YAML document loader |
toml-loader |
TOML document loader |
sqlite |
SQLite-backed stores |
Part of the Cognis Workspace
| Crate | Role |
|---|---|
| cognis-core | Foundation traits and types |
| cognis | LLM providers, chains, memory, tools (you are here) |
| cognisgraph | State graph orchestration engine |
| cognisagent | High-level agent framework |