executor

package
v0.0.0-...-84d2d43 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteCode

func ExecuteCode(executionUnit ExecutionUnit)

func ExecuteInference

func ExecuteInference(inferenceUnit InferenceUnit)

func ExecutorWorker

func ExecutorWorker(id int)

Worker that runs inference

func GetChatCompletion

func GetChatCompletion(apiKey, message string, modelName string) (string, error)

func InferenceWorker

func InferenceWorker(id int)

Worker that executes generated code

func InitializeBackpressureWatchdog

func InitializeBackpressureWatchdog()

func LaunchInstance

func LaunchInstance(request *common.StartEndpointRequest) (*common.LaunchResponse, error)

func RemoveGolangMain

func RemoveGolangMain(sourceCode string) string

func StandarizeCode

func StandarizeCode(executionUnit ExecutionUnit) string

We need to standarize the code for some programming languages

func StopInstance

func StopInstance(request *common.StopEndpointRequest) (*common.LaunchResponse, error)

func WriteCodeToFilesystem

func WriteCodeToFilesystem(sourceCode string, language string) (string, string, string, bool)

Types

type BackpressureWatchdog

type BackpressureWatchdog struct {
	// contains filtered or unexported fields
}

func (*BackpressureWatchdog) CountExecution

func (watchdog *BackpressureWatchdog) CountExecution()

func (*BackpressureWatchdog) CountInference

func (watchdog *BackpressureWatchdog) CountInference()

type ChatCompletionRequest

type ChatCompletionRequest struct {
	Model             string                 `json:"model"`
	Messages          []Message              `json:"messages"`
	ExtraFields       map[string]interface{} `json:"extra_fields,omitempty"`
	MaxTokens         int                    `json:"max_tokens,omitempty"`
	SkipSpecialTokens bool                   `json:"skip_special_tokens,omitempty"`
	Temperature       float32                `json:"temperature,omitempty"`
	TopP              float32                `json:"top_p,omitempty"`
	TopK              int                    `json:"top_k,omitempty"`
	Seed              int                    `json:"seed,omitempty"`
	N                 int                    `json:"n,omitempty"`
}

type ChatCompletionResponse

type ChatCompletionResponse struct {
	ID      string   `json:"id"`
	Object  string   `json:"object"`
	Created int      `json:"created"`
	Choices []Choice `json:"choices"`
}

type Choice

type Choice struct {
	Index        int     `json:"index"`
	Message      Message `json:"message"`
	FinishReason string  `json:"finish_reason"`
}

type ExecutorQueueSingleton

type ExecutorQueueSingleton struct {
	InputChannel chan ExecutionUnit
	// contains filtered or unexported fields
}

func GetExecutorQueueInstance

func GetExecutorQueueInstance() *ExecutorQueueSingleton

type InferenceQueueSingleton

type InferenceQueueSingleton struct {
	InputChannel chan InferenceUnit
	// contains filtered or unexported fields
}

func GetInferenceQueueInstance

func GetInferenceQueueInstance() *InferenceQueueSingleton

type LimitedBuffer

type LimitedBuffer struct {
	// contains filtered or unexported fields
}

func (*LimitedBuffer) Bytes

func (lb *LimitedBuffer) Bytes() []byte

func (*LimitedBuffer) Reset

func (lb *LimitedBuffer) Reset()

func (*LimitedBuffer) String

func (lb *LimitedBuffer) String() string

func (*LimitedBuffer) Write

func (lb *LimitedBuffer) Write(p []byte) (n int, err error)

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type MyRoundTripper

type MyRoundTripper struct {
	// contains filtered or unexported fields
}

func (MyRoundTripper) RoundTrip

func (mrt MyRoundTripper) RoundTrip(r *http.Request) (*http.Response, error)

type RoundRobinApiCaller

type RoundRobinApiCaller struct {
	// contains filtered or unexported fields
}

func GetRoundRobin

func GetRoundRobin() *RoundRobinApiCaller

func (*RoundRobinApiCaller) GetNext

func (roundRobinApiCaller *RoundRobinApiCaller) GetNext() string

Jump to

Keyboard shortcuts

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