Embeddings Canonical Workflow
Introduction
The Embeddings Canonical Workflow goal is to generate embedding vectors for the chunks included in the documents it processes.
Currently, the workflow supports creating embedding vectors using the following options:
· AWS Bedrock models
· OpenAI-compatible models
· OLlama
· Switchboard
· Skip the embeddings creation and only create the subjobs
The Embeddings Canonical Workflow has multiple main stages: one stage for the workflow configuration and one stage for each of the supported embedding options.
For the instructions below, please request and reference the following files:
“workflow_embeddings canonical workflow_export.aspire” and
“pom.xml“
Workflow configuration
Each Canonical Workflow has a configuration script where initialization variables can be set or changed according to the needs of the client. This script is always at the very beginning of the workflow stages.
Also, all necessary external jars are preloaded in the provided “embeddings-workflow-1.0-all.jar” which needs to be loaded in the “External Resources” sections of the processing stages.
Please request and reference the file “embeddings_workflow-1.0_all 1.jar“
Configuration Variables
chunksFieldName
The name of the document field that contains the chunks to generate the embedding vectors. By default, the field name is “chunks”
embeddingsType
The name of the option to use to generate the embeddings; currently, only the options “bedrock”, “openai” and “none” are supported.
bedrockModel
In case of bedrock being used, enter the name of the model to use. Ignored if another option is configured.
useDefaultCredentialsProvider
Enable the use of the AWS default credentials provider; if not, AWS access and secret keys must be provided in the Bedrock script component
Components Configuration
Bedrock
In case of using the “bedrock” option without enabling the “useDefaultCredentialsProvider”, the access and secret keys must be provided in the script component; also, the AWS region can be changed if needed.
OpenAI
For the “openai” option, the following parameters must be configured in the component.
The apiKey must be entered in the “Scripts secrets” section of the Initialization tab.
In the Scripts secrets section of the Initialization tab, the openai endpoint, the version (optional), and the model name must be specified.
OLlama
For OLlama, both endpoint and model fields must be specified.
SwitchBoard
For SwitchBoard, both endpoint and model fields must be specified.
SwitchBoard also requires an “Application Id” to be configured. Do so in the “Processing” stage.
Lastly, this version of SwitchBoard requires OAuth to be configured inside the “getToken” method of the “Processing” stage.
Expected Input
Job input
Job variable name | Job variable description |
No requirements regarding the job inputs.
Document Input
Document variable name | Document variable description |
chunks | The objects containing the information of the text chunks to use to create the embeddings vector |
chunks.sectionName | The name of the chunk section |
chunks.paragraph | The text of the chunk |
chunks.chunkNumber | The chunk number based on the original text |
chunks.NumberOfWords | The number of words contained in the chunk paragraph. |
Input example:
Workflow output
Job Output
Job variable name | Job variable description |
No job output variables.
Document Output
Document variable name | Document variable description |
No document output variables.
SubJob Output
Document variable name | Document variable description |
id | ID of the subjob created by combining the ID of the parent job + the chunk number |
parentId | The ID of the parent job that was used to create the embedding vectors |
title | The title of the chunk |
originalText | The chunk of text that was used to create the vector. |
vectorContent | The embedding vector created using the originalText field. |
Limitations
No major limitations exists.
Errors and Troubleshooting
409 and other throttling-related errors
Depending on the configured account, there will be limits regarding the number of tokens to process; if these limits are reached, errors like 409 will be thrown.
Resource not found errors
If the model’s name or API version is misconfigured, errors related to resource not found can happen; verify if the API version used has not been retired.
Done!
Your workflow is now configured and ready to be used.