Fix not using flash for next speaker check (#4016)
This commit is contained in:
parent
44ef0408f3
commit
b29c02dd34
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import { describe, it, expect, vi, beforeEach, Mock, afterEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach, Mock, afterEach } from 'vitest';
|
||||||
import { Content, GoogleGenAI, Models } from '@google/genai';
|
import { Content, GoogleGenAI, Models } from '@google/genai';
|
||||||
|
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
||||||
import { GeminiClient } from '../core/client.js';
|
import { GeminiClient } from '../core/client.js';
|
||||||
import { Config } from '../config/config.js';
|
import { Config } from '../config/config.js';
|
||||||
import { checkNextSpeaker, NextSpeakerResponse } from './nextSpeakerChecker.js';
|
import { checkNextSpeaker, NextSpeakerResponse } from './nextSpeakerChecker.js';
|
||||||
|
@ -231,4 +232,22 @@ describe('checkNextSpeaker', () => {
|
||||||
);
|
);
|
||||||
expect(result).toBeNull();
|
expect(result).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should call generateJson with DEFAULT_GEMINI_FLASH_MODEL', async () => {
|
||||||
|
(chatInstance.getHistory as Mock).mockReturnValue([
|
||||||
|
{ role: 'model', parts: [{ text: 'Some model output.' }] },
|
||||||
|
] as Content[]);
|
||||||
|
const mockApiResponse: NextSpeakerResponse = {
|
||||||
|
reasoning: 'Model made a statement, awaiting user input.',
|
||||||
|
next_speaker: 'user',
|
||||||
|
};
|
||||||
|
(mockGeminiClient.generateJson as Mock).mockResolvedValue(mockApiResponse);
|
||||||
|
|
||||||
|
await checkNextSpeaker(chatInstance, mockGeminiClient, abortSignal);
|
||||||
|
|
||||||
|
expect(mockGeminiClient.generateJson).toHaveBeenCalled();
|
||||||
|
const generateJsonCall = (mockGeminiClient.generateJson as Mock).mock
|
||||||
|
.calls[0];
|
||||||
|
expect(generateJsonCall[3]).toBe(DEFAULT_GEMINI_FLASH_MODEL);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Content, SchemaUnion, Type } from '@google/genai';
|
import { Content, SchemaUnion, Type } from '@google/genai';
|
||||||
|
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
||||||
import { GeminiClient } from '../core/client.js';
|
import { GeminiClient } from '../core/client.js';
|
||||||
import { GeminiChat } from '../core/geminiChat.js';
|
import { GeminiChat } from '../core/geminiChat.js';
|
||||||
import { isFunctionResponse } from './messageInspectors.js';
|
import { isFunctionResponse } from './messageInspectors.js';
|
||||||
|
@ -131,6 +132,7 @@ export async function checkNextSpeaker(
|
||||||
contents,
|
contents,
|
||||||
RESPONSE_SCHEMA,
|
RESPONSE_SCHEMA,
|
||||||
abortSignal,
|
abortSignal,
|
||||||
|
DEFAULT_GEMINI_FLASH_MODEL,
|
||||||
)) as unknown as NextSpeakerResponse;
|
)) as unknown as NextSpeakerResponse;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue