Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultAPIEndpoint = "v1/chat/completions" DefaultMaxTokens = 100 DefaultRequestsPerSecond = 1 DefaultDuration = time.Minute )
View Source
const ( HUGGINGFACE_API_ENDPOINT = "https://huggingface.co/api" // Dataset API DATASET_API_PATH = "datasets" DATASET_API_PARQUET_PATH = "parquet" )
View Source
const ( DefaultMethod = "POST" DefaultEndpoint = "/v1/chat/completions" DefaultRole = "system" DefaultContentType = "application/json" ContentHeader = "Content-Type" AuthorizationHeader = "Authorization" AuthorizationPrefix = "Bearer " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
RequestsPerSecond float64 `json:"rps"`
Duration float64 `json:"duration"`
APIKey string `json:"apikey"`
Endpoint string `json:"endpoint"`
Model string `json:"model"`
MaxCompletionTokens int `json:"maxtokens"`
}
func (*Config) GetDuration ¶
func (*Config) GetEndpoint ¶
func (*Config) GetMaxCompletionTokens ¶
func (*Config) GetRequestsPerSecond ¶
type Dataset ¶
type Dataset struct {
// contains filtered or unexported fields
}
func GetDataset ¶
func NewDataset ¶
func (*Dataset) RandomPrompt ¶
type OpenAIGenerator ¶
type OpenAIGenerator struct {
RPS float64
Duration time.Duration
// OpenAI API key
APIKey string
Method string
Endpoint string
Model string
MaxCompletionTokens int
}
func NewOpenAIGenerator ¶
func NewOpenAIGenerator(conf Config) *OpenAIGenerator
type OpenAIMessage ¶
type OpenAIRequestBody ¶
type OpenAIRequestBody struct {
Model string `json:"model"`
Messages []OpenAIMessage `json:"messages"`
Stream bool `json:"stream"`
StreamOptions StreamOptions `json:"stream_options"`
MaxCompletionTokens int `json:"max_completion_tokens"`
}
func NewOpenAIRequestBody ¶
func NewOpenAIRequestBody(model string, role string, prompt string, maxCompletionTokens int) OpenAIRequestBody
type StreamOptions ¶
type StreamOptions struct {
IncludeUsage bool `json:"include_usage"`
}
Click to show internal directories.
Click to hide internal directories.