1 unstable release
Uses new Rust 2024
| 0.4.0 | Mar 2, 2026 |
|---|
#2906 in Asynchronous
Used in 8 crates
35KB
769 lines
neuron-turn
Shared toolkit for building LLM providers and operators
Overview
neuron-turn is the shared toolkit that concrete providers (Anthropic, OpenAI, Ollama) and
operators (ReAct, single-shot) build on top of. It provides:
Providertrait — the async interface that every LLM integration implements- Request / response types —
TurnRequest,TurnResponse,ContentPart,ToolCall, etc. - Context strategy types —
ContextStrategyenum and its resolution logic (used by providers to window conversation history before sending to the model) - Shared cost / token accounting —
TokenUsage,Cost,DurationMs
Usage
[dependencies]
neuron-turn = "0.4"
Implementing a custom provider
use neuron_turn::{Provider, TurnRequest, TurnResponse};
use async_trait::async_trait;
pub struct MyProvider { /* ... */ }
#[async_trait]
impl Provider for MyProvider {
async fn turn(&self, request: TurnRequest) -> Result<TurnResponse, neuron_turn::TurnError> {
// call your LLM API here
todo!()
}
}
Part of the neuron workspace
neuron is a composable async agentic AI framework for Rust. See the book for architecture and guides.
Dependencies
~1.2–2.2MB
~44K SLoC