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
use ;
use ;
use crateOpenAiClient;
/// Thin wrapper that wires the HTTP client [`OpenAiClient`] into a value that
/// implements [`artificial_core::backend::Backend`].
///
/// Think of it as the **service locator** for the OpenAI back-end:
///
/// * stores the API key (and optionally a custom base URL in the future),
/// * owns a shareable, connection-pooled `reqwest::Client`,
/// * provides a fluent [`OpenAiAdapterBuilder`] so callers don’t have to juggle
/// `Option<String>` manually.
///
/// The type itself purposefully exposes **no additional methods**—all user-
/// facing functionality sits on the generic [`artificial_core::ArtificialClient`]
/// once the adapter is plugged in.
/// Builder for [`OpenAiAdapter`].
///
/// # Typical usage
///
/// ```rust,no_run
/// use artificial_openai::OpenAiAdapterBuilder;
///
/// let backend = OpenAiAdapterBuilder::new_from_env()
/// .build()
/// .expect("OPENAI_API_KEY must be set");
/// ```
///
/// The builder pattern keeps future options (proxy URL, organisation ID, …)
/// backwards compatible without breaking existing `build()` calls.