core

package
v0.0.0-...-1c246ab Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToContentRepo

func ToContentRepo(req []Content) (res []repository.Content)

func ToWebServicePromtGPTMsgRequest

func ToWebServicePromtGPTMsgRequest(req []MessageRequest) (res []gpt4_webservice.MessageReq)

func ToWebServiceUserPromtGPTContentRequest

func ToWebServiceUserPromtGPTContentRequest(req []Content) (res []gpt4_webservice.Content)

Types

type Choices

type Choices struct {
	Index   int     `json:"index"`
	Message Message `json:"message"`
}

func ToCoreChoices

func ToCoreChoices(c []gpt4_webservice.Choices) []Choices

type Content

type Content struct {
	Type     string    `json:"type" validate:"required"`
	Text     *string   `json:"text,omitempty"`
	ImageURL *ImageURL `json:"image_url,omitempty"`
}

type GPT4PromptResponse

type GPT4PromptResponse struct {
	ID      string    `json:"id"`
	Object  string    `json:"object"`
	Created float64   `json:"created"`
	Model   string    `json:"model"`
	Choices []Choices `json:"choices"`
	Usage   Usage     `json:"usage"`
}

type ImageURL

type ImageURL struct {
	URL string `json:"url"`
}

type Message

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

type MessageRequest

type MessageRequest struct {
	Role    string    `json:"role"`
	Content []Content `json:"content"`
}

type ServicePromGPTResponse

type ServicePromGPTResponse struct {
	GPT4PromptResponse
	UserID string `json:"user_id"`
}

type ServicePromptRequest

type ServicePromptRequest struct {
	Model       string           `json:"model"`
	ServiceName string           `json:"service_name"`
	Temperature float64          `json:"temperature"`
	MaxTokens   int              `json:"max_tokens"`
	TopP        float64          `json:"top_p"`
	Messages    []MessageRequest `json:"messages"`
}

type Usage

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

func ToCoreUsage

func ToCoreUsage(u gpt4_webservice.Usage) Usage

type UserPromGPTResponse

type UserPromGPTResponse struct {
	GPT4PromptResponse
	UserID string `json:"user_id"`
}

type UserPromtGPTRequest

type UserPromtGPTRequest struct {
	Content []Content `json:"content"`
	UserID  string    `json:"user_id"`
}

type UserTokenUsage

type UserTokenUsage struct {
	TokenLimit int  `json:"token_limit"`
	TokenUsage int  `json:"token_usage"`
	Warning    bool `json:"warning"`
}

Jump to

Keyboard shortcuts

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