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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//! Ferrin provider specification.
//!
//! This crate defines the contract between the Ferrin core and provider
//! adapters: model traits, prompt and content types, stream parts, shared
//! option and metadata types, and the provider-level error type. It contains no
//! networking and no generation logic.
//!
//! # Layout
//!
//! - [`shared`]: identifiers, provider options and metadata, warnings, headers,
//! media types, file data.
//! - [`language_model`]: the [`LanguageModel`] trait and everything it exchanges
//! with the core (call options, prompt, tools, content, stream parts, results).
//! - One module per additional model kind ([`embedding_model`], [`image_model`],
//! [`speech_model`], [`transcription_model`], [`reranking_model`],
//! [`video_model`], [`speech_translation_model`], [`realtime_model`]) and per
//! provider service ([`files`], [`skills`], [`batch`]).
//! - [`provider`]: the [`Provider`] trait that hands out models by id.
//! - [`dynamic`]: object-safe `Dyn*` traits, boxed future/stream aliases and
//! the cloneable `*Ref` handle types.
//! - [`error`]: [`ProviderError`] and its concrete error structs.
//!
//! # Serialization
//!
//! Every wire type derives `serde` with internally tagged enums (`type` or
//! `role`, kebab-case), snake_case fields, base64 for bytes and RFC 3339 for
//! timestamps. Optional fields are omitted when absent. `serde_json` is used
//! with `preserve_order`, so object key order is stable.
//!
//! Design: `docs/01-architecture/03-core-data-model.md` and
//! `docs/01-architecture/04-provider-spec.md`.
//!
//! # Attribution
//!
//! Portions of this crate are derived from the Vercel AI SDK (Apache-2.0,
//! Copyright 2023 Vercel, Inc.), translated from TypeScript to Rust and
//! modified. See the `NOTICE` file in the crate root.
pub use Batch;
pub use BatchRef;
pub use BoxFuture;
pub use BoxStream;
pub use DynBatch;
pub use DynEmbeddingModel;
pub use DynFiles;
pub use DynImageModel;
pub use DynLanguageModel;
pub use DynRealtimeFactory;
pub use DynRealtimeModel;
pub use DynRerankingModel;
pub use DynSkills;
pub use DynSpeechModel;
pub use DynSpeechTranslationModel;
pub use DynTranscriptionModel;
pub use DynVideoModel;
pub use EmbeddingModelRef;
pub use FilesRef;
pub use ImageModelRef;
pub use LanguageModelRef;
pub use ModelRef;
pub use RealtimeFactoryRef;
pub use RealtimeModelRef;
pub use RerankingModelRef;
pub use ServiceRef;
pub use SkillsRef;
pub use SpeechModelRef;
pub use SpeechTranslationModelRef;
pub use TranscriptionModelRef;
pub use VideoModelRef;
pub use EmbeddingModel;
pub use ApiCallError;
pub use ModelKind;
pub use NoSuchModelError;
pub use ProviderError;
pub use UnsupportedFunctionalityError;
pub use Files;
pub use AspectRatio;
pub use ImageModel;
pub use ImageSize;
pub use JsonObject;
pub use JsonValue;
pub use CallOptions;
pub use Content;
pub use CustomKind;
pub use FinishReason;
pub use FinishReasonKind;
pub use GenerateResult;
pub use LanguageModel;
pub use Prompt;
pub use PromptMessage;
pub use ReasoningEffort;
pub use RequestMetadata;
pub use ResponseFormat;
pub use ResponseMetadata;
pub use StreamError;
pub use StreamPart;
pub use StreamResult;
pub use SupportedUrls;
pub use ToolCall;
pub use ToolChoice;
pub use ToolDefinition;
pub use Usage;
pub use Provider;
pub use ProviderRef;
pub use RealtimeFactory;
pub use RealtimeModel;
pub use RerankingModel;
pub use ApprovalId;
pub use AudioFormat;
pub use BatchId;
pub use FileData;
pub use Headers;
pub use InvalidHeader;
pub use MediaType;
pub use ModelId;
pub use PartId;
pub use ProviderId;
pub use ProviderMetadata;
pub use ProviderOptions;
pub use ProviderReference;
pub use ToolCallId;
pub use ToolName;
pub use Warning;
pub use Skills;
pub use SpeechModel;
pub use SpeechTranslationModel;
pub use TranscriptionModel;
pub use VideoModel;
/// Version of the provider specification implemented by this crate.
///
/// The specification version equals the crate version (ADR 0011). Adapters
/// compiled against a different `ferrin-spec` version fail to link rather than
/// negotiating at runtime.
pub const SPEC_VERSION: &str = env!;