types

package
v0.0.0-...-7640773 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const OpenAIBaseURL = "https://api.openai.com/v1/"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatGPTRequestBody

type ChatGPTRequestBody struct {
	Model            string  `json:"model"`
	Prompt           string  `json:"prompt"`
	MaxTokens        uint    `json:"max_tokens"`
	Temperature      float64 `json:"temperature"`
	TopP             int     `json:"top_p"`
	FrequencyPenalty int     `json:"frequency_penalty"`
	PresencePenalty  int     `json:"presence_penalty"`
}

ChatGPTRequestBody 响应体

type ChatGPTResponseBody

type ChatGPTResponseBody struct {
	ID      string                 `json:"id"`
	Object  string                 `json:"object"`
	Created int                    `json:"created"`
	Model   string                 `json:"model"`
	Choices []ChoiceItem           `json:"choices"`
	Usage   map[string]interface{} `json:"usage"`
}

ChatGPTResponseBody 请求体

type ChoiceItem

type ChoiceItem struct {
	Text         string `json:"text"`
	Index        int    `json:"index"`
	Logprobs     int    `json:"logprobs"`
	FinishReason string `json:"finish_reason"`
}

type GPTModel

type GPTModel int

GPTModel 1 openai大模型 2 讯飞星火大模型

const (
	OpenAIModel GPTModel
	SparkModel
)

type GPTModelArg

type GPTModelArg struct {
	Spark   *SparkArg   `json:"spark"`
	Openapi *OpenapiArg `json:"openapi"`
}

type Message

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

type OpenapiArg

type OpenapiArg struct {
	APIKey            string        `json:"api_key"`
	AutoPass          bool          `json:"auto_pass"`
	SessionTimeout    time.Duration `json:"session_timeout"`
	MaxTokens         uint          `json:"max_tokens"`
	Model             string        `json:"model"`
	Temperature       float64       `json:"temperature"`
	ReplyPrefix       string        `json:"reply_prefix"`
	SessionClearToken string        `json:"session_clear_token"`
}

type SparkArg

type SparkArg struct {
	WssDomain string `json:"wss_domain"`
	AppID     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
	AppKey    string `json:"app_key"`
}

Jump to

Keyboard shortcuts

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