Skip to main content

Crate agent_framework_openai

Crate agent_framework_openai 

Source
Expand description

§agent-framework-openai

An OpenAI (and OpenAI-compatible) ChatClient for agent-framework-rs.

Works against the OpenAI Chat Completions API and any compatible endpoint (Azure OpenAI, Ollama, together.ai, local servers, …) by overriding the base URL.

use agent_framework_openai::OpenAIChatCompletionClient;
use agent_framework_core::prelude::*;

let client = OpenAIChatCompletionClient::new("sk-...", "gpt-4o-mini");
let agent = Agent::builder(client)
    .instructions("You are concise.")
    .build();
let reply = agent.run_once("Say hi").await?;
println!("{}", reply.text());

Re-exports§

pub use embeddings::OpenAIEmbeddingClient;
pub use responses::OpenAIChatClient;

Modules§

embeddings
OpenAI embeddings client.
responses
OpenAIChatClient: a ChatClient for the OpenAI Responses API (POST /v1/responses).

Structs§

OpenAIChatCompletionClient
An OpenAI (or OpenAI-compatible) chat client.

Functions§

classify_service_error
Classify a non-success OpenAI-wire (Chat Completions / Responses) HTTP response into a granular Error.