Documentation
¶
Index ¶
- Constants
- type ChatRequest
- type ChatResponse
- type Choice
- type Client
- func (c *Client) Auth() error
- func (c *Client) AuthWithContext(ctx context.Context) error
- func (c *Client) Chat(in *ChatRequest) (*ChatResponse, error)
- func (c *Client) ChatWithContext(ctx context.Context, in *ChatRequest) (*ChatResponse, error)
- func (c *Client) Model(model string) (*Model, error)
- func (c *Client) ModelWithContext(ctx context.Context, model string) (*Model, error)
- func (c *Client) Models() (*ModelListResponse, error)
- func (c *Client) ModelsWithContext(ctx context.Context) (*ModelListResponse, error)
- type Config
- type Message
- type Model
- type ModelListResponse
- type OAuthResponse
- type Token
- type Usage
Constants ¶
View Source
const ( AuthUrl = "https://ngw.devices.sberbank.ru:9443/api/" BaseUrl = "https://gigachat.devices.sberbank.ru/api/" OAuthPath = "v2/oauth" ModelsPath = "v1/models" ChatPath = "v1/chat/completions" )
View Source
const ( ScopeApiIndividual = "GIGACHAT_API_PERS" ScopeApiBusiness = "GIGACHAT_API_CORP" )
View Source
const ( UserRole = "user" AssistantRole = "assistant" SystemRole = "system" )
View Source
const (
ModelLatest = "GigaChat:latest"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatRequest ¶
type ChatRequest struct { Model string `json:"model"` Messages []Message `json:"messages"` Temperature *float64 `json:"temperature"` TopP *float64 `json:"top_p"` N *int64 `json:"n"` Stream *bool `json:"stream"` MaxTokens *int64 `json:"max_tokens"` RepetitionPenalty *float64 `json:"repetition_penalty"` UpdateInterval *int64 `json:"update_interval"` }
type ChatResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithConfig ¶
NewClientWithConfig creates a new GigaChat client with the specified configuration.
func NewInsecureClient ¶
NewInsecureClient creates a new GigaChat client with InsecureSkipVerify because GigaChat uses a weird certificate authority.
func (*Client) Chat ¶
func (c *Client) Chat(in *ChatRequest) (*ChatResponse, error)
func (*Client) ChatWithContext ¶
func (c *Client) ChatWithContext(ctx context.Context, in *ChatRequest) (*ChatResponse, error)
func (*Client) ModelWithContext ¶
func (*Client) Models ¶
func (c *Client) Models() (*ModelListResponse, error)
func (*Client) ModelsWithContext ¶
func (c *Client) ModelsWithContext(ctx context.Context) (*ModelListResponse, error)
type ModelListResponse ¶
type OAuthResponse ¶
Click to show internal directories.
Click to hide internal directories.