Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotSetAuth = errors.New("API key not set")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for Baidu Qianfan embedding API using API Key authentication.
func (*Client) CreateEmbedding ¶
func (c *Client) CreateEmbedding(ctx context.Context, model string, texts []string) (*EmbeddingResponse, error)
CreateEmbedding sends an embedding request.
type EmbedData ¶
type EmbedData struct {
Object string `json:"object"`
Embedding []float32 `json:"embedding"`
Index int `json:"index"`
}
EmbedData represents embedding data in the response.
type EmbeddingRequest ¶
EmbeddingRequest represents a request to the embedding API.
type EmbeddingResponse ¶
type EmbeddingResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Data []EmbedData `json:"data"`
Model string `json:"model"`
Usage Usage `json:"usage"`
ErrorCode int `json:"error_code,omitempty"`
ErrorMsg string `json:"error_msg,omitempty"`
}
EmbeddingResponse represents a response from the embedding API.
type Option ¶
type Option func(*clientOptions)
Option is a function that configures a Client.
func WithBaseURL ¶
WithBaseURL sets the base URL for the API.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client for the API.
Click to show internal directories.
Click to hide internal directories.