#[non_exhaustive]pub struct CompletionsRequest {
pub model: String,
pub prompt: Value,
pub max_tokens: Option<u32>,
pub temperature: Option<f32>,
pub stream: Option<bool>,
pub echo: Option<bool>,
pub n: Option<u32>,
pub user: Option<String>,
}Expand description
Body of POST /v1/completions.
Mirrors the public OpenAI REST contract documented at https://platform.openai.com/docs/api-reference/completions/create.
Every field is #[serde(default)] so an SDK that omits an optional
knob still deserialises cleanly. We do not (yet) validate the values
— the scaffold’s only contract is “the request parses; we then
reject with 501”. The v0.4 wiring step adds:
model→FunctionRecordlookup;prompt→ guest argv marshalling;max_tokens/temperature/stream→ executor knobs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: StringModel identifier. In v0.4 this will resolve to a deployed
FunctionRecord via a model → function_id map (env-driven
allowlist + alias table).
prompt: ValuePrompt text. Accepts either a single string or an array of
strings on the wire — represented here as serde_json::Value
so the scaffold does not commit to one shape ahead of the
translator.
max_tokens: Option<u32>Maximum tokens to generate. Optional in the OpenAI contract; defaults to 16 if absent on the wire (v0.4 will mirror).
temperature: Option<f32>Sampling temperature in [0.0, 2.0]. Optional; defaults to 1.0.
stream: Option<bool>Stream the response as SSE if true. v0.4 wires; scaffold ignores.
echo: Option<bool>Echo of the input plus completion (OpenAI compat knob).
n: Option<u32>Number of completions to generate per prompt.
user: Option<String>Caller-supplied request id, surfaced back on the response in OpenAI’s own logs. We accept and ignore.
Trait Implementations§
Source§impl Clone for CompletionsRequest
impl Clone for CompletionsRequest
Source§fn clone(&self) -> CompletionsRequest
fn clone(&self) -> CompletionsRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompletionsRequest
impl Debug for CompletionsRequest
Source§impl Default for CompletionsRequest
impl Default for CompletionsRequest
Source§fn default() -> CompletionsRequest
fn default() -> CompletionsRequest
Source§impl<'de> Deserialize<'de> for CompletionsRequest
impl<'de> Deserialize<'de> for CompletionsRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CompletionsRequest
impl RefUnwindSafe for CompletionsRequest
impl Send for CompletionsRequest
impl Sync for CompletionsRequest
impl Unpin for CompletionsRequest
impl UnsafeUnpin for CompletionsRequest
impl UnwindSafe for CompletionsRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more