Expand description
Unified request layer.
Request is the self-contained, provider-agnostic chat-completion request.
It carries everything needed to hit an LLM API — provider, credentials,
model, messages, tools, and tuning knobs.
use agentix::{Request, Provider, Message, UserContent, LlmEvent};
use futures::StreamExt;
let http = reqwest::Client::new();
let mut stream = Request::new(Provider::DeepSeek, "sk-...")
.model("deepseek-chat")
.system_prompt("You are helpful.")
.user("Hello!")
.stream(&http)
.await?;
while let Some(event) = stream.next().await {
if let LlmEvent::Token(t) = event { print!("{t}"); }
}Structs§
- Image
Content - Image content that can be embedded in a user message.
- Request
- A self-contained, provider-agnostic chat-completion request.
- Tool
Call - A single tool invocation requested by the model.
Enums§
- Image
Data - How the image data is provided.
- Message
- A single turn in a conversation. Every variant carries exactly the fields it needs — no invalid states are representable.
- Provider
- Which LLM provider to use.
- Response
Format - Provider-agnostic output-format hint.
- Tool
Choice - Provider-agnostic tool selection hint.
- User
Content - A single content block inside a
Message::User.
Functions§
- truncate_
to_ token_ budget - Drop the oldest messages from
historyuntil the total estimated token count is at or belowbudget. Always keeps at least one message.