Skip to main content

OAIChatLikeRequest

Trait OAIChatLikeRequest 

Source
pub trait OAIChatLikeRequest {
Show 13 methods // Required methods fn model(&self) -> String; fn messages(&self) -> Value; fn should_add_generation_prompt(&self) -> bool; // Provided methods fn typed_messages(&self) -> Option<&[ChatCompletionRequestMessage]> { ... } fn tools(&self) -> Option<Value> { ... } fn tool_choice(&self) -> Option<Value> { ... } fn response_format(&self) -> Option<Value> { ... } fn reasoning_effort(&self) -> Option<Value> { ... } fn chat_template_args(&self) -> Option<&HashMap<String, Value>> { ... } fn prompt_input_type(&self) -> PromptInput { ... } fn extract_tokens(&self) -> Option<TokenInput> { ... } fn extract_text(&self) -> Option<TextInput> { ... } fn mm_processor_kwargs(&self) -> Option<&Value> { ... }
}
Expand description

Trait that defines a request that can map to an OpenAI-like request.

Implement this for your request type to render it through a PromptFormatter. Media/multimodal IO config is intentionally not part of this trait — it is a preprocessing concern owned by the consumer, kept off the rendering surface so this crate stays runtime-free.

Required Methods§

Provided Methods§

Source

fn typed_messages(&self) -> Option<&[ChatCompletionRequestMessage]>

Source

fn tools(&self) -> Option<Value>

Source

fn tool_choice(&self) -> Option<Value>

Source

fn response_format(&self) -> Option<Value>

Source

fn reasoning_effort(&self) -> Option<Value>

OpenAI-compatible reasoning-effort control, when the request type exposes it as a top-level field.

Source

fn chat_template_args(&self) -> Option<&HashMap<String, Value>>

Optional additional args to merge into the chat template context

Source

fn prompt_input_type(&self) -> PromptInput

Returns the type of input for the prompt. Default is Text.

Source

fn extract_tokens(&self) -> Option<TokenInput>

Extract tokens if the input is pre-tokenized

Source

fn extract_text(&self) -> Option<TextInput>

Source

fn mm_processor_kwargs(&self) -> Option<&Value>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl OAIChatLikeRequest for CreateChatCompletionRequest

Default OAIChatLikeRequest impl for the bare dynamo-protocols chat request. Lets any consumer (e.g. a standalone OpenAI frontend over an engine) render HF chat templates directly from the wire type, without defining their own wrapper. Consumers with extra fields (Dynamo’s NvCreateChatCompletionRequest) provide their own impl.

Implementors§