Documentation ¶
Index ¶
- Constants
- type APIError
- type Client
- func (c *Client) CreateEmbedding(ctx context.Context, texts *CreateEmbeddingRequest) (*CreateEmbeddingResponse, error)
- func (c *Client) GenerateContent(ctx context.Context, request *GenerateContentRequest) (*GenerateContentResponse, error)
- func (c *Client) Summarize(ctx context.Context, inputText string, maxLength int) (*SummarizeResponse, error)
- type CreateEmbeddingRequest
- type CreateEmbeddingResponse
- type GenerateContentRequest
- type GenerateContentResponse
- type Message
- type Role
- type StreamingResponse
- type SummarizeRequest
- type SummarizeResponse
Constants ¶
View Source
const ( RoleSystem = "system" RoleTypeUser = "user" RoleAssistant = "assistant" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateEmbedding ¶
func (c *Client) CreateEmbedding(ctx context.Context, texts *CreateEmbeddingRequest) (*CreateEmbeddingResponse, error)
CreateEmbedding creates an embedding from the given texts.
func (*Client) GenerateContent ¶
func (c *Client) GenerateContent(ctx context.Context, request *GenerateContentRequest) (*GenerateContentResponse, error)
GenerateContent generates text based on the given prompts.
type CreateEmbeddingRequest ¶
type CreateEmbeddingRequest struct {
Text []string `json:"text"`
}
type CreateEmbeddingResponse ¶
type GenerateContentRequest ¶
type GenerateContentRequest struct { Messages []Message `json:"messages"` Stream bool `json:"stream"` // StreamingFunc is a function to be called for each chunk of a streaming response. // Return an error to stop streaming early. StreamingFunc func(ctx context.Context, chunk []byte) error `json:"-"` }
type GenerateContentResponse ¶
type StreamingResponse ¶
type SummarizeRequest ¶
type SummarizeResponse ¶
Click to show internal directories.
Click to hide internal directories.