Skip to content

Commit 222236b

Browse files
committed
Cleanup
1 parent 00548d9 commit 222236b

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

src/agent.rs

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,13 +3225,14 @@ impl SetSessionModelResponse {
32253225
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
32263226
#[serde(rename_all = "snake_case")]
32273227
#[non_exhaustive]
3228+
#[expect(clippy::doc_markdown)]
32283229
pub enum LlmProtocol {
32293230
/// Anthropic API protocol.
32303231
Anthropic,
3231-
/// `OpenAI` API protocol.
3232+
/// OpenAI API protocol.
32323233
#[serde(rename = "openai")]
32333234
OpenAi,
3234-
/// Azure `OpenAI` API protocol.
3235+
/// Azure OpenAI API protocol.
32353236
Azure,
32363237
/// Google Vertex AI API protocol.
32373238
Vertex,
@@ -3301,24 +3302,21 @@ pub struct ProviderInfo {
33013302
#[cfg(feature = "unstable_llm_providers")]
33023303
impl ProviderInfo {
33033304
#[must_use]
3304-
pub fn new(id: impl Into<String>, supported: Vec<LlmProtocol>, required: bool) -> Self {
3305+
pub fn new(
3306+
id: impl Into<String>,
3307+
supported: Vec<LlmProtocol>,
3308+
required: bool,
3309+
current: impl Into<Nullable<ProviderCurrentConfig>>,
3310+
) -> Self {
33053311
Self {
33063312
id: id.into(),
33073313
supported,
33083314
required,
3309-
current: Nullable::default(),
3315+
current: current.into(),
33103316
meta: None,
33113317
}
33123318
}
33133319

3314-
/// Current effective non-secret routing config.
3315-
/// Null means provider is disabled.
3316-
#[must_use]
3317-
pub fn current(mut self, current: impl IntoOption<ProviderCurrentConfig>) -> Self {
3318-
self.current = current.into_option().into();
3319-
self
3320-
}
3321-
33223320
/// The _meta property is reserved by ACP to allow clients and agents to attach additional
33233321
/// metadata to their interactions. Implementations MUST NOT make assumptions about values at
33243322
/// these keys.
@@ -3422,7 +3420,7 @@ impl ListProvidersResponse {
34223420
///
34233421
/// Replaces the full configuration for one provider id.
34243422
#[cfg(feature = "unstable_llm_providers")]
3425-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
3423+
#[derive(Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
34263424
#[schemars(extend("x-side" = "agent", "x-method" = PROVIDERS_SET_METHOD_NAME))]
34273425
#[serde(rename_all = "camelCase")]
34283426
#[non_exhaustive]
@@ -3446,6 +3444,26 @@ pub struct SetProvidersRequest {
34463444
pub meta: Option<Meta>,
34473445
}
34483446

3447+
#[cfg(feature = "unstable_llm_providers")]
3448+
impl std::fmt::Debug for SetProvidersRequest {
3449+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3450+
f.debug_struct("SetProvidersRequest")
3451+
.field("id", &self.id)
3452+
.field("api_type", &self.api_type)
3453+
.field("base_url", &self.base_url)
3454+
.field(
3455+
"headers",
3456+
&self
3457+
.headers
3458+
.keys()
3459+
.map(|k| (k.as_str(), "[REDACTED]"))
3460+
.collect::<Vec<_>>(),
3461+
)
3462+
.field("meta", &self.meta)
3463+
.finish()
3464+
}
3465+
}
3466+
34493467
#[cfg(feature = "unstable_llm_providers")]
34503468
impl SetProvidersRequest {
34513469
#[must_use]

src/nullable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ mod tests {
144144

145145
#[test]
146146
fn missing_key_fails() {
147-
assert!(from_str::<Example>(r#"{}"#).is_err());
147+
assert!(from_str::<Example>(r"{}").is_err());
148148
}
149149

150150
#[test]

0 commit comments

Comments
 (0)