Documentation
Guides

Search by meaning

Find rows in a warehouse table by what their text means, narrow them with filter conditions, and read each similarity score.

This page explains how to search one warehouse table by meaning with Balto, the API, or MCP. Ask what the text says, even when you don't know the exact words. Search works in chat, Background Agents, the API, and MCP. For the closest rows in each group, joins, or several texts in one query, see Rank by meaning in SQL.

The search compares your question with vectors that the table already stores, and returns the closest rows, best first.

Before you begin

  • Make sure that the table is a Snowflake table that a deployed source model or SQL model describes.
  • Make sure that the table has a searchable vector column. For more information, see Make a column searchable.
  • Make sure that you have read access to the Project. Anyone with read access can search every searchable table in the Project.

Make a column searchable

A column is searchable when the deployed Blueprint declares all of the following facts about it:

Field
Value
typeVECTOR
dimensionThe vector length of the managed embedding model
embedded_from.columnThe text column that the vector was made from
embedded_from.providerThe provider of the managed embedding model
embedded_from.modelThe model name
embedded_from.distance_metriccosine, or omitted

The following schema declares a searchable text_embedding column:

yaml
schema: columns: - name: text type: string - name: text_embedding type: VECTOR dimension: 1024 embedded_from: column: text provider: <provider> model: <model>

The question and the stored vectors must come from the same model. The provider, model, and vector length must match exactly. A column that your own embedding step made with that provider, model, and length is searchable too.

Bobsled AI refuses any other column and names the model that made it. It also refuses a column with no embedded_from.

get_blueprint_models and query context show embedding.searchable for each vector column. When the value is false, unsearchableReason gives the reason.

Search with Balto

In a chat, name the subject, the table if you know it, and the limits, as in the following example:

In the 2025 filings, find what banks say about losses on office loans. Quote the text.

Balto sends filter conditions with the search. The filters remove rows before the ranking starts. Balto uses SQL, not search, for counts, totals, dates, and exact matches.

Use the API

Send POST /api/v1/projects/:projectId/semantic-search. The caller needs data:read on the Project. The request body has the following fields:

Field
Meaning
tableThe model name or its SQL address
questionThe meaning to find, up to 2,000 characters
vectorColumns1 to 5 vector columns, each with an optional weight from 0.001 to 1,000
filter1 to 20 conditions on columns of the table. For more information, see Filter the rows.
columnsThe columns to return. The default is the first 50 columns that aren't vectors.
topKThe number of rows, from 1 to 50. The default is 10.
minimumSimilarityThe lowest similarity to return, from 0 to 1
connectionIdThe connection, when two connections hold the same table name

The following request returns the five passages from 2025 that are closest to the question:

json
{ "table": "filing_passages", "question": "losses on office loans", "vectorColumns": [{ "column": "text_embedding" }], "filter": [{ "column": "fiscal_year", "operator": "equals", "value": 2025 }], "columns": ["fiscal_year", "text"], "topK": 5 }

For MCP, call data_query with action: "search". For more information, see MCP workflows.

Filter the rows

filter is a list. Every item must be true for a row to stay. An item is one condition, or a group of 2 to 10 conditions in any, of which one must be true.

The following filter keeps rows filed in 2025 that have a matching topic or title:

json
[ { "column": "filed_on", "operator": "between", "values": ["2025-01-01", "2025-12-31"] }, { "any": [ { "column": "topic", "operator": "in", "values": ["credit", "capital"] }, { "column": "title", "operator": "contains", "value": "office loans" } ] } ]

The following table lists the operators:

Operator
Operand
Keeps a row when the column
equalsvalueEquals the value
not_equalsvalueDiffers from the value, or has no value
less_than, less_or_equal, greater_than, greater_or_equalvalueCompares that way. Not for true and false columns.
betweenTwo valuesLies between them, both included
in1 to 1,000 valuesEquals one of them
not_in1 to 1,000 valuesEquals none of them, or has no value
contains, starts_withvalueHolds, or starts with, the exact text. Upper and lower case count as the same. Text columns only.
is_null, is_not_nullNoneHas no value, or has one

The type of the warehouse column decides how Bobsled AI reads a value:

Column
Value
TextText. equals, in, and the comparisons treat upper and lower case as different.
NumberA number. Write a number with more than 15 digits as text.
True or falsetrue or false
Date2025-01-31
Time without a zone2025-01-31T13:45:00, or a date for midnight
Time with a zone2025-01-31T13:45:00Z, or with an offset such as +02:00

A filter has the following limits:

  • A number, true, or false can also be sent as text.
  • One value holds up to 2,000 characters.
  • A filter holds up to 2,000 values and 60,000 characters in total.
  • Other column types, such as semi-structured, array, and vector columns, can't be filtered.

A condition can't compare two columns, use an expression on a column, or read a path inside semi-structured data. For a join or the closest rows in each group, use SQL that ranks by meaning. For the other cases, and for a pattern, run a query first. Then search with in on the identifiers that the query returned.

Filter values and the question vector go to Snowflake as bound values, outside the SQL text.

Note

Snowflake lets readers of its query history see bound values unless the account turns that off with ALLOW_BIND_VALUES_ACCESS. The setting is on by default.

Read the result

The response has the following fields:

Field
Meaning
rowsThe rows, best first. The first column is the similarity.
similarityColumnThe name of that column. It's search_similarity when a returned column is called similarity.
executedSqlThe SQL. Each ? stands for a filter value or the question vector, so this text doesn't run as a query.
embeddingModelThe model that made the question vector
limitReachedtrue when the search returned as many rows as topK allows
cutCellsEach text that Bobsled AI cut at 4,000 characters, with its full length

The similarity runs from 0 to 1. It ranks the rows of one search. It isn't a probability, and scores from two searches don't compare. Low scores can mean that the table holds nothing that matches the question. The model can return slightly different numbers for the same question, so a score can change in its fifth decimal place.

With several vector columns, the similarity is the weighted sum of the column similarities. The weights always add up to 1. Bobsled AI drops a row that has no value in a searched column, or that stores a vector of zeros.

You can't export a search result, refresh it, or use it in an Artifact. To read the same rows, use SQL with their identifiers.

Rank by meaning in SQL

A search returns one list from one table. For other result shapes, Balto writes SQL that ranks by meaning. Use it for the following:

  • The closest rows in each group, such as the 3 closest tickets in each region.
  • A join over several tables.
  • Several different texts in one query.
  • A score that combines the similarity with other columns.

The SQL holds a placeholder, {{embedding:name}}, where the vector of a text belongs. Balto sends each text and its name with the SQL. Bobsled AI turns each text into a vector, binds the vector in place of each placeholder, and then runs the query. On Snowflake, the similarity is VECTOR_COSINE_SIMILARITY(column, {{embedding:name}}).

For example, a user asks for the 3 closest support tickets in each region. The text is "customer asks for money back after a late delivery". Balto writes SQL similar to the following:

sql
SELECT region, ticket_id, subject, VECTOR_COSINE_SIMILARITY(body_embedding, {{embedding:refund}}) AS similarity FROM ANALYTICS.SUPPORT.TICKETS QUALIFY ROW_NUMBER() OVER (PARTITION BY region ORDER BY similarity DESC) <= 3

To run the same query through the API, send the following body to POST /api/v1/projects/:projectId/semantic-sql:

json
{ "sql": "SELECT region, ticket_id, subject, VECTOR_COSINE_SIMILARITY(body_embedding, {{embedding:refund}}) AS similarity FROM ANALYTICS.SUPPORT.TICKETS QUALIFY ROW_NUMBER() OVER (PARTITION BY region ORDER BY similarity DESC) <= 3", "embeddings": [ { "name": "refund", "text": "customer asks for money back after a late delivery" } ] }

The caller needs data:read on the Project. In MCP, call data_query with action: "semantic_sql". In chat and Background Agents, Balto uses the semantic_sql tool.

The following table describes the request fields:

Field
Description
sqlOne read-only Snowflake query with one or more placeholders.
embeddings1 to 10 texts. Each has a name and a text of up to 2,000 characters.
maxRowsThe maximum number of rows to return, as for a query.
connectionIdThe connection, when two connections hold the same table name.

Follow these rules when you write the SQL:

  • Write a placeholder only as a direct argument of VECTOR_COSINE_SIMILARITY. Bobsled AI refuses a placeholder that is selected, cast, passed to another function, or written in a string, a quoted name, or a comment.
  • Give every placeholder an entry in embeddings, and use every entry. A name can appear more than once.
  • Start each name with a letter. A name holds up to 32 letters, digits, and underscores.
  • Don't write bind markers such as ? or :1.
  • Name each table by the full address of a deployed model, such as ANALYTICS.SUPPORT.TICKETS. Bobsled AI refuses other warehouse tables. It refuses a shorter name of a model and returns the full address.
  • Read at most 20 models in one query.
  • When two connections hold a model at the same address, pass connectionId.
  • Follow the same checks as for a query: one read-only statement on tables of the Project.
  • Give every selected column its own name.
  • Select the text column, not the vector column. Filter and limit the rows in the SQL.

Read the similarity as in a search. It ranks rows and isn't a probability. To compare rows whose vectors are both stored, such as rows compared with each other, use a plain query. No text needs a vector in that case.

Which vectors can be compared

The SQL doesn't say which column each placeholder meets, so Bobsled AI checks every table that the query reads:

  • Each table is a deployed model stored in Snowflake, named by its full address. Bobsled AI refuses live models.
  • Every vector column that the model declares is searchable, as described in Make a column searchable.
  • At least one such column exists, and all of them come from one managed embedding model.
  • The warehouse table holds no vector column that the model doesn't declare.

If a check fails, Bobsled AI refuses the query and names the model and column. The checks cover stored vector columns. Don't cast another column to a vector to compare it with a text.

Cost and stored results

Before Bobsled AI makes the vectors, it checks the query and runs it once with zero vectors and no rows. A refused query makes no embedding call. All texts of one query go to the model in one request. Usage counts as one search question, in the chat, the Background Agent run, or the Project.

executedSql shows each vector as a bound value, such as PARSE_JSON(?)::ARRAY::VECTOR(FLOAT, 1024). It holds no numbers of a vector. Vector cells in the rows show as their length. You can't export the result, refresh it, or use it in an Artifact. To read the same rows, use SQL with their identifiers.

The following table lists the errors and how to fix them:

Code
Action
placeholder_not_allowedMove the placeholder into SQL code, write it as {{embedding:name}}, and remove bind markers.
embedding_not_defined, embedding_not_usedMatch the placeholders and the entries in embeddings.
table_not_in_blueprint, vector_column_missingRead deployed models that have a searchable vector column.
text_not_allowedRemove the password, key, or other secret from the text.
statement_too_longShorten the SQL, or use fewer placeholders.
too_many_modelsRead at most 20 models in one query, or split the question.

Vectors in query results

Query results, row samples, exports, Artifacts, and Background Agents get a stored vector as its length, such as vector(1024). This also applies to run-query in the API and MCP. There's no setting to turn it off.

The following rules decide which columns show this way:

  • Snowflake vector columns always show this way. In file and cross-connection queries, fixed-size float arrays of 32 or more numbers also always show this way.
  • Other arrays, such as BigQuery arrays and Postgres vectors, show this way by declaration. A deployed model in the query must declare that column as a vector of that length. A declared length of 32 or more also matches a renamed column.
  • A query that joins two connections hides only declared vectors. Partner warehouse queries don't change.

To read the numbers in Snowflake, convert the vector in SQL with ARRAY_TO_STRING(text_embedding::ARRAY, ',').

Errors

The following table lists the error codes and the action for each. A refused search makes no embedding call.

Code
Action
embedding_model_not_managed, embedding_model_unknownSearch another column, or use SQL.
column_not_found, column_not_vectorCompare the Blueprint columns with the warehouse table.
filter_not_allowedCorrect the condition that the message names, such as filter[1].any[0].
query_failedCorrect the filter. When the failure shows no warehouse message, run a query with the same conditions.
name_not_supportedReturn columns without the named column.
search_too_longReturn fewer columns, or shorten the filter.
warehouse_not_supported, source_not_searchableUse SQL.
question_not_allowedRemove the password, key, or other secret from the question.
embedding_unavailableRetry once.

What's next

On this page