Repository navigation
Make model a required positional argument for aiEmbed - #110619
Conversation
`aiEmbed` now takes `model` only from the parameter map and no longer reads it from the named collection. The resolver distinguishes the two required-parameter cases so the error message points to the map. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [2e3bf11] Summary: ✅
AI ReviewSummaryThis PR moves Findings
Final VerdictStatus: |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
| model = 'gpt-4o-mini', | ||
| api_key = 'sk-...'; | ||
|
|
||
| -- `aiEmbed` does not read `model` from the named collection; pass it in the parameter map instead. |
There was a problem hiding this comment.
One could argue that the actually called model is identified by the model name and the endpoint (instead of just by the model name). But I suppose just using the model name is "safe enough".
There was a problem hiding this comment.
Yes, there is a tradeoff here in favor of ease-of-use
|
Since function requires an explicit model, let's make it part of the function signature This will minimize the need to use optional |
Change the aiEmbed signature to `aiEmbed(text, model[, params])`. `model` is now a required constant String positional argument, read only there: not from the parameter map, not from the named collection. This reverts the map-only `model` requirement and its resolver change in FunctionBaseAI. Tested: stateless 03300/04142/04492 and integration test_ai_functions (48 passed). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Update the `ai_function_embedding_default_credentials` setting doc and the AI functions doc: `aiEmbed` takes `model` as a required positional argument, not from the named collection. Drop the stale "endpoint and model differ" wording. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Previously an `aiEmbed` named collection that defined `model` was silently ignored. `resolveAIParams` now throws when the collection defines `model` but the function does not read it from the collection (i.e. aiEmbed, which takes `model` as a positional argument). Also drop the `isPlainString` wrapper in favor of a `static_cast` that selects the `isString(const IDataType &)` overload directly. Tested: stateless 03300/04142/04492 and integration test_ai_functions (49 passed). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`model` in the parameter map was already rejected as an unknown key. Give it a dedicated message pointing to the positional argument instead of the generic "unknown parameter". Behavior (BAD_ARGUMENTS) unchanged; covered by the existing 03300 case. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
aiEmbed changed to `aiEmbed(text, model[, params])`, so swapping its name with aiGenerate (`aiGenerate(text[, params])`) produced arity-mismatched calls that degenerate into NUMBER_OF_ARGUMENTS_DOESNT_MATCH. Split them into separate single-member swap groups; aiEmbed's arity matches no other AI function. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 63/63 (100.00%) · Uncovered code |
Resolve conflicts by adapting #110619 (make `model` a required positional argument for `aiEmbed`) onto the 26.5 AI-function API, where the named collection is the first positional argument and the parameter-map API of #109232 does not exist. The 26.5 signature becomes `aiEmbed(collection, text, model[, dimensions])`; a named collection that defines `model` is rejected for `aiEmbed` rather than silently ignored. The params-map-specific parts of the original change (Settings.cpp, QueryFuzzer.cpp, FunctionBaseAI parameter-map handling) do not apply to 26.5 and are dropped; tests and docs are adapted accordingly. tests/integration/test_ai_functions/test.py and 04492_ai_functions_default_credentials.sql do not exist in 26.5 and stay deleted.
Resolve cherry-pick conflicts for backporting #110619 (make `model` a required positional argument for `aiEmbed`) onto 26.6, where the AI functions use the older architecture: a single `ai_function_credentials` named collection and a positional `dimensions` argument instead of the parameter map. The signature on 26.6 becomes `aiEmbed(text, model[, dimensions])`: `model` is read only from the argument, and a named collection that defines `model` is rejected for `aiEmbed` rather than silently ignored. The default-credentials settings and the parameter map do not exist on 26.6, so those parts of the original change are dropped.
Cherry pick #110619 to 26.5: Make model a required positional argument for aiEmbed
Cherry pick #110619 to 26.6: Make model a required positional argument for aiEmbed
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]>
|
Recreating all the backports since they were stale (due to other backports landing between their creation and now). |
…uire-model-param-for-aiEmbed Make model a required positional argument for aiEmbed
aiEmbednow takesmodelas a required positional argument:aiEmbed(text, model[, params]). The model is read only from that argument — not from the parameter map, and not from the named collection (unlike the text functions, which still readmodelfrom the map or the collection).Example:
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
aiEmbedfunction now takesmodelas a required positional argument (aiEmbed(text, model[, params])) instead of reading it from the named collection. This ensures reproducibility for embeddings.