anthropic-rust-sdk 0.1.0

Anthropic Claude API client for Rust, synced from anthropic-sdk-typescript
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! JSON Schema 辅助,对齐上游 `src/helpers/json-schema.ts`。

use serde_json::{json, Value};

/// 构建 JSON Schema 结构化输出格式配置。
pub fn json_schema_output_format(name: &str, schema: Value, strict: bool) -> Value {
    json!({
        "type": "json_schema",
        "schema": schema,
        "name": name,
        "strict": strict,
    })
}

/// 将 output_config.format 包装为消息请求字段。
pub fn output_config_with_format(format: Value) -> Value {
    json!({ "format": format })
}