fix(stats): Use request model as fallback for stats logging (#8423)

This commit is contained in:
Abhi
2025-09-13 21:03:46 -04:00
committed by GitHub
parent 35aeb3f420
commit f11d79a931
3 changed files with 23 additions and 4 deletions
@@ -299,6 +299,17 @@ describe('converter', () => {
codeAssistRes.response.automaticFunctionCallingHistory,
);
});
it('should handle modelVersion', () => {
const codeAssistRes: CaGenerateContentResponse = {
response: {
candidates: [],
modelVersion: 'gemini-2.5-pro',
},
};
const genaiRes = fromGenerateContentResponse(codeAssistRes);
expect(genaiRes.modelVersion).toEqual('gemini-2.5-pro');
});
});
describe('toContents', () => {
@@ -80,6 +80,7 @@ interface VertexGenerateContentResponse {
automaticFunctionCallingHistory?: Content[];
promptFeedback?: GenerateContentResponsePromptFeedback;
usageMetadata?: GenerateContentResponseUsageMetadata;
modelVersion?: string;
}
export interface CaCountTokenRequest {
@@ -137,6 +138,7 @@ export function fromGenerateContentResponse(
out.automaticFunctionCallingHistory = inres.automaticFunctionCallingHistory;
out.promptFeedback = inres.promptFeedback;
out.usageMetadata = inres.usageMetadata;
out.modelVersion = inres.modelVersion;
return out;
}