Documentation
¶
Overview ¶
Package dashscopeembeddings implements Alibaba Model Studio's native multimodal embedding shape: input.contents, parameters.dimension, and results under output.embeddings.
Only the multimodal models use it. DashScope's text embeddings are served on the OpenAI-compatible endpoint, which is why the vendor's default protocol is the OpenAI one and the multimodal entries override it.
https://help.aliyun.com/zh/model-studio/multimodal-embedding-api-reference
Index ¶
- type Client
- func (c *Client) AcceptsImages() bool
- func (c *Client) BuildImageRequestBody(images []api.EmbedImage, _ api.EmbedInputType) map[string]any
- func (c *Client) BuildRequestBody(texts []string, _ api.EmbedInputType) map[string]any
- func (c *Client) Embed(ctx context.Context, texts []string, kind api.EmbedInputType) ([][]float32, error)
- func (c *Client) EmbedImages(ctx context.Context, images []api.EmbedImage, kind api.EmbedInputType) ([][]float32, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks DashScope's native multimodal embedding to one endpoint.
func (*Client) AcceptsImages ¶
AcceptsImages is always true: the image part is part of the schema.
func (*Client) BuildImageRequestBody ¶
func (c *Client) BuildImageRequestBody(images []api.EmbedImage, _ api.EmbedInputType) map[string]any
BuildImageRequestBody is the golden-test entry point for images. Each content is {"image": URL or "data:image/{format};base64,{data}"}.
func (*Client) BuildRequestBody ¶
BuildRequestBody is the golden-test entry point.
func (*Client) Embed ¶
func (c *Client) Embed( ctx context.Context, texts []string, kind api.EmbedInputType, ) ([][]float32, error)
Embed vectorizes one batch.
func (*Client) EmbedImages ¶
func (c *Client) EmbedImages( ctx context.Context, images []api.EmbedImage, kind api.EmbedInputType, ) ([][]float32, error)
EmbedImages vectorizes one batch of images, each its own vector.
type Config ¶
type Config struct {
Endpoint api.Endpoint
Settings api.EmbeddingsSettings
Dimensions int
Retry api.RetryPolicy
}
Config is everything the client needs, already resolved by the api.