[Discovery Engine] streamAnswer is typed as one AnswerQueryResponse, but REST returns frame arrays
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 64/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- nodejs, typescript
调研方向
从所引用行中的 src/apis/discoveryengine/v1.ts 里的生成的 streamAnswer 方法开始,然后使用 npm run repro 运行提供的复现。验证 REST 响应表示为 AnswerQueryResponse 帧数组,并且 typecheck.ts 接受帧访问,同时不再将 res.data 表示为单个响应对象。
由索引模型根据 Issue 内容生成。
描述
Description
@googleapis/discoveryengine exposes the REST servingConfigs.streamAnswer method as if the default parsed response is one Schema$GoogleCloudDiscoveryengineV1AnswerQueryResponse.
However, direct REST streamAnswer returns a JSON array of AnswerQueryResponse frames. With the default generated method, res.data is that array at runtime, while TypeScript and the generated example tell users to treat res.data as a single object. Typed code can therefore read res.data.answerQueryToken or res.data.answer?.relatedQuestions and get undefined, even though those fields are present in the returned frames.
This is not an answer-quality issue and does not require any live Google call to reproduce. The fixture below is a redacted HTTP 200 direct REST streamAnswer body from Discovery Engine / Vertex AI Search.
Package / source
- Package:
@googleapis/[email protected] - Repo commit checked:
9e92f535023f86df98d8a9dcbdf7777434e3124f - Generated method:
src/apis/discoveryengine/v1.ts,projects.locations.dataStores.servingConfigs.streamAnswer - Source lines: https://github.com/googleapis/google-api-nodejs-client/blob/9e92f535023f86df98d8a9dcbdf7777434e3124f/src/apis/discoveryengine/v1.ts#L57079-L57166
The generated comment says the method is streaming and returns multiple AnswerQueryResponse messages, but the default overload returns Promise<GaxiosResponseWithHTTP2<Schema$GoogleCloudDiscoveryengineV1AnswerQueryResponse>>.
Reproduction
Create these files and run one command:
npm install && npm run repro
package.json:
{
"type": "module",
"scripts": {
"repro": "node repro.mjs && tsc --noEmit --strict --target es2022 --lib es2022 --module nodenext --moduleResolution nodenext typecheck.ts"
},
"dependencies": {
"@googleapis/discoveryengine": "30.0.0",
"@types/node": "24.10.1",
"nock": "14.0.10",
"typescript": "5.9.3"
}
}
repro.mjs:
import fs from 'node:fs';
import nock from 'nock';
import {discoveryengine} from '@googleapis/discoveryengine';
const fixture = JSON.parse(fs.readFileSync('./fixture.json', 'utf8'));
const servingConfig =
'projects/testing-repos-489801/locations/global/collections/default_collection/dataStores/large-session-details-20260618-025044-m6sk/servingConfigs/default_search';
nock.disableNetConnect();
nock('https://discoveryengine.googleapis.com')
.post(`/v1/${servingConfig}:streamAnswer`)
.query(true)
.reply(200, fixture, {'content-type': 'application/json'});
const api = discoveryengine('v1');
const res = await api.projects.locations.collections.dataStores.servingConfigs.streamAnswer({
servingConfig,
requestBody: {query: {text: 'offline replay'}},
});
const framesWithRelatedQuestions = res.data.filter(
frame => frame.answer?.relatedQuestions?.length
);
const framesWithTokens = res.data.filter(frame => frame.answerQueryToken);
console.log(`Array.isArray(res.data): ${Array.isArray(res.data)}`);
console.log(`res.data.answerQueryToken: ${String(res.data.answerQueryToken)}`);
console.log(`res.data.answer?.relatedQuestions: ${String(res.data.answer?.relatedQuestions)}`);
console.log(`frame count: ${res.data.length}`);
console.log(`frames with answerQueryToken: ${framesWithTokens.length}`);
console.log(`frames with relatedQuestions: ${framesWithRelatedQuestions.length}`);
console.log(`first relatedQuestions count: ${framesWithRelatedQuestions[0]?.answer.relatedQuestions.length ?? 0}`);
typecheck.ts:
import {discoveryengine_v1} from '@googleapis/discoveryengine';
const api = new discoveryengine_v1.Discoveryengine({});
const servingConfig =
'projects/testing-repos-489801/locations/global/collections/default_collection/dataStores/large-session-details-20260618-025044-m6sk/servingConfigs/default_search';
async function main() {
const res =
await api.projects.locations.collections.dataStores.servingConfigs.streamAnswer({
servingConfig,
requestBody: {query: {text: 'offline replay'}},
});
// These compile because streamAnswer is typed as a single AnswerQueryResponse.
const token: string | null | undefined = res.data.answerQueryToken;
const relatedQuestions: string[] | undefined =
res.data.answer?.relatedQuestions ?? undefined;
// This is the runtime shape for valid REST streamAnswer output, but the
// generated default type rejects it.
// @ts-expect-error streamAnswer is typed as unary, not array-of-frame.
const frameCount: number = res.data.length;
console.log(token, relatedQuestions, frameCount);
}
void main();
fixture.json (redacted HTTP 200 direct REST streamAnswer body)
[
{
"answer": {
"state": "STREAMING",
"steps": [
{
"state": "SUCCEEDED",
"description": "Rephrase the query and search.",
"actions": [
{
"searchAction": {
"query": "For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, what are the alpha, beta, gamma, and delta review requirements? Include citations."
},
"observation": {
"searchResults": [
{
"document": "projects/917493783080/locations/global/collections/default_collection/dataStores/large-session-details-20260618-025044-m6sk/branches/0/documents/large-session-include-details-doc",
"structData": {
"body": "Section 1: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 1; the support region is us-west; the effective date is 2026-06-11. Citations should point to this structured source and compare repeated facts across sections. Section 2: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 2; the support region is us-west; the effective date is 2026-06-12. Citations should point to this structured source and compare repeated facts across sections. Section 3: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 3; the support region is us-west; the effective date is 2026-06-13. Citations should point to this structured source and compare repeated facts across sections. Section 4: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 4; the support region is us-west; the effective date is 2026-06-14. Citations should point to this structured source and compare repeated facts across sections. Section 5: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 5; the support region is us-west; the effective date is 2026-06-15. Citations should point to this structured source and compare repeated facts across sections. Section 6: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 6; the support region is us-west; the effective date is 2026-06-16. Citations should point to this structured source and compare repeated facts across sections. Section 7: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 7; the support region is us-west; the effective date is 2026-06-17. Citations should point to this structured source and compare repeated facts across sections. Section 8: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 8; the support region is us-west; the effective date is 2026-06-18. Citations should point to this structured source and compare repeated facts across sections.",
"source_uri": "agent-search-test://large_session_include_details_20260618-025044_42p3u/large-session-include-details-doc",
"title": "Large session includeAnswerDetails parity sentinel",
"run_id": "large_session_include_details_20260618-025044_42p3u",
"unicode_notes": "Accents: cafe naive facade. Emoji: checkmark OK. Long dash: alpha -- beta. Greek: lambda pi. Japanese: テスト. Arabic: اختبار.",
"version": 1,
"sentinel_token": "large_session_include_details_large_session_include_details_20260618-025044_42p3u",
"facts": "The release code is R-ALPHA-77. The escalation owner is Search Credit QA. The support region is us-west. The policy labels are standard-search and advanced-generative-answer. Reviewers should verify manual review, automatic approval, escalation, and audit evidence."
}
}
]
}
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"references": [
{
"structuredDocumentInfo": {
"document": "projects/917493783080/locations/global/collections/default_collection/dataStores/large-session-details-20260618-025044-m6sk/branches/0/documents/large-session-include-details-doc",
"structData": {},
"title": "Large session includeAnswerDetails parity sentinel"
}
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "For"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": " the sentinel `large_session_include_details_large_session_include_details_20"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "260618-025044_42p3"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "u`, the review requirements are as follows: alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "-stamped audit note. "
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"endIndex": "276",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "The support region for this sentinel is us-west. "
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "277",
"endIndex": "325",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "The policy labels associated with this sentinel are standard-search and advanced-generative"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "-answer. "
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "326",
"endIndex": "425",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "Reviewers should verify manual review, automatic approval, escalation, and audit evidence. "
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "426",
"endIndex": "516",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "The release code is R-ALPHA-77. "
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "517",
"endIndex": "548",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "The escalation owner is Search Credit QA.\n\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "549",
"endIndex": "590",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "The section"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": " owner and effective date vary across different sections of the source:\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 1: The section owner is Search Credit QA 1, and the effective date is 2026-06-11."
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "675",
"endIndex": "768",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 2: The section owner is Search Credit QA 2, and the effective date is 2026-06-12.\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "769",
"endIndex": "862",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 3: The section owner is Search Credit QA 3, and the effective date is 2026-06"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "-13.\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "863",
"endIndex": "956",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 4: The section owner is Search Credit QA 4, and the effective date is 2026-06-14.\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "957",
"endIndex": "1050",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 5: The section owner is Search Credit QA 5, and the effective date is 2"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "026-06-15.\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "1051",
"endIndex": "1144",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 6: The section owner is Search Credit QA 6, and the effective date is 2026-06-16.\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "1145",
"endIndex": "1238",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 7: The section owner is Search Credit QA 7, and"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": " the effective date is 2026-06-17.\n"
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "1239",
"endIndex": "1332",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"answerText": "* Section 8: The section owner is Search Credit QA 8, and the effective date is 2026-06-18."
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"citations": [
{
"startIndex": "1333",
"endIndex": "1426",
"sources": [
{
"referenceId": "0"
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "STREAMING",
"relatedQuestions": [
"What is the escalation process for gamma?",
"Who is the current section owner?",
"What is the latest effective date?",
"Where can I find this structured source?",
"Can I get more details on \"manual review\"?"
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
},
{
"answer": {
"state": "SUCCEEDED",
"answerText": "For the sentinel `large_session_include_details_large_session_include_details_20260618-025044_42p3u`, the review requirements are as follows: alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The support region for this sentinel is us-west. The policy labels associated with this sentinel are standard-search and advanced-generative-answer. Reviewers should verify manual review, automatic approval, escalation, and audit evidence. The release code is R-ALPHA-77. The escalation owner is Search Credit QA.\n\nThe section owner and effective date vary across different sections of the source:\n* Section 1: The section owner is Search Credit QA 1, and the effective date is 2026-06-11.\n* Section 2: The section owner is Search Credit QA 2, and the effective date is 2026-06-12.\n* Section 3: The section owner is Search Credit QA 3, and the effective date is 2026-06-13.\n* Section 4: The section owner is Search Credit QA 4, and the effective date is 2026-06-14.\n* Section 5: The section owner is Search Credit QA 5, and the effective date is 2026-06-15.\n* Section 6: The section owner is Search Credit QA 6, and the effective date is 2026-06-16.\n* Section 7: The section owner is Search Credit QA 7, and the effective date is 2026-06-17.\n* Section 8: The section owner is Search Credit QA 8, and the effective date is 2026-06-18.",
"citations": [
{
"endIndex": "276",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "277",
"endIndex": "325",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "326",
"endIndex": "425",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "426",
"endIndex": "516",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "517",
"endIndex": "548",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "549",
"endIndex": "590",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "675",
"endIndex": "768",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "769",
"endIndex": "862",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "863",
"endIndex": "956",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "957",
"endIndex": "1050",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "1051",
"endIndex": "1144",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "1145",
"endIndex": "1238",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "1239",
"endIndex": "1332",
"sources": [
{
"referenceId": "0"
}
]
},
{
"startIndex": "1333",
"endIndex": "1426",
"sources": [
{
"referenceId": "0"
}
]
}
],
"references": [
{
"structuredDocumentInfo": {
"document": "projects/917493783080/locations/global/collections/default_collection/dataStores/large-session-details-20260618-025044-m6sk/branches/0/documents/large-session-include-details-doc",
"structData": {},
"title": "Large session includeAnswerDetails parity sentinel"
}
}
],
"relatedQuestions": [
"What is the escalation process for gamma?",
"Who is the current section owner?",
"What is the latest effective date?",
"Where can I find this structured source?",
"Can I get more details on \"manual review\"?"
],
"steps": [
{
"state": "SUCCEEDED",
"description": "Rephrase the query and search.",
"actions": [
{
"searchAction": {
"query": "For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, what are the alpha, beta, gamma, and delta review requirements? Include citations."
},
"observation": {
"searchResults": [
{
"document": "projects/917493783080/locations/global/collections/default_collection/dataStores/large-session-details-20260618-025044-m6sk/branches/0/documents/large-session-include-details-doc",
"structData": {
"unicode_notes": "Accents: cafe naive facade. Emoji: checkmark OK. Long dash: alpha -- beta. Greek: lambda pi. Japanese: テスト. Arabic: اختبار.",
"run_id": "large_session_include_details_20260618-025044_42p3u",
"title": "Large session includeAnswerDetails parity sentinel",
"body": "Section 1: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 1; the support region is us-west; the effective date is 2026-06-11. Citations should point to this structured source and compare repeated facts across sections. Section 2: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 2; the support region is us-west; the effective date is 2026-06-12. Citations should point to this structured source and compare repeated facts across sections. Section 3: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 3; the support region is us-west; the effective date is 2026-06-13. Citations should point to this structured source and compare repeated facts across sections. Section 4: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 4; the support region is us-west; the effective date is 2026-06-14. Citations should point to this structured source and compare repeated facts across sections. Section 5: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 5; the support region is us-west; the effective date is 2026-06-15. Citations should point to this structured source and compare repeated facts across sections. Section 6: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 6; the support region is us-west; the effective date is 2026-06-16. Citations should point to this structured source and compare repeated facts across sections. Section 7: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 7; the support region is us-west; the effective date is 2026-06-17. Citations should point to this structured source and compare repeated facts across sections. Section 8: For sentinel large_session_include_details_large_session_include_details_20260618-025044_42p3u, alpha requires manual review, beta is automatically approved, gamma requires escalation, and delta requires a date-stamped audit note. The section owner is Search Credit QA 8; the support region is us-west; the effective date is 2026-06-18. Citations should point to this structured source and compare repeated facts across sections.",
"source_uri": "agent-search-test://large_session_include_details_20260618-025044_42p3u/large-session-include-details-doc",
"facts": "The release code is R-ALPHA-77. The escalation owner is Search Credit QA. The support region is us-west. The policy labels are standard-search and advanced-generative-answer. Reviewers should verify manual review, automatic approval, escalation, and audit evidence.",
"sentinel_token": "large_session_include_details_large_session_include_details_20260618-025044_42p3u",
"version": 1
}
}
]
}
}
]
}
]
},
"answerQueryToken": "NMwKDAiomezRBhDUgaihAhIkNmEzZGU2MjMtMDAwMC0yNTIwLTg0YzctMDg5ZTA4MmNlZmNj"
}
]
Actual output
Array.isArray(res.data): true
res.data.answerQueryToken: undefined
res.data.answer?.relatedQuestions: undefined
frame count: 43
frames with answerQueryToken: 43
frames with relatedQuestions: 2
first relatedQuestions count: 5
Expected behavior
The generated REST surface should not expose the default parsed streamAnswer response as a single AnswerQueryResponse when valid REST output is an array of AnswerQueryResponse frames.
Possible fixes could be one of:
- Type the default parsed response as
Schema$GoogleCloudDiscoveryengineV1AnswerQueryResponse[]. - Document and type
streamAnswerso callers must useresponseType: 'stream'for this endpoint. - Provide a higher-level accumulator that returns a final assembled Answer response and preserves terminal frame metadata such as
answerQueryTokenandrelatedQuestions.
Why the fixture is valid
The body is from a direct REST streamAnswer HTTP 200 response from discoveryengine.googleapis.com. The service returned a JSON array of AnswerQueryResponse frames. The raw service output is the ground truth here; the issue is only that the public Node REST client type/default wrapper presents that valid output as a unary object.
- 主要语言
- TypeScript
- 星标
- 12.3k
- 派生
- 2k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 21
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleapis/google-api-nodejs-client 的其他 Issue
-
难度 5/5 一周以上 新手友好度 32/100
googleapis/google-api-nodejs-client#3932 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 76/100
googleapis/google-api-nodejs-client#3927 · 1 个 reaction ·
维护者通常 1 天内回复
-
size: l type: feature request
难度 4/5 3-5 天 新手友好度 35/100
googleapis/google-api-nodejs-client#3926 ·
维护者通常 1 天内回复
-
type: feature request
难度 5/5 一周以上 新手友好度 15/100
googleapis/google-api-nodejs-client#3903 ·
维护者通常 1 天内回复
-
If a service is deprecated and its the last version fo the library, we need to fully deprecate it未关闭type: process
难度 4/5 3-5 天 新手友好度 42/100
googleapis/google-api-nodejs-client#3898 ·
维护者通常 1 天内回复
查看 googleapis/google-api-nodejs-client 的全部 Issue
相似的 Issue
-
triage
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
mermaid-js/mermaid-live-editor#2053 ·
维护者通常 1 天内回复
-
factory
难度 2/5 1-3 小时 新手友好度 82/100
jessepollak/home#1455 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 95/100
lingdojo/kana-dojo#31227 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
appandflow/stim#1838 ·
维护者通常 1 天内回复