pub struct OpenAiDialect;Expand description
Converts an rskit CompletionRequest into the OpenAI wire format
and parses the response back into an rskit CompletionResponse.
Implementations§
Source§impl OpenAiDialect
impl OpenAiDialect
Sourcepub fn build_body(req: &CompletionRequest) -> AppResult<Value>
pub fn build_body(req: &CompletionRequest) -> AppResult<Value>
Build the JSON body for a chat completion request.
Sourcepub fn parse_response(body: &str) -> AppResult<CompletionResponse>
pub fn parse_response(body: &str) -> AppResult<CompletionResponse>
Parse a successful chat-completion response body.
Sourcepub fn parse_error(status: u16, body: &str) -> AppError
pub fn parse_error(status: u16, body: &str) -> AppError
Parse an error response body into an AppError.
Sourcepub fn parse_stream_chunk(data: &[u8]) -> AppResult<StreamChunk>
pub fn parse_stream_chunk(data: &[u8]) -> AppResult<StreamChunk>
Parse a single SSE data payload from the streaming chat-completions API.
Auto Trait Implementations§
impl Freeze for OpenAiDialect
impl RefUnwindSafe for OpenAiDialect
impl Send for OpenAiDialect
impl Sync for OpenAiDialect
impl Unpin for OpenAiDialect
impl UnsafeUnpin for OpenAiDialect
impl UnwindSafe for OpenAiDialect
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
Mutably borrows from an owned value. Read more