mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[obs AI Assistant] fix title_conversation failing test (#216112)](https://github.com/elastic/kibana/pull/216112) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"arturo.liduena@elastic.co"},"sourceCommit":{"committedDate":"2025-03-31T14:56:32Z","message":"[obs AI Assistant] fix title_conversation failing test (#216112)\n\nCloses #215952\n\n[obs AI Assistant] fix title_conversation failing test","sha":"3c9593b1a62aaa34922f27b2689699f2e545f37f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Obs AI Assistant","backport:version","v9.1.0","v8.19.0"],"title":"[obs AI Assistant] fix title_conversation failing test","number":216112,"url":"https://github.com/elastic/kibana/pull/216112","mergeCommit":{"message":"[obs AI Assistant] fix title_conversation failing test (#216112)\n\nCloses #215952\n\n[obs AI Assistant] fix title_conversation failing test","sha":"3c9593b1a62aaa34922f27b2689699f2e545f37f"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216112","number":216112,"mergeCommit":{"message":"[obs AI Assistant] fix title_conversation failing test (#216112)\n\nCloses #215952\n\n[obs AI Assistant] fix title_conversation failing test","sha":"3c9593b1a62aaa34922f27b2689699f2e545f37f"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
This commit is contained in:
parent
d8dd5d0ecc
commit
3a77581d58
1 changed files with 14 additions and 7 deletions
|
@ -11,19 +11,20 @@ import {
|
|||
TITLE_CONVERSATION_FUNCTION_NAME,
|
||||
TITLE_SYSTEM_MESSAGE,
|
||||
} from '@kbn/observability-ai-assistant-plugin/server/service/client/operators/get_generated_title';
|
||||
import { MessageRole } from '@kbn/observability-ai-assistant-plugin/common';
|
||||
import {
|
||||
LlmProxy,
|
||||
createLlmProxy,
|
||||
} from '../../../../../../../observability_ai_assistant_api_integration/common/create_llm_proxy';
|
||||
import { chatComplete } from '../../utils/conversation';
|
||||
import { chatComplete, clearConversations } from '../../utils/conversation';
|
||||
import type { DeploymentAgnosticFtrProviderContext } from '../../../../../ftr_provider_context';
|
||||
|
||||
export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) {
|
||||
const log = getService('log');
|
||||
const observabilityAIAssistantAPIClient = getService('observabilityAIAssistantApi');
|
||||
const es = getService('es');
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/215952
|
||||
describe.skip('when calling the title_conversation function', function () {
|
||||
describe('when calling the title_conversation function', function () {
|
||||
// Fails on MKI: https://github.com/elastic/kibana/issues/205581
|
||||
this.tags(['failsOnMKI']);
|
||||
let llmProxy: LlmProxy;
|
||||
|
@ -51,7 +52,8 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
|
|||
let conversationId: string;
|
||||
|
||||
before(async () => {
|
||||
void llmProxy.interceptTitle(TITLE);
|
||||
await clearConversations(es);
|
||||
const simulatorPromise = llmProxy.interceptTitle(TITLE);
|
||||
void llmProxy.interceptConversation('The sky is blue because of Rayleigh scattering.');
|
||||
|
||||
const res = await chatComplete({
|
||||
|
@ -64,7 +66,12 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
|
|||
|
||||
await llmProxy.waitForAllInterceptorsToHaveBeenCalled();
|
||||
|
||||
titleRequestBody = llmProxy.interceptedRequests[0].requestBody;
|
||||
const simulator = await simulatorPromise;
|
||||
titleRequestBody = simulator.requestBody;
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await clearConversations(es);
|
||||
});
|
||||
|
||||
it('makes 2 requests to the LLM', () => {
|
||||
|
@ -73,13 +80,13 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
|
|||
|
||||
it('sends the correct system message to the LLM for the title', () => {
|
||||
expect(
|
||||
titleRequestBody.messages.find((message) => message.role === 'system')?.content
|
||||
titleRequestBody.messages.find((message) => message.role === MessageRole.System)?.content
|
||||
).to.be(TITLE_SYSTEM_MESSAGE);
|
||||
});
|
||||
|
||||
it('sends the correct user message to the LLM for the title', () => {
|
||||
expect(
|
||||
titleRequestBody.messages.find((message) => message.role === 'user')?.content
|
||||
titleRequestBody.messages.find((message) => message.role === MessageRole.User)?.content
|
||||
).to.contain('Why the sky is blue?');
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue