1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Model provider integrations — the leaves of the recursion.
//!
//! Every recursive call in the runtime — an agent, a sub-agent, a graph node, a
//! `.ragsh` step — ultimately bottoms out in a concrete model invocation, and
//! that invocation goes through a provider adapter here. Adapters translate
//! between TinyAgents' provider-neutral request/response types
//! ([`ModelRequest`]/[`ModelResponse`]) and a provider's own wire API, so the
//! recursive machinery above stays provider-agnostic and no provider-specific
//! JSON leaks into core harness code.
//!
//! # Available providers
//!
//! | Provider | Status |
//! |---|---|
//! | [`MockModel`] | Implemented — deterministic, no network |
//! | [`openai`] (and OpenAI-compatible endpoints) | Implemented |
//!
//! [`MockModel`] is always compiled and needs no network, keeping the default
//! build offline and deterministic. The [`openai`] module is always compiled
//! too (it pulls no extra dependencies) and additionally serves every
//! OpenAI-compatible endpoint (Ollama, DeepSeek, Groq, xAI, OpenRouter,
//! Together, Mistral, and Anthropic's OpenAI-compat endpoint) through the same
//! Chat Completions wire format. The default build stays offline anyway: the
//! adapter only touches the network when invoked, and the live tests
//! early-return without `OPENAI_API_KEY`.
//!
//! To add a provider with a different wire protocol, gate it behind a new
//! Cargo feature and add the corresponding module declaration:
//!
//! ```text
//! pub mod openai; // always compiled
//! // #[cfg(feature = "anthropic")] pub mod anthropic;
//! // #[cfg(feature = "ollama")] pub mod ollama;
//! ```
// --- real provider integrations ---
// The OpenAI Chat Completions adapter is always compiled; it also serves every
// OpenAI-compatible endpoint. Providers with a different wire protocol would be
// added behind their own Cargo feature.
// #[cfg(feature = "anthropic")] pub mod anthropic;
// #[cfg(feature = "ollama")] pub mod ollama;
pub use *;
use async_trait;
use Value;
use crateResult;
use crateTinyAgentsError;
use crate;
use crate;
use crateToolCall;
use crateUsage;