AI#
Feature coverage table:
| Feature | OpenAI | vLLM Prefix Caching | LM Studio | Transformers | |
|---|---|---|---|---|---|
| Prompt | ✅ | ✅ | ✅ | ✅ | x |
| Embedding | ✅ | x | x | ✅ | ✅ |
| Classification | x | x | x | x | ✅ |
| Image Classification | x | x | x | x | ✅ |
Note
Open an issue on our GitHub if you would like to see support for a feature.
Functions#
prompt #
prompt(messages: list[Expression] | Expression, return_format: BaseModel | None = None, *, system_message: str | None = None, provider: Literal['openai'] | OpenAIProvider, model: str | None = None, **options: Unpack[OpenAIPromptOptions]) -> Expression
prompt(messages: list[Expression] | Expression, return_format: BaseModel | None = None, *, system_message: str | None = None, provider: str | None, model: str | None = None, **options: Unpack[PromptOptions]) -> Expression
prompt(messages: list[Expression] | Expression, return_format: BaseModel | None = None, *, system_message: str | None = None, provider: str | Provider | None = None, model: str | None = None, **options: Any) -> Expression
Returns an expression that prompts a large language model using the specified model and provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
messages | list[Expression] | Expression | The list of messages to prompt the model with. Each expression can be either: - Plain text strings (always treated as input_text) - Image data (numpy arrays, bytes, or File objects - detected by MIME type) - Files (PDF, TXT, HTML, audio, video, etc.) as bytes or File objects (detected by MIME type) | required |
return_format | BaseModel | None | The return format for the prompt. Use a Pydantic model for structured outputs. | None |
system_message | str | None | The system message for the prompt. | None |
provider | str | Provider | None | The provider to use for the prompt (default: "openai"). | None |
model | str | None | The model to use for the prompt. | None |
**options | Any | Any additional options to pass for the prompt. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
Expression | String Expression | An expression representing the prompt result. |
Examples:
Basic Usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
╭───────────────────────────────────────────┬─────────────────────────────────────────────────────────╮
│ quote ┆ response │
╞═══════════════════════════════════════════╪═════════════════════════════════════════════════════════╡
│ I am going to be the king of the pirates! ┆ **Anime Name:** *One Piece* │
│ ┆ **Character:** Monkey D. Luffy │
│ ┆ **Quote:** "I am going to be the king of the pirates!"… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ I'm going to be the next Hokage! ┆ **Name:** Naruto │
│ ┆ **Character:** Naruto Uzumaki │
│ ┆ **Quote:** *"I'm going to be the next Hokage!"* │
│ ┆ │
│ ┆ This quote refl… │
╰───────────────────────────────────────────┴─────────────────────────────────────────────────────────╯ Structured Outputs with Custom OpenAI Provider:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
╭───────────────────────────────────────────┬───────────┬─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ quote ┆ show ┆ character ┆ explanation │
╞═══════════════════════════════════════════╪═══════════╪═════════════════╪════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│ I am going to be the king of the pirates! ┆ One Piece ┆ Monkey D. Luffy ┆ Luffy famously states his dream of becoming the Pirate King throughout the series. │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ I'm going to be the next Hokage! ┆ Naruto ┆ Naruto Uzumaki ┆ The phrase 'I'm going to be the next Hokage!' is a recurring aspiration in the *Naruto* series, particularly voiced b… │
╰───────────────────────────────────────────┴───────────┴─────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
(Showing first 2 of 2 rows) Source code in daft/functions/ai/__init__.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | |
embed_text #
embed_text(text: Expression, *, provider: str | Provider | None = None, model: str | None = None, dimensions: int | None = None, **options: Unpack[EmbedTextOptions]) -> Expression
Returns an expression that embeds text using the specified embedding model and provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | String Expression | The input text column expression. | required |
provider | str | Provider | None | The provider to use for the embedding model. If None, the default provider is used. | None |
model | str | None | The embedding model to use. Can be a model instance or a model name. If None, the default model is used. | None |
dimensions | int | None | Number of dimensions the output embeddings should have, if the provider and model support specifying. If None, will use the default for the model. | None |
**options | Unpack[EmbedTextOptions] | Any additional options to pass for the model. | {} |
Note
Make sure the required provider packages are installed (e.g. vllm, transformers, openai).
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Embedding Expression | An expression representing the embedded text vectors. |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
╭────────────────────────────────┬────────────────────────────────┬───────────────────┬──────────────────────────╮
│ text ┆ meta ┆ red_pajama_subset ┆ embeddings │
│ --- ┆ --- ┆ --- ┆ --- │
│ String ┆ String ┆ String ┆ Embedding[Float32; 384] │
╞════════════════════════════════╪════════════════════════════════╪═══════════════════╪══════════════════════════╡
│ Григорианският календар (поня… ┆ {'title': 'Григориански кален… ┆ wikipedia ┆ ▃▆█▆▆▆█▇▆▅▃▆▆▅▅▆▅▅▂▂▇▇▄▁ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ GNU General Public License (н… ┆ {'title': 'GNU General Public… ┆ wikipedia ┆ ▆▁▇█▄▅▄▅▄▄▁▆▃▅▂▃▆▃▄▃█▆▇▅ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Лицензът за свободна документ… ┆ {'title': 'Лиценз за свободна… ┆ wikipedia ┆ ▄▆██▇▇▇█▇▆▂▇▄▁▅▃▇▇▃▃▆▆▅▂ │
╰────────────────────────────────┴────────────────────────────────┴───────────────────┴──────────────────────────╯
(Showing first 3 of 3 rows) Source code in daft/functions/ai/__init__.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
embed_image #
embed_image(image: Expression, *, provider: str | Provider | None = None, model: str | None = None, **options: Unpack[EmbedImageOptions]) -> Expression
Returns an expression that embeds images using the specified image model and provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image | Image Expression | The input image column expression. | required |
provider | str | Provider | None | The provider to use for the image model. If None, the default provider is used. | None |
model | str | None | The image model to use. Can be a model instance or a model name. If None, the default model is used. | None |
**options | Unpack[EmbedImageOptions] | Any additional options to pass for the model. | {} |
Note
Make sure the required provider packages are installed (e.g. vllm, transformers, openai).
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Embedding Expression | An expression representing the embedded image vectors. |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
╭────────────────────────────────┬─────────┬───────────────┬──────────────┬───────────────────────┬──────────────────────────╮
│ path ┆ size ┆ image_bytes ┆ image_type ┆ image_resized ┆ image_embeddings │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ String ┆ Int64 ┆ Binary ┆ Image[MIXED] ┆ Image[RGB; 288 x 288] ┆ Embedding[Float32; 768] │
╞════════════════════════════════╪═════════╪═══════════════╪══════════════╪═══════════════════════╪══════════════════════════╡
│ hf://datasets/datasets-exampl… ┆ 113469 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ ▃▅▅▆▆▂▅▆▅▇█▂▂▄▅▂▆▃▃▅▁▇▃▅ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/datasets-exampl… ┆ 206898 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ ▃▃▄▆▄▅▃▄▅▅▅▃▂▇▁▁▁▂▃▅▄█▃▅ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/datasets-exampl… ┆ 1871034 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ ▂▃▃▃▄▄▃▆▆▄▅▂▁▃▁▄▃▅▄▄▂█▆▆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/datasets-exampl… ┆ 22022 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ ▄▂▂▅▆▆▅▇▆▄▅▆▃▅▅▁▃▄▄▄▃█▃▆ │
╰────────────────────────────────┴─────────┴───────────────┴──────────────┴───────────────────────┴──────────────────────────╯
(Showing first 4 of 4 rows) Source code in daft/functions/ai/__init__.py
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 | |
classify_text #
classify_text(text: Expression, labels: Label | list[Label], *, provider: str | Provider | None = None, model: str | None = None, **options: Unpack[ClassifyTextOptions]) -> Expression
Returns an expression that classifies text using the specified model and provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | String Expression | The input text column expression. | required |
labels | str | list[str] | Label(s) for classification. | required |
provider | str | Provider | None | The provider to use for the embedding model. By default this will use 'transformers' provider | None |
model | str | None | The classifier model to use. Can be a model instance or a model name. By default this will use | None |
**options | Unpack[ClassifyTextOptions] | Any additional options to pass for the model. | {} |
Note
Make sure the required provider packages are installed (e.g. vllm, transformers, openai).
Returns:
| Name | Type | Description |
|---|---|---|
Expression | String Expression | An expression representing the most-probable label string. |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
╭─────────────────────┬───────────╮
│ text ┆ label │
│ --- ┆ --- │
│ String ┆ String │
╞═════════════════════╪═══════════╡
│ Daft is wicked fast!┆ Positive │
╰─────────────────────┴───────────╯
(Showing first 1 of 1 rows) Source code in daft/functions/ai/__init__.py
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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
classify_image #
classify_image(image: Expression, labels: Label | list[Label], *, provider: str | Provider | None = None, model: str | None = None, **options: Unpack[ClassifyImageOptions]) -> Expression
Returns an expression that classifies images using the specified model and provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image | Image Expression | The input image column expression. | required |
labels | str | list[str] | Label(s) for classification. | required |
provider | str | Provider | None | The provider to use for the embedding model. By default this will use 'transformers' provider | None |
model | str | None | The classifier model to use. Can be a model instance or a model name. By default this will use | None |
**options | Unpack[ClassifyImageOptions] | Any additional options to pass for the model. | {} |
Note
Make sure the required provider packages are installed (e.g. vllm, transformers, openai).
Returns:
| Name | Type | Description |
|---|---|---|
Expression | String Expression | An expression representing the most-probable label string. |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
╭────────────────────────────────┬─────────┬────────────────┬──────────────┬───────────────────────┬───────────────╮
│ path ┆ size ┆ image_bytes ┆ image_type ┆ image_resized ┆ image_labels │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ String ┆ Int64 ┆ Binary ┆ Image[MIXED] ┆ Image[RGB; 288 x 288] ┆ String │
╞════════════════════════════════╪═════════╪════════════════╪══════════════╪═══════════════════════╪═══════════════╡
│ hf://datasets/datasets-exampl… ┆ 113469 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ bulbasaur │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/datasets-exampl… ┆ 206898 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ catapie │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/datasets-exampl… ┆ 1871034 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ voltorb │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/datasets-exampl… ┆ 22022 ┆ ... ┆ <Image> ┆ <FixedShapeImage> ┆ electrode │
╰────────────────────────────────┴─────────┴────────────────┴──────────────┴───────────────────────┴───────────────╯
(Showing first 4 of 4 rows) Source code in daft/functions/ai/__init__.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
Model Protocols#
Prompter #
Protocol for prompt/chat completion implementations.
Methods:
| Name | Description |
|---|---|
prompt | Generates responses for a batch of message strings. |
prompt #
prompt(messages: tuple[Any, ...]) -> Any
Generates responses for a batch of message strings.
Source code in daft/ai/protocols.py
85 86 87 | |
TextEmbedder #
Protocol for text embedding implementations.
Methods:
| Name | Description |
|---|---|
embed_text | Embeds a batch of text strings into an embedding vector. |
embed_text #
embed_text(text: list[str]) -> list[Embedding] | Awaitable[list[Embedding]]
Embeds a batch of text strings into an embedding vector.
Source code in daft/ai/protocols.py
18 19 | |
TextEmbedderDescriptor #
Descriptor for a TextEmbedder implementation.
Methods:
| Name | Description |
|---|---|
get_dimensions | Returns the dimensions of the embeddings produced by the described TextEmbedder. |
is_async | Whether the described TextEmbedder produces awaitable results. |
get_dimensions #
get_dimensions() -> EmbeddingDimensions
Returns the dimensions of the embeddings produced by the described TextEmbedder.
Source code in daft/ai/protocols.py
25 26 27 | |
is_async #
is_async() -> bool
Whether the described TextEmbedder produces awaitable results.
Source code in daft/ai/protocols.py
29 30 31 | |
ImageEmbedder #
Protocol for image embedding implementations.
Methods:
| Name | Description |
|---|---|
embed_image | Embeds a batch of images into an embedding vector. |
embed_image #
embed_image(images: list[Image]) -> list[Embedding] | Awaitable[list[Embedding]]
Embeds a batch of images into an embedding vector.
Source code in daft/ai/protocols.py
38 39 40 | |
ImageEmbedderDescriptor #
Descriptor for an ImageEmbedder implementation.
Methods:
| Name | Description |
|---|---|
get_dimensions | Returns the dimensions of the embeddings produced by the described ImageEmbedder. |
is_async | Whether the described ImageEmbedder produces awaitable results. |
get_dimensions #
get_dimensions() -> EmbeddingDimensions
Returns the dimensions of the embeddings produced by the described ImageEmbedder.
Source code in daft/ai/protocols.py
46 47 48 | |
is_async #
is_async() -> bool
Whether the described ImageEmbedder produces awaitable results.
Source code in daft/ai/protocols.py
50 51 52 | |
TextClassifier #
Protocol for text classification implementations.
Methods:
| Name | Description |
|---|---|
classify_text | Classifies a batch of text strings using the given label(s). |
classify_text #
classify_text(text: list[str], labels: Label | list[Label]) -> list[Label]
Classifies a batch of text strings using the given label(s).
Source code in daft/ai/protocols.py
59 60 61 | |
TextClassifierDescriptor #
Descriptor for a TextClassifier implementation.
Providers#
Provider #
Provider is the base class for resolving implementations for the various AI/ML protocols.
Handles integration with model providers such as OpenAI, LM Studio, Hugging Face Transformers, etc. Provides a unified interface for model access and execution regardless of the underlying implementation.
Note
We will need to move instantiation from the TextEmbedderDesriptor to the Provider or other. It is not set at the moment, and instantiation directly from the descriptor is the easiest. We could opt to include a factory method location (descriptor's init) in the serialization.
Methods:
| Name | Description |
|---|---|
get_image_classifier | Returns an ImageClassifierDescriptor for this provider. |
get_image_embedder | Returns an ImageEmbedderDescriptor for this provider. |
get_prompter | Returns a PrompterDescriptor for this provider. |
get_text_classifier | Returns a TextClassifierDescriptor for this provider. |
get_text_embedder | Returns a TextEmbedderDescriptor for this provider. |
Attributes:
| Name | Type | Description |
|---|---|---|
name | str | Returns the provider's name. |
get_image_classifier #
get_image_classifier(model: str | None = None, **options: Unpack[ClassifyImageOptions]) -> ImageClassifierDescriptor
Returns an ImageClassifierDescriptor for this provider.
Source code in daft/ai/provider.py
135 136 137 138 139 | |
get_image_embedder #
get_image_embedder(model: str | None = None, **options: Unpack[EmbedImageOptions]) -> ImageEmbedderDescriptor
Returns an ImageEmbedderDescriptor for this provider.
Source code in daft/ai/provider.py
129 130 131 132 133 | |
get_prompter #
get_prompter(model: str | None = None, return_format: Any | None = None, system_message: str | None = None, **options: Unpack[PromptOptions]) -> PrompterDescriptor
Returns a PrompterDescriptor for this provider.
Source code in daft/ai/provider.py
147 148 149 150 151 152 153 154 155 | |
get_text_classifier #
get_text_classifier(model: str | None = None, **options: Unpack[ClassifyTextOptions]) -> TextClassifierDescriptor
Returns a TextClassifierDescriptor for this provider.
Source code in daft/ai/provider.py
141 142 143 144 145 | |
get_text_embedder #
get_text_embedder(model: str | None = None, dimensions: int | None = None, **options: Unpack[EmbedTextOptions]) -> TextEmbedderDescriptor
Returns a TextEmbedderDescriptor for this provider.
Source code in daft/ai/provider.py
123 124 125 126 127 | |
load_provider #
load_provider(provider: str, name: str | None = None, **options: Any) -> Provider
Source code in daft/ai/provider.py
94 95 96 97 | |
load_google #
load_google(name: str | None = None, **options: Unpack[GoogleProviderOptions]) -> Provider
Source code in daft/ai/provider.py
39 40 41 42 43 44 45 | |
load_lm_studio #
load_lm_studio(name: str | None = None, **options: Unpack[OpenAIProviderOptions]) -> Provider
Source code in daft/ai/provider.py
48 49 50 51 52 53 54 | |
load_openai #
load_openai(name: str | None = None, **options: Unpack[OpenAIProviderOptions]) -> Provider
Source code in daft/ai/provider.py
57 58 59 60 61 62 63 | |
load_transformers #
load_transformers(name: str | None = None, **options: Any) -> Provider
Source code in daft/ai/provider.py
66 67 68 69 70 71 72 | |
load_vllm_prefix_caching #
load_vllm_prefix_caching(name: str | None = None, **options: Any) -> Provider
Source code in daft/ai/provider.py
75 76 77 78 79 80 81 | |