runner

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Runner)

Option define o tipo para opções funcionais para configurar o runner.

func WithAddicionalMessage

func WithAddicionalMessage(messages []message.Message) Option

func WithAdditionalInstructions

func WithAdditionalInstructions(instructions string) Option

func WithInstructions

func WithInstructions(instructions interface{}) Option

func WithMaxCompletionTokens

func WithMaxCompletionTokens(tokens int) Option

func WithMaxPromptTokens

func WithMaxPromptTokens(tokens int) Option

func WithMetadata

func WithMetadata(metadata map[string]string) Option

func WithModel

func WithModel(model string) Option

func WithObject

func WithObject(object string) Option

Funções para configurar cada campo da struct Runner

func WithParallelToolCalls

func WithParallelToolCalls(parallel bool) Option

func WithResponseFormat

func WithResponseFormat(format string) Option

func WithStatus

func WithStatus(status string) Option

func WithStream

func WithStream(stream bool) Option

func WithTemperature

func WithTemperature(temperature float64) Option

func WithThreadID

func WithThreadID(threadID string) Option

func WithToolChoice

func WithToolChoice(toolChoice string) Option

func WithTools

func WithTools(tools []tools.Tool) Option

func WithTopP

func WithTopP(topP float64) Option

func WithTruncationStrategy

func WithTruncationStrategy(strategy TruncationStrategy) Option

type Runner

type Runner struct {
	Id                     *string             `json:"id,omitempty"`
	Object                 *string             `json:"object,omitempty"`
	CreatedAt              *int                `json:"created_at,omitempty"`
	AssistantId            string              `json:"assistant_id"` // Este campo é obrigatório, sem `omitempty`
	ThreadId               *string             `json:"thread_id,omitempty"`
	Status                 *string             `json:"status,omitempty"`
	StartedAt              *int                `json:"started_at,omitempty"`
	ExpiresAt              *interface{}        `json:"expires_at,omitempty"`
	CancelledAt            *interface{}        `json:"cancelled_at,omitempty"`
	FailedAt               *interface{}        `json:"failed_at,omitempty"`
	CompletedAt            *int                `json:"completed_at,omitempty"`
	RequiredAction         interface{}         `json:"required_action,omitempty"`
	LastError              *interface{}        `json:"last_error,omitempty"`
	Model                  *string             `json:"model,omitempty"`
	Instructions           *interface{}        `json:"instructions,omitempty"`
	AdditionalInstructions *string             `json:"additional_instructions,omitempty"`
	AddicionalMessage      *[]message.Message  `json:"additional_messages,omitempty"`
	Tools                  *[]assistant.Tool   `json:"tools,omitempty"`
	Metadata               *map[string]string  `json:"metadata,omitempty"`
	IncompleteDetails      *interface{}        `json:"incomplete_details,omitempty"`
	Usage                  *Usage              `json:"usage,omitempty"`
	Temperature            *float64            `json:"temperature,omitempty"`
	TopP                   *float64            `json:"top_p,omitempty"`
	MaxPromptTokens        *int                `json:"max_prompt_tokens,omitempty"`
	MaxCompletionTokens    *int                `json:"max_completion_tokens,omitempty"`
	TruncationStrategy     *TruncationStrategy `json:"truncation_strategy,omitempty"`
	ResponseFormat         *string             `json:"response_format,omitempty"`
	ToolChoice             *string             `json:"tool_choice,omitempty"`
	ParallelToolCalls      *bool               `json:"parallel_tool_calls,omitempty"`
	Stream                 *bool               `json:"stream,omitempty"`
	Thread                 *thread.Thread      `json:"thread,omitempty"`
}

func CreateRun

func CreateRun(assistantID, threadId string, opts ...Option) (*Runner, error)

func CreateThreadAndRun

func CreateThreadAndRun(assistantID string, threads thread.Thread, opts ...Option) (*Runner, error)

type TruncationStrategy

type TruncationStrategy struct {
	Type         string      `json:"type,omitempty"`
	LastMessages interface{} `json:"last_messages,omitempty"`
}

type Usage

type Usage struct {
	PromptTokens     int `json:"prompt_tokens,omitempty"`
	CompletionTokens int `json:"completion_tokens,omitempty"`
	TotalTokens      int `json:"total_tokens,omitempty"`
}

Jump to

Keyboard shortcuts

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