mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-18 14:00:27 -07:00
refactor(core): Migrate next speaker check to use BaseLlmClient (#8424)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { Content } from '@google/genai';
|
||||
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
||||
import type { GeminiClient } from '../core/client.js';
|
||||
import type { BaseLlmClient } from '../core/baseLlmClient.js';
|
||||
import type { GeminiChat } from '../core/geminiChat.js';
|
||||
import { isFunctionResponse } from './messageInspectors.js';
|
||||
|
||||
@@ -41,8 +41,9 @@ export interface NextSpeakerResponse {
|
||||
|
||||
export async function checkNextSpeaker(
|
||||
chat: GeminiChat,
|
||||
geminiClient: GeminiClient,
|
||||
baseLlmClient: BaseLlmClient,
|
||||
abortSignal: AbortSignal,
|
||||
promptId: string,
|
||||
): Promise<NextSpeakerResponse | null> {
|
||||
// We need to capture the curated history because there are many moments when the model will return invalid turns
|
||||
// that when passed back up to the endpoint will break subsequent calls. An example of this is when the model decides
|
||||
@@ -108,12 +109,13 @@ export async function checkNextSpeaker(
|
||||
];
|
||||
|
||||
try {
|
||||
const parsedResponse = (await geminiClient.generateJson(
|
||||
const parsedResponse = (await baseLlmClient.generateJson({
|
||||
contents,
|
||||
RESPONSE_SCHEMA,
|
||||
schema: RESPONSE_SCHEMA,
|
||||
model: DEFAULT_GEMINI_FLASH_MODEL,
|
||||
abortSignal,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
)) as unknown as NextSpeakerResponse;
|
||||
promptId,
|
||||
})) as unknown as NextSpeakerResponse;
|
||||
|
||||
if (
|
||||
parsedResponse &&
|
||||
|
||||
Reference in New Issue
Block a user