responses

package
v6.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertOpenAIChatCompletionsResponseToOpenAIResponses

func ConvertOpenAIChatCompletionsResponseToOpenAIResponses(ctx context.Context, modelName string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, param *any) []string

ConvertOpenAIChatCompletionsResponseToOpenAIResponses converts OpenAI Chat Completions streaming chunks to OpenAI Responses SSE events (response.*).

func ConvertOpenAIChatCompletionsResponseToOpenAIResponsesNonStream

func ConvertOpenAIChatCompletionsResponseToOpenAIResponsesNonStream(_ context.Context, _ string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, _ *any) string

ConvertOpenAIChatCompletionsResponseToOpenAIResponsesNonStream builds a single Responses JSON from a non-streaming OpenAI Chat Completions response.

func ConvertOpenAIResponsesRequestToOpenAIChatCompletions

func ConvertOpenAIResponsesRequestToOpenAIChatCompletions(modelName string, inputRawJSON []byte, stream bool) []byte

ConvertOpenAIResponsesRequestToOpenAIChatCompletions converts OpenAI responses format to OpenAI chat completions format. It transforms the OpenAI responses API format (with instructions and input array) into the standard OpenAI chat completions format (with messages array and system content).

The conversion handles: 1. Model name and streaming configuration 2. Instructions to system message conversion 3. Input array to messages array transformation 4. Tool definitions and tool choice conversion 5. Function calls and function results handling 6. Generation parameters mapping (max_tokens, reasoning, etc.)

Parameters:

  • modelName: The name of the model to use for the request
  • rawJSON: The raw JSON request data in OpenAI responses format
  • stream: A boolean indicating if the request is for a streaming response

Returns:

  • []byte: The transformed request data in OpenAI chat completions format

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL