Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TokensCount ¶
func TokensCount(ctx context.Context, currToken *common.Token, tokensCountIn *TokensCountIn) (*[]TokensCountOut, error)
TokensCount returns quantity of tokens calculated by the model for every string in input array.
Types ¶
type ChatCompletionsIn ¶
type ChatCompletionsIn struct { // https://developers.sber.ru/docs/ru/gigachat/api/reference#post-chat-completions Model string `json:"model"` Messages []Message `json:"messages"` Temperature float64 `json:"temperature,omitempty"` TopP float64 `json:"top_p,omitempty"` N int64 `json:"n,omitempty"` Stream bool `json:"stream,omitempty"` MaxTokens int64 `json:"max_tokens,omitempty"` RepetitionPenalty float64 `json:"repetition_penalty,omitempty"` UpdateInterval float64 `json:"update_interval,omitempty"` }
Input chat/completions object.
type ChatCompletionsOut ¶
type ChatCompletionsOut struct { // https://developers.sber.ru/docs/ru/gigachat/api/reference#post-chat-completions Choices []Choice `json:"choices"` Created timehelper.UnixSec `json:"created"` Model string `json:"model"` Usage Usage `json:"usage"` Object string `json:"object"` }
Output chat/completions object.
func ChatCompletions ¶
func ChatCompletions(ctx context.Context, currToken *common.Token, chatCompletionsIn *ChatCompletionsIn) (*ChatCompletionsOut, error)
ChatCompletions returns the model's response taking into account the provided messages.
type Choice ¶
type Choice struct { Message Message `json:"message"` Index int32 `json:"index"` FinishReason string `json:"finish_reason"` }
Choice.
type Message ¶
type Message struct { // https://developers.sber.ru/docs/ru/gigachat/api/reference#post-chat-completions Role string `json:"role"` Content string `json:"content"` }
Message.
type Model ¶
type Model struct { // https://developers.sber.ru/docs/ru/gigachat/api/reference#get-models Id string `json:"id"` Object string `json:"object"` OwnedBy string `json:"owned_by"` }
Output model object.
type ModelsOut ¶
type ModelsOut struct { // https://developers.sber.ru/docs/ru/gigachat/api/reference#get-models-model Object string `json:"object"` Data []Model `json:"data"` }
Output models object.
type TokensCountIn ¶
type TokensCountIn struct { // https://developers.sber.ru/docs/ru/gigachat/api/reference#post-tokens-count Model string `json:"model"` Input []string `json:"input"` }
Input tokens/count object.
type TokensCountOut ¶
type TokensCountOut struct { // https://developers.sber.ru/docs/ru/gigachat/api/reference#post-tokens-count Object string `json:"object"` Tokens int `json:"tokens"` Characters int `json:"characters"` }
Output tokens/count object.
Click to show internal directories.
Click to hide internal directories.