Documentation
¶
Index ¶
- type CloudflareClient
- type CloudflareEmbeddingFunction
- type CreateEmbeddingRequest
- type CreateEmbeddingResponse
- type Option
- func WithAPIToken(apiToken string) Option
- func WithAccountID(accountID string) Option
- func WithDefaultHeaders(headers map[string]string) Option
- func WithDefaultModel(model embeddings.EmbeddingModel) Option
- func WithEnvAPIToken() Option
- func WithEnvAccountID() Option
- func WithEnvGatewayEndpoint() Option
- func WithGatewayEndpoint(endpoint string) Option
- func WithHTTPClient(client *http.Client) Option
- func WithMaxBatchSize(size int) Option
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudflareClient ¶
type CloudflareClient struct {
BaseAPI string
APIToken string
AccountID string
DefaultModel embeddings.EmbeddingModel
IsGateway bool
MaxBatchSize int
DefaultHeaders map[string]string
Client *http.Client
// contains filtered or unexported fields
}
func NewCloudflareClient ¶
func NewCloudflareClient(opts ...Option) (*CloudflareClient, error)
func (*CloudflareClient) CreateEmbedding ¶
func (c *CloudflareClient) CreateEmbedding(ctx context.Context, req *CreateEmbeddingRequest) (*CreateEmbeddingResponse, error)
type CloudflareEmbeddingFunction ¶
type CloudflareEmbeddingFunction struct {
// contains filtered or unexported fields
}
func NewCloudflareEmbeddingFunction ¶
func NewCloudflareEmbeddingFunction(opts ...Option) (*CloudflareEmbeddingFunction, error)
func (*CloudflareEmbeddingFunction) EmbedDocuments ¶
func (e *CloudflareEmbeddingFunction) EmbedDocuments(ctx context.Context, documents []string) ([]embeddings.Embedding, error)
func (*CloudflareEmbeddingFunction) EmbedQuery ¶
func (e *CloudflareEmbeddingFunction) EmbedQuery(ctx context.Context, document string) (embeddings.Embedding, error)
type CreateEmbeddingRequest ¶
type CreateEmbeddingRequest struct {
Text []string `json:"text"`
}
func (*CreateEmbeddingRequest) JSON ¶
func (c *CreateEmbeddingRequest) JSON() (string, error)
type CreateEmbeddingResponse ¶
type Option ¶
type Option func(p *CloudflareClient) error
func WithAPIToken ¶
func WithAccountID ¶
func WithDefaultHeaders ¶
func WithDefaultModel ¶
func WithDefaultModel(model embeddings.EmbeddingModel) Option
func WithEnvAPIToken ¶
func WithEnvAPIToken() Option
func WithEnvAccountID ¶
func WithEnvAccountID() Option
func WithEnvGatewayEndpoint ¶
func WithEnvGatewayEndpoint() Option
func WithGatewayEndpoint ¶
func WithHTTPClient ¶
func WithMaxBatchSize ¶
Click to show internal directories.
Click to hide internal directories.