translator

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: MIT Imports: 8 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, unixTimestamp int64, isGlAPIKey bool) 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(rawJson []byte, unixTimestamp int64, isGlAPIKey bool) string

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

func FixCLIToolResponse added in v1.9.0

func FixCLIToolResponse(input string) (string, error)

FixCLIToolResponse converts the format from 1.json to 2.json It groups function calls with their corresponding responses

func PrepareRequest

func PrepareRequest(rawJson []byte) (string, *client.Content, []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

type FunctionCallGroup added in v1.9.0

type FunctionCallGroup struct {
	ModelContent    map[string]interface{}
	FunctionCalls   []gjson.Result
	ResponsesNeeded int
}

FunctionCallGroup represents a group of function calls and their responses

Jump to

Keyboard shortcuts

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