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(())
}