translator

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MimeTypes = map[string]string{}/* 732 elements not displayed */

MimeTypes is a comprehensive map of file extensions to their corresponding MIME types. This is used to identify the type of file being uploaded or processed.

Functions

func ConvertCliToOpenAI

func ConvertCliToOpenAI(rawJson []byte) string

ConvertCliToOpenAI translates a single chunk of a streaming response from the backend client format to the OpenAI Server-Sent Events (SSE) format. It returns an empty string if the chunk contains no useful data.

func ConvertCliToOpenAINonStream

func ConvertCliToOpenAINonStream(template string, rawJson []byte) string

ConvertCliToOpenAINonStream aggregates response chunks from the backend client into a single, non-streaming OpenAI-compatible JSON response.

func PrepareRequest

func PrepareRequest(rawJson []byte) (string, []client.Content, []client.ToolDeclaration)

PrepareRequest translates a raw JSON request from an OpenAI-compatible format to the internal format expected by the backend client. It parses messages, roles, content types (text, image, file), and tool calls.

Types

This section is empty.

Jump to

Keyboard shortcuts

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