pig_protocol/codec/chat

Values

pub fn build_request_body(
  messages: List(message.Message),
  tools: List(tool_definition.ToolDefinition),
  model: String,
) -> String

Build the JSON request body for the OpenAI Chat Completions API. Pure function — no IO.

pub fn parse_response(
  raw: String,
) -> Result(inference.InferenceResult, error.AiError)

Parse an OpenAI Chat Completions JSON response into an InferenceResult. Pure function — no IO.

Search Document