Class Introduction
Function
Connects to the CLIP service to provide the text/image-to-vector embedding function. The class inherits the langchain_core.embeddings.Embeddings API.
Prototype
from mx_rag.embedding.service import CLIPEmbedding CLIPEmbedding(url, client_param)
Parameters
Parameter |
Data Type |
Required/Optional |
Description |
|---|---|---|---|
url |
String |
Required |
CLIP embedding service URL. The URL cannot exceed 128 characters. |
client_param |
ClientParam |
Optional |
HTTPS client configuration parameter. The default value is ClientParam(). For details, see ClientParam. |
Return Value
CLIPEmbedding object.
Example
from paddle.base import libpaddle
from mx_rag.embedding.service import CLIPEmbedding
from mx_rag.utils import ClientParam
clip_embed = CLIPEmbedding.create(url="https://ip:port/encode",
client_param=ClientParam(ca_file="/path/to/ca.crt"))
print(clip_embed.embed_documents(['abc', 'bcd']))
print(clip_embed.embed_query('abc'))
Parent topic: CLIPEmbedding