Dashscope
DashScopeEmbedding #
Bases: MultiModalEmbedding
DashScope class for text embedding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name
|
str
|
Model name for embedding. Defaults to DashScopeTextEmbeddingModels.TEXT_EMBEDDING_V2. Options are:
|
TEXT_EMBEDDING_V2
|
text_type
|
str
|
The input type, ['query', 'document'], For asymmetric tasks such as retrieval, in order to achieve better retrieval results, it is recommended to distinguish between query text (query) and base text (document) types, clustering Symmetric tasks such as classification and classification do not need to be specially specified, and the system default value "document" can be used. |
'document'
|
api_key
|
str
|
The DashScope api key. |
None
|
Source code in llama-index-integrations/embeddings/llama-index-embeddings-dashscope/llama_index/embeddings/dashscope/base.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
|
get_batch_query_embedding #
get_batch_query_embedding(embedding_file_url: str) -> Optional[str]
Get batch query embeddings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embedding_file_url
|
str
|
The url of the file to embedding which with lines of text to embedding. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Optional[str]
|
The url of the embedding result, format ref: https://help.aliyun.com/zh/dashscope/developer-reference/text-embedding-async-api-details. |
Source code in llama-index-integrations/embeddings/llama-index-embeddings-dashscope/llama_index/embeddings/dashscope/base.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
get_batch_text_embedding #
get_batch_text_embedding(embedding_file_url: str) -> Optional[str]
Get batch text embeddings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embedding_file_url
|
str
|
The url of the file to embedding which with lines of text to embedding. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Optional[str]
|
The url of the embedding result, format ref: https://help.aliyun.com/zh/dashscope/developer-reference/text-embedding-async-api-details. |
Source code in llama-index-integrations/embeddings/llama-index-embeddings-dashscope/llama_index/embeddings/dashscope/base.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
|
get_multimodal_embedding #
get_multimodal_embedding(input: List[Dict], auto_truncation: bool = False) -> List[float]
Call DashScope multimodal embedding. ref: https://help.aliyun.com/zh/dashscope/developer-reference/one-peace-multimodal-embedding-api-details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
str
|
The input of the multimodal embedding, eg: [{'factor': 1, 'text': '你好'}, {'factor': 2, 'audio': 'https://dashscope.oss-cn-beijing.aliyuncs.com/audios/cow.flac'}, {'factor': 3, 'image': 'https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png'}] |
required |
Raises:
Type | Description |
---|---|
ImportError
|
Need install dashscope package. |
Returns:
Type | Description |
---|---|
List[float]
|
List[float]: The embedding result |
Source code in llama-index-integrations/embeddings/llama-index-embeddings-dashscope/llama_index/embeddings/dashscope/base.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
|