Load documents and embed text
Parse files from storage into document chunks, and create vector columns from extracted text with the managed embedding model.
This page explains how to configure an extract pipeline that parses documents into chunks and creates vector columns from extracted text.
Before you begin
- To read documents, create an S3, Google Cloud Storage, or SFTP connection. For more information, see Storage sources and destinations.
- To store vectors, use a destination that supports vector columns. For more information, see Choose a destination for vectors.
- To change the Blueprint, you need the Maintainer or Admin role in the Project.
Load documents from files
A Resource of an S3, Google Cloud Storage, or SFTP connection can read documents. Bobsled AI parses each file, cuts the text into chunks, and loads tables. To read documents, set source.format to document. The following Resource reads HTML filings and cuts them into chunks of at most 200 tokens:
spec_version: '1'
type: resource
name: filings
integration: reports
source:
path: "filings/**/*.htm"
format: document
parse:
formats: [html]
chunk:
max_tokens: 200
overlap_tokens: 0
replication:
method: incremental_append
cursor:
field: last_modified
output:
document_id:
type: stringparse.formats accepts pdf, docx, pptx, html, md, txt, and eml.
In HTML files and HTML email, Bobsled AI leaves out the content of plainly hidden elements. An example is the machine data of an Inline XBRL report.
Split a path with more than about 11,000 documents over more Resources. Set limits.max_files_per_run: 3000 from the start, so that a Resource that grows past this limit stops before it loads anything. For more information, see Pipeline file state.
Set chunk sizes
The chunk block accepts the following settings. Without the block, the defaults apply. For long reports, start with 200 tokens and no overlap.
With paragraph, chunks don't overlap and never exceed max_tokens. PDF text usually has no blank lines, so paragraph cuts it by size.
A changed chunk setting doesn't cut unchanged files again, and files that were read before keep their old text. To apply a change to them, run a full refresh.
Document tables
The run loads the following tables for the filings Resource:
Without a table_prefix, the prefix is the pipeline name and two underscores. A pipeline named load_filings loads load_filings__filings__chunks.
Chunk rows have no file path. To get source_uri, join the documents table on document_id.
The run counts of a document Resource are chunk rows. Some warehouses don't report loaded rows. The run then shows extracted rows and no loaded count.
When a file can't be read, the run has a warning. An example is "filings: 12 documents read, 2 could not be read." To see each file and its error, open the parse errors table.
Embed extracted text
Add an embed block to an extract pipeline to search text values by meaning. Bobsled AI runs the embedding stage between extraction and loading. Each configured field produces a vector column beside the original text.
This feature embeds extracted row values. It's separate from Blueprint semantic search, which searches deployed model and Project definitions.
Embedding suits text that users need to find by meaning rather than by exact words, such as the following:
- Meeting notes and transcripts.
- Support conversations.
- Document chunks.
- Issue descriptions and comments.
Before you configure embeddings, decide the following:
- Which text fields and Resources to embed.
- Whether each row has the right retrieval grain.
- How much cost and additional runtime are acceptable.
- Whether the text can be sent to the selected model.
The embed stage of one task must finish within 24 hours. For more information, see Pipeline embeddings.
Use the managed model
Bobsled AI recommends the managed embedding model. It needs no provider account and no Project secret.
To use the managed model, set provider: host. The following pipeline embeds the text field of the filings document Resource:
pipelines:
load_filings:
type: extract
schedule: manual
source: reports
destination: warehouse
resources:
- filings
runner: managed
embed:
provider: host
streams:
filings:
- field: textUse the Resource name under streams. For a document Resource, the block applies to its chunk table, and text is the only field. The vector column is text_embedding.
With provider: host, the embed fields follow these rules:
Each model call appears in AI usage under Pipelines, on the run that made it.
Declare the vector column in the source model, with the model that made it. Search by meaning refuses a vector column that doesn't name its model. The following column definition declares a 1,024-dimension vector made from the text column:
schema:
columns:
- name: text
type: VARCHAR
- name: text_embedding
type: VECTOR
dimension: 1024
embedded_from:
column: text
provider: <provider>
model: <model>Your Bobsled AI environment might use another managed model. For more information, see Balto models and data policies. Vectors from two models can't be compared. After a change of model, run a full refresh.
Some texts get no vector. Their rows still load with an empty vector. The following table lists the reasons:
The run has a warning with the count for each code. Blank texts aren't in the warning.
Only the first 32,000 characters of a text are embedded. The task log has one warning for each field with texts that were cut. The run's warnings don't show it.
Choose a destination for vectors
The following table lists the vector column type for each destination:
For Postgres, Bobsled AI tries to run CREATE EXTENSION IF NOT EXISTS vector, but it can't check this permission before a run. If the destination role can't create or use the extension, ask a database administrator to install pgvector. Then retry the run.
Validate and search embeddings
Use the exact Resource and field names from the source definition. Don't infer them from labels in the provider UI. Validate the Draft before publication.
You can also ask Balto to inspect an extract pipeline and add embeddings. Balto can recommend candidate text fields, explain retrieval grain and cost, and draft the embed configuration. Confirm the fields and the data-sharing policy before you save the change.
To search the loaded vectors, generate the query vector with the same embedding model. Then use the destination's vector-distance functions against the generated vector column. Bobsled AI doesn't provide a separate search screen for extracted row embeddings.
What's next
- Search by meaning: let Balto search a Snowflake table by meaning when a deployed model declares its vector column.
- Run and monitor pipelines: start the pipeline and read its run warnings.
- Limits: check file state and embedding limits before you size a Resource.
Storage sources and destinations
Read pipeline inputs from S3, Google Cloud Storage, or SFTP, write Parquet or copied files to storage, and read delivery receipts.
Exchange data with Partners
Learn how Partner delivery moves data between Accounts, find the guide for your task, and review Partner limits.