Help us shape the future of Go! Take the 2026 Go Developer Survey

utils

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTokenizeURL added in v0.2.5

func BuildTokenizeURL(endpoint string) (string, error)

BuildTokenizeURL parses the endpoint and constructs the tokenize URL

func CallTokenizeAPI added in v0.2.5

func CallTokenizeAPI(tokenizeURL, prompt string) (int, error)

CallTokenizeAPI calls the vLLM tokenize endpoint and returns the token count

func GetRandomPromptByTokenCount added in v0.2.5

func GetRandomPromptByTokenCount(endpoint string, targetTokens int) (string, error)

GetRandomPromptByTokenCount generates a random prompt with specified token count It calls the vLLM /tokenize endpoint to verify token count and adjusts accordingly

func GetSystemPrompt added in v0.2.0

func GetSystemPrompt(cfg *config.SystemPromptTemplate) string

GetSystemPrompt retrieves system prompt content based on configuration If both content and path are set, content takes precedence

func LoadDataset

func LoadDataset(filePath, fileType string, systemPrompt string) ([]provider.AnyParams, error)

LoadDataset loads test data from a file

func SaveBatchResultsToJSONL added in v0.2.0

func SaveBatchResultsToJSONL(results []*engine.Result, filePath string) error

SaveBatchResultsToJSONL saves batch test results to a JSONL file Each line in the output file corresponds to the test case at the same line number in the input file

Types

type TokenizeRequest added in v0.2.5

type TokenizeRequest struct {
	Prompt string `json:"prompt"`
}

TokenizeRequest represents the request body for /tokenize endpoint

type TokenizeResponse added in v0.2.5

type TokenizeResponse struct {
	Count       int      `json:"count"`
	MaxModelLen int      `json:"max_model_len"`
	Tokens      []int    `json:"tokens"`
	TokenStrs   []string `json:"token_strs"`
}

TokenizeResponse represents the response from /tokenize endpoint

Jump to

Keyboard shortcuts

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