Skip to content

Commit

Permalink
[Obs AI Assistant] Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
viduni94 committed Jan 13, 2025
1 parent 36b628e commit 5bad10e
Showing 1 changed file with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const es = getService('es');
const esArchiver = getService('esArchiver');
const observabilityAIAssistantAPIClient = getService('observabilityAIAssistantAPIClient');
const retry = getService('retry');

const archive =
'x-pack/test/functional/es_archives/observability/ai_assistant/knowledge_base_8_15';
Expand Down Expand Up @@ -92,32 +93,34 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});

it('the docs have semantic_text embeddings', async () => {
const hits = await getKnowledgeBaseEntries();
const hasSemanticTextEmbeddings = hits.every((hit) => hit._source?.semantic_text);
expect(hasSemanticTextEmbeddings).to.be(true);

expect(
orderBy(hits, '_source.title').map(({ _source }) => {
const { text, inference } = _source?.semantic_text!;

return {
text,
inferenceId: inference.inference_id,
chunkCount: inference.chunks.length,
};
})
).to.eql([
{
text: 'To infinity and beyond!',
inferenceId: AI_ASSISTANT_KB_INFERENCE_ID,
chunkCount: 1,
},
{
text: "The user's favourite color is blue.",
inferenceId: AI_ASSISTANT_KB_INFERENCE_ID,
chunkCount: 1,
},
]);
await retry.try(async () => {
const hits = await getKnowledgeBaseEntries();
const hasSemanticTextEmbeddings = hits.every((hit) => hit._source?.semantic_text);
expect(hasSemanticTextEmbeddings).to.be(true);

expect(
orderBy(hits, '_source.title').map(({ _source }) => {
const { text, inference } = _source?.semantic_text!;

return {
text,
inferenceId: inference.inference_id,
chunkCount: inference.chunks.length,
};
})
).to.eql([
{
text: 'To infinity and beyond!',
inferenceId: AI_ASSISTANT_KB_INFERENCE_ID,
chunkCount: 1,
},
{
text: "The user's favourite color is blue.",
inferenceId: AI_ASSISTANT_KB_INFERENCE_ID,
chunkCount: 1,
},
]);
});
});

it('returns entries correctly via API', async () => {
Expand Down

0 comments on commit 5bad10e

Please sign in to comment.