synwire
Convenience umbrella crate for the Synwire AI framework. One dependency gives you chat models, embeddings, graph orchestration, agent runtime, and utilities.
What this crate provides
Re-exports from all Synwire crates plus:
agent::prelude::*—Agent,AgentNode,Runner,Directive,DirectiveResult,AgentError,AgentEvent,Session,SessionManager,Usage,OutputMode,HookRegistrycache::CacheBackedEmbeddings— moka-backed embedding cache wrapping anyEmbeddingsimplchat_history::InMemoryChatMessageHistory+RunnableWithMessageHistory— stateful conversation managementprompts— few-shot prompt templates, example selectorstext_splitters—RecursiveCharacterTextSplitter, character splitteroutput_parsers—CommaSeparatedListOutputParser,RetryOutputParser,RegexParser,EnumOutputParser,XmlOutputParser,CombiningOutputParser
Quick start
[]
= { = "0.1", = ["openai"] }
= { = "1", = ["full"] }
First chat:
use *;
use ChatOpenAI;
async
Cached embeddings:
use CacheBackedEmbeddings;
use OpenAIEmbeddings;
let base = builder.api_key_env.build?;
let cached = new; // LRU cache, 1000 entries
Stateful conversation:
use ;
use ChatOpenAI;
let model = builder.model.api_key_env.build?;
let history = new;
let chain = new;
Feature flags
| Flag | Enables |
|---|---|
openai |
synwire-llm-openai (ChatOpenAI, OpenAIEmbeddings) |
ollama |
synwire-llm-ollama (ChatOllama, OllamaEmbeddings) |
When to use this crate vs individual crates
- Use
synwirefor application development and prototypes - Use
synwire-coredirectly when publishing a third-party extension crate — it carries no provider dependencies