Skip to main content

Module openai

Module openai 

Source
Expand description

OpenAI-compatible chat-completion provider wire codec. OpenAI-compatible provider wire codec.

The free functions project OpenAI chat-completion JSON to and from the canonical chat transcript maps. OpenAiCodecLib installs the same mapping as a runtime codec under codec:openai.

Structs§

OpenAiCodec
Runtime codec for OpenAI-compatible chat-completion JSON.
OpenAiCodecLib
Host-registered lib for codec:openai.
OpenAiCodecOptions
Options for OpenAI-compatible provider request JSON generation.

Functions§

decode_openai_request
Decodes OpenAI request JSON into a validated chat-transcript expression.
decode_openai_response
Decodes an OpenAI chat-completion response body into a model-response transcript, optionally embedding the raw provider JSON.
decode_openai_stream
Decodes an OpenAI chat-completion SSE body into a single model-response transcript, optionally embedding the raw provider chunks.
encode_openai_request
Encodes a model-request transcript into OpenAI chat-completion JSON.
encode_openai_response
Encodes a model-response transcript into OpenAI chat-completion JSON.
openai_codec_symbol
Returns the codec symbol codec:openai.

Type Aliases§

OpenAiRequestOptions
Alias for OpenAiCodecOptions when used for provider request generation.