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
use BoxStream;
use crate::;
/// Factory for [`CompletionModel`] handles bound to a provider
/// account / endpoint.
///
/// A `CompletionClient` typically holds the HTTP client, credentials,
/// and base URL; calling [`Self::completion_model`] fixes a specific
/// model identifier so it can be passed to the engine. Adapters with
/// multiple model families (e.g. Anthropic's chat models, Azure's Chat
/// Completions deployments) implement one client and produce one model
/// type.
/// Provider-agnostic streaming completion contract.
///
/// Implementors map [`ChatRequest`] to the provider's wire format,
/// open the streaming response, and translate per-chunk events into
/// [`StreamChunk`]s. Implementations must be `Send + Sync` because
/// [`RetryingModel`](crate::RetryingModel) and the engine hold them
/// across `await` boundaries; the trait does not declare these
/// super-bounds yet — every use site adds them — but new
/// implementations should satisfy them.