Repository navigation
AI functions: resolve credentials from ai_function_credentials setting instead of param - #106881
Conversation
ai_credentials settingai_credentials setting instead of param
|
Workflow [PR], commit [b22b16c] Summary: ✅
AI ReviewSummaryThis PR moves AI function credential selection from a leading named-collection argument to the Findings
Tests
Final VerdictStatus: Minimum required action: fix the |
3f72c49 to
4fc6760
Compare
d474d9c to
8c29f26
Compare
96c9988 to
7fe7a16
Compare
Drop the leading named-collection argument from `aiClassify`, `aiEmbed`, `aiGenerate`, `aiTranslate`, and `aiExtract`. The collection is now named by the new `ai_credentials` setting; an empty setting raises an exception. Update the test and docs. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…examples Add the new `ai_credentials` setting to `SettingsChangesHistory.cpp` so `02995_new_settings_history` passes. Rename the per-function doc example collection to `my_ai_credentials` to match the Configuration section. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…umns The collection is resolved live from `ai_credentials`, not captured in the column definition. `DEFAULT` columns need the setting in the inserting session; `MATERIALIZED` mutation-recompute needs it in a settings profile. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
After dropping the collection parameter, `instruction_or_schema` is the second argument, not the third. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The test called the old two-argument forms, so with an empty `ai_credentials` the queries failed as non-access errors and never exercised the `NAMED_COLLECTION` access check. Set `ai_credentials` to the collection and call the one-argument forms, including the zero-row variants. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
After dropping the collection argument, the second positional argument differs by function: `aiEmbed` takes a `UInt` dimensions and `aiClassify` an `Array(String)`, while `aiGenerate`/`aiExtract`/`aiTranslate` take a String. Since swapFuncs swaps the name only, group just the String-arg functions and drop the incompatible ones. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The functions check `allow_experimental_ai_functions` before resolving `ai_credentials`, so the examples failed with `SUPPORT_IS_DISABLED` on a default server. Set the flag in both example forms and add a disclaimer about experimental status near the top. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Drop the leading collection argument from every aiGenerate/aiClassify/ aiExtract/aiTranslate/aiEmbed call and pass the collection via the `ai_credentials` query setting instead. All 33 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`resolveAINamedCollection` ran per `executeImpl` (once per chunk) and re-read the setting each time. Read it once in the constructor (like `allow_experimental_ai_functions`), store it, and pass the collection name into `resolveAINamedCollection`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…mples Resolving ai_function_credentials runs a NAMED COLLECTION access check, so the profile recipe alone is insufficient. State the settings + grant requirements once up front. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
5af1092 to
6e2f501
Compare
Renamed to ai_function_credentials within the same unreleased cycle; the old name never shipped. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 152/157 (96.82%) | Lost baseline coverage: none · Uncovered code |
ai_credentials setting instead of paramai_function_credentials setting instead of param
The revert of #106881 removed the experimental-gate note from the AI functions documentation, but the `allow_experimental_ai_functions` setting predates #106881 and is still enforced by `FunctionBaseAI` and `FunctionAiEmbed` (they throw `SUPPORT_IS_DISABLED` when it is not set). Without the note, a user following the documentation hits the experimental-gate exception before named-collection resolution. Restore the note so the documented examples remain usable. This is independent of the reverted `ai_function_credentials` design. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
26.6 carries #106881 (credentials from `ai_function_credentials`), which master reverted and re-landed as #109232, so that setting is replaced by the two default-credentials settings. Keep 26.6's retry handling and converge `aiEmbed` to `aiEmbed(text, model[, params])` so the #110619 backport is not undone. Related: #112520 (comment) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The revert of ClickHouse#106881 removed the experimental-gate note from the AI functions documentation, but the `allow_experimental_ai_functions` setting predates ClickHouse#106881 and is still enforced by `FunctionBaseAI` and `FunctionAiEmbed` (they throw `SUPPORT_IS_DISABLED` when it is not set). Without the note, a user following the documentation hits the experimental-gate exception before named-collection resolution. Restore the note so the documented examples remain usable. This is independent of the reverted `ai_function_credentials` design. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Drop the leading named-collection argument from
aiClassify,aiEmbed,aiGenerate,aiTranslate, andaiExtract. The collection is now named by the newai_function_credentialssetting; an empty setting raises an exception. Update the test and docs.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add new
ai_function_credentialssetting for setting AI function credentials, instead of per-function parameter.Version info
26.6.1.1013