Skip to content
Snippets Groups Projects
Commit e7206a7d authored by Sourabh Desai's avatar Sourabh Desai
Browse files

simplify test

parent 5cdab4e3
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,11 @@ import {
RetrievalCallbackResponse,
StreamCallbackResponse,
} from "../callbacks/CallbackManager";
import { ListIndex } from "../index/list";
import { ListIndex, ListRetrieverMode } from "../index/list";
import {
ResponseSynthesizer,
SimpleResponseBuilder,
} from "../ResponseSynthesizer";
import { mockEmbeddingModel, mockLlmGeneration } from "./utility/mockOpenAI";
// Mock the OpenAI getOpenAISession function during testing
......@@ -138,10 +142,19 @@ describe("CallbackManager: onLLMStream and onRetrieve", () => {
documents: [document],
serviceContext,
});
const queryEngine = listIndex.asQueryEngine();
const responseBuilder = new SimpleResponseBuilder(serviceContext);
const responseSynthesizer = new ResponseSynthesizer({
serviceContext: serviceContext,
responseBuilder,
});
const queryEngine = listIndex.asQueryEngine(
ListRetrieverMode.DEFAULT,
responseSynthesizer
);
const query = "What is the author's name?";
const response = await queryEngine.aquery(query);
expect(response.toString()).toBe("MOCK_TOKEN_1-MOCK_TOKEN_2");
console.log(JSON.stringify(streamCallbackData, null, 2));
expect(streamCallbackData).toEqual([
{
event: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment