Discover Packages
github.com/toriwasa/translate
go
domain
models
chat
completion
package
Version:
v1.0.8
Opens a new window with list of versions in this module.
Published: Nov 17, 2023
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
type Choice struct {
Index int `json:"index"`
Message Message `json:"message"`
FinishReason string `json:"finish_reason"`
}
type CompletionError struct {
Detail ErrorDetail `json:"error"`
}
error 型として扱えるように Error() メソッドを実装する
type Create struct {
Model string `json:"model"`
Messages []Messages `json:"messages"`
}
type ErrorDetail struct {
Message string `json:"message"`
Type string `json:"type"`
Param string `json:"param"`
Code string `json:"code"`
}
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
}
type Messages struct {
Role string `json:"role"`
Content string `json:"content"`
}
以下のJSONを元に構造体を定義する
{"model": "gpt-3.5-turbo-1106", "messages": [{"role": "user", "content": q}] }
type Result struct {
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
Model string `json:"model"`
Choices []Choice `json:"choices"`
Usage Usage `json:"usage"`
SystemFingerprint string `json:"system_fingerprint"`
}
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.