Skip to content

Commit 30b1c15

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
AI: pass modelVersion through from Aida => GCA translation
I noticed that this field was missing, and it's really helpful when debugging to see which version is running on your machine. R=leese@chromium.org Fixed: 501043294 Change-Id: I70132eb5da0936309730e904b3966da89d22bb50 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7743322 Commit-Queue: Eric Leese <leese@chromium.org> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org> Reviewed-by: Eric Leese <leese@chromium.org>
1 parent e813806 commit 30b1c15

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

front_end/core/host/AidaClientTypes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,15 @@ export interface FactualityMetadata {
384384
facts: FactualityFact[];
385385
}
386386

387+
export interface InferenceOptionMetadata {
388+
modelId: string;
389+
}
390+
387391
export interface ResponseMetadata {
388392
rpcGlobalId?: RpcGlobalId;
389393
attributionMetadata?: AttributionMetadata;
390394
factualityMetadata?: FactualityMetadata;
395+
inferenceOptionMetadata?: InferenceOptionMetadata;
391396
}
392397

393398
export interface DoConversationResponse {

front_end/core/host/AidaGcaTranslation.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,4 +564,36 @@ describe('AidaGcaTranslation', () => {
564564
});
565565
});
566566
});
567+
568+
describe('GCA GenerateContentResponse to AIDA ChunkResponse', () => {
569+
it('translates a basic chunk response and includes modelVersion', () => {
570+
const gcaResponse = createGcaResponse({
571+
modelVersion: 'gen-model',
572+
responseId: 'response-789',
573+
candidates: [{
574+
index: 0,
575+
content: {role: 'model', parts: [{text: 'const add = (a, b) => a + b;'}]},
576+
finishReason: GcaTypes.FinishReason.STOP,
577+
safetyRatings: [],
578+
citationMetadata: {citations: []},
579+
groundingMetadata: {},
580+
aicodeOutput: {contents: []},
581+
}],
582+
});
583+
584+
assert.deepEqual(AidaGcaTranslation.gcaChunkResponseToAidaChunkResponse(gcaResponse), [{
585+
textChunk: {
586+
text: 'const add = (a, b) => a + b;',
587+
},
588+
metadata: {
589+
rpcGlobalId: 'response-789',
590+
attributionMetadata: {
591+
attributionAction: AidaClient.RecitationAction.CITE,
592+
citations: [],
593+
},
594+
inferenceOptionMetadata: {modelId: 'gen-model'},
595+
},
596+
}]);
597+
});
598+
});
567599
});

front_end/core/host/AidaGcaTranslation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ export function gcaChunkResponseToAidaChunkResponse(response: GCA.GenerateConten
454454
const parts = candidate?.content?.parts || [];
455455
const metadata: AIDA.ResponseMetadata = {
456456
rpcGlobalId: response.responseId,
457+
inferenceOptionMetadata: {modelId: response.modelVersion}
457458
};
458459

459460
if (candidate?.citationMetadata?.citations) {

0 commit comments

Comments
 (0)