MCPcopy
hub / github.com/continuedev/continue / testRerank

Function testRerank

packages/openai-adapters/src/test/util.ts:30–51  ·  view source on GitHub ↗
(api: BaseLlmApi, model: string)

Source from the content-addressed store, hash-verified

28}
29
30export function testRerank(api: BaseLlmApi, model: string) {
31 test("should successfully rerank", async () => {
32 const response = await api.rerank({
33 model: model,
34 query: "What is the capital of spain?",
35 documents: [
36 "The capital of spain is Madrid",
37 "The largest breed of dog is the Great Dane",
38 ],
39 });
40 expect(response.model).toBe(model);
41 expect(response.object).toBe("list");
42 expect(response.data.length).toEqual(2);
43 response.data.forEach((val, index) => {
44 expect(val.index).toBe(index);
45 expect(typeof val.relevance_score).toBe("number");
46 });
47 expect(response.data[0].relevance_score).toBeGreaterThan(
48 response.data[1].relevance_score,
49 );
50 });
51}
52
53export function testFim(api: BaseLlmApi, model: string) {
54 test("should successfully fim", async () => {

Callers 1

testConfigFunction · 0.85

Calls 1

rerankMethod · 0.65

Tested by 1

testConfigFunction · 0.68