feat: Add create_embeddings function to Jina client

- Added a `create_embeddings` function to the Jina client to
  generate embeddings for given input texts.
- Improved the `create_embeddings` function input parameters
  for better flexibility and error handling.
- Updated `TextEmbeddingInput` struct to handle optional
  parameters for embedding type, truncation type, and late
  chunking.  This improves the flexibility of the embedding
  generation process.
This commit is contained in:
Mahmoud Emad
2025-03-11 17:18:47 +02:00
parent 27c9018c48
commit b006bb1e41
3 changed files with 37 additions and 21 deletions

View File

@@ -2,5 +2,12 @@
import freeflowuniverse.herolib.clients.jina
jina_client := jina.get()!
println('jina: ${jina_client}')
mut jina_client := jina.get()!
embeddings := jina_client.create_embeddings(
input: ['Hello', 'World']
model: .embeddings_v3
task: 'separation'
) or { panic('Error while creating embeddings: ${err}') }
println('Created embeddings: ${embeddings}')