Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.13 KB

File metadata and controls

47 lines (30 loc) · 1.13 KB

Responses guide

Responses is the primary generation surface in this crate.

Basic request

use openai_rust::resources::responses::{ResponseCreateParams, ResponseInput};

let params = ResponseCreateParams {
    model: "gpt-5.5".into(),
    input: Some(ResponseInput::text("Summarize the Rust ownership rules.")),
    ..Default::default()
};

let _ = params;

Streaming

Run the executable walkthrough:

cargo run --example responses_streaming

The example uses ResponseStream::from_sse_chunks(...) so the streaming API can be exercised without network setup.

Structured outputs

Run the structured-output example:

cargo run --example structured_outputs

The example builds ResponseParseParams, ResponseTextConfig, ResponseFormatTextConfig, ResponseTool, and FunctionTool with the public exports shipped by src/resources/responses.rs.

Response metadata

Run the metadata walkthrough:

cargo run --example request_metadata

That example demonstrates the stable ApiResponse<T> and ResponseMetadata accessors used to inspect request IDs and headers after a typed response returns.