chat_completions(...)。
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
使用 Rust SDK 发送兼容 OpenAI 的 Chat Completions 请求。
chat_completions(...)。
use phaseo::Phaseo;
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Phaseo::from_env()?;
let response = client.chat_completions(&json!({
"model": "openai/gpt-6-astra",
"messages": [
{
"role": "system",
"content": "Answer concisely."
},
{
"role": "user",
"content": "What is provider fallback?"
}
]
}))?;
let text = response
.body
.pointer("/choices/0/message/content")
.and_then(|value| value.as_str())
.unwrap_or("");
println!("{text}");
Ok(())
}