Skip to content

Backport #102922 to 26.5: Adding aiEmbed function - #108984

Merged
fm4v merged 1 commit into
26.5from
backport/26.5/102922
Jul 1, 2026
Merged

fm4v merged 1 commit into
26.5from
backport/26.5/102922

Conversation

@george-larionov

@george-larionov george-larionov commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

Backport of #102922 to 26.5.

Adds aiEmbed(collection, text[, dimensions]), an SQL function that returns a text embedding as Array(Float32). Like the existing AI functions it reads its provider, endpoint, model, and API key from a named collection, is gated behind allow_experimental_ai_functions, and participates in the shared per-query quotas (ai_function_max_input_tokens_per_query, ai_function_max_api_calls_per_query). The optional dimensions argument, when supported by the model, requests a specific output size; otherwise the model's native size is returned. Supported providers are the OpenAI-compatible ones (OpenAI, vLLM, Ollama, HuggingFace TEI); Anthropic is intentionally unsupported.

Unlike the other AI functions, aiEmbed batches within a single block of rows: up to ai_function_embedding_max_batch_size (default 100) inputs are sent in one HTTP request, then the response is matched back to input rows by index. NULL and empty-string rows are skipped from batches and produce [] without any HTTP call.

In this backport, introduced_in and the ai_function_embedding_max_batch_size settings-history entry are set to 26.5.

Changelog category (leave one):

  • Experimental Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Add aiEmbed function for using LLM APIs to generate embeddings from within ClickHouse.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.5.5.14

Backport of #102922.
`introduced_in` and the `ai_function_embedding_max_batch_size` settings-history
entry are set to 26.5.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@george-larionov
george-larionov marked this pull request as draft June 30, 2026 19:36
@clickhouse-gh

clickhouse-gh Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [96942be]

Summary: ✅

@george-larionov
george-larionov marked this pull request as ready for review June 30, 2026 19:54
@fm4v
fm4v merged commit 7f7dd20 into 26.5 Jul 1, 2026
34 checks passed
@fm4v
fm4v deleted the backport/26.5/102922 branch July 1, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants