fix: Product Documentation function not available error (#212676)

## Summary
Closes [#212655](https://github.com/elastic/kibana/issues/212655)
FIX:
When a user asks a question about the Elastic stack, we expect the LLM
to request the `retrieve_elastic_doc` function. However, due to the
limit of number of functions we can register, it errors out because the
function is not available.


![Image](https://github.com/user-attachments/assets/585ee05d-f10b-4a03-b40b-a07b2148d11b)
This commit is contained in:
Arturo Lidueña 2025-03-05 12:43:16 +01:00 committed by GitHub
parent 85555042be
commit cb4e2023b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,6 +18,7 @@ export async function registerDocumentationFunction({
}: FunctionRegistrationParameters) { }: FunctionRegistrationParameters) {
const isProductDocAvailable = (await llmTasks.retrieveDocumentationAvailable()) ?? false; const isProductDocAvailable = (await llmTasks.retrieveDocumentationAvailable()) ?? false;
if (isProductDocAvailable) {
functions.registerInstruction(({ availableFunctionNames }) => { functions.registerInstruction(({ availableFunctionNames }) => {
return availableFunctionNames.includes(RETRIEVE_DOCUMENTATION_NAME) return availableFunctionNames.includes(RETRIEVE_DOCUMENTATION_NAME)
? `When asked questions about the Elastic stack or products, You should use the ${RETRIEVE_DOCUMENTATION_NAME} function before answering, ? `When asked questions about the Elastic stack or products, You should use the ${RETRIEVE_DOCUMENTATION_NAME} function before answering,
@ -25,6 +26,7 @@ export async function registerDocumentationFunction({
is always more up to date and accurate than any own internal knowledge you might have.` is always more up to date and accurate than any own internal knowledge you might have.`
: undefined; : undefined;
}); });
}
functions.registerFunction( functions.registerFunction(
{ {