convert

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedContentType is returned when a content type cannot be converted
	ErrUnsupportedContentType = errors.New("unsupported content type")

	// ErrInvalidMessageFormat is returned when a message has an invalid format
	ErrInvalidMessageFormat = errors.New("invalid message format")

	// ErrConversionFailed is returned when conversion between formats fails
	ErrConversionFailed = errors.New("conversion failed")
)

Conversion errors

Functions

func ConvertRoleToCommon

func ConvertRoleToCommon(role string) gollem.MessageRole

ConvertRoleToCommon converts various provider roles to common MessageRole

func GenerateToolCallID

func GenerateToolCallID(name string, index int) string

GenerateToolCallID generates a unique ID for tool calls if not present

func MergeSystemIntoFirstUser

func MergeSystemIntoFirstUser(messages []gollem.Message) []gollem.Message

MergeSystemIntoFirstUser merges a system message into the first user message This is used for providers that don't support system messages directly (Claude, Gemini)

func ParseJSONArguments

func ParseJSONArguments(jsonStr string) (map[string]interface{}, error)

ParseJSONArguments attempts to parse a JSON string into a map

func StringifyJSONArguments

func StringifyJSONArguments(args map[string]interface{}) (string, error)

StringifyJSONArguments converts a map to a JSON string

Types

type ConversionWarning

type ConversionWarning struct {
	Message string
	Field   string
	Value   interface{}
}

ConversionWarning represents a warning during conversion

Jump to

Keyboard shortcuts

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