Skip to content

Commit

Permalink
[Obs AI Assistant] Revert changes to the stateful test (elastic#202926)
Browse files Browse the repository at this point in the history
  • Loading branch information
viduni94 committed Jan 13, 2025
1 parent e3c7e43 commit 5a735cf
Showing 1 changed file with 26 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,32 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
});

it('the docs have semantic_text embeddings', async () => {
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,
},
]);
});
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 5a735cf

Please sign in to comment.