openai_interface/rest/
mod.rs

1//! REST API client module for OpenAI interface
2//!
3//! This module provides the core HTTP functionality for making requests to OpenAI-compatible APIs.
4//! It includes traits and implementations for both streaming and non-streaming API calls.
5//!
6//! # Overview
7//!
8//! The `rest` module contains:
9//! - [`post`]: HTTP POST request functionality with streaming and non-streaming support
10//! - Traits for defining API request behavior
11//! - Error handling for HTTP communication
12//!
13//! # Usage
14//!
15//! The module is designed to be used through the higher-level API modules (`chat`, `completions`,
16//! etc.). However, you can use the traits directly if needed:
17//!
18//! ```rust
19//! use openai_interface::rest::post::{NoStream, Stream};
20//! use serde::Serialize;
21//!
22//! #[derive(Serialize)]
23//! struct MyRequest {
24//!     prompt: String,
25//!     stream: bool,
26//! }
27//!
28//! impl openai_interface::rest::post::Post for MyRequest {
29//!     fn is_streaming(&self) -> bool {
30//!         self.stream
31//!     }
32//! }
33//!
34//! impl NoStream for MyRequest {}
35//! // or impl Stream for MyRequest {} for streaming requests
36//! ```
37
38pub mod post;