Retrieval

What is a retrieval UDF?

A retrieval UDF packages a similarity query so an agent or another column can call retrieval as a function.

Updated · Part of What is RAG?

How it works

  • The function names the query, the limit, and the columns to return.
  • Callers pass a question and get rows.
  • Agents can see it as a tool because it is a function, not an ad-hoc script.

What it is not

It is not raw SQL pasted into a prompt, and it is not a retriever object with no table underneath.

retrieval UDF: this, and the thing it is confused with

retrieval UDF: this, and the thing it is confused with
ThisNot this
InterfaceA functionA SQL string in the prompt
DataRows of a real table or viewA vector client with no source schema
ReuseHTTP, agents, and other columnsCopy-pasted into each handler

Where Pixeltable fits

Pixeltable uses @pxt.query for that function. pxt.tools() can expose it to an agent.

Questions

How does retrieval UDF work?
The function names the query, the limit, and the columns to return. Callers pass a question and get rows. Agents can see it as a tool because it is a function, not an ad-hoc script.
What is retrieval UDF often confused with?
It is not raw SQL pasted into a prompt, and it is not a retriever object with no table underneath.