@steve31415/baselib 3.74.0 → 3.74.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/llm/providers/gemini.js +15 -1
- package/package.json +1 -1
|
@@ -153,7 +153,19 @@ export const geminiProvider = {
|
|
|
153
153
|
}
|
|
154
154
|
const data = JSON.parse(responseText);
|
|
155
155
|
const latencyMs = Date.now() - startTime;
|
|
156
|
-
|
|
156
|
+
// The answer is every non-thought text part of the first candidate, in
|
|
157
|
+
// order — not just part 0. Gemini may split one answer over several
|
|
158
|
+
// parts: live on gemini-3.6-flash with audio at thinking level `low`
|
|
159
|
+
// (2026-11-28), part 0 held a stray reasoning fragment and part 1 the
|
|
160
|
+
// whole real transcript, so reading part 0 alone stored the fragment and
|
|
161
|
+
// dropped the transcript (Mirror row 3271ad65). Parts flagged
|
|
162
|
+
// `thought: true` are reasoning summaries, sent only when a request asks
|
|
163
|
+
// for them (`includeThoughts`, which this adapter never sets) and never
|
|
164
|
+
// part of the answer. Reasoning the model writes into an ordinary part is
|
|
165
|
+
// indistinguishable from the answer here: see "Audio input" in LLM.md.
|
|
166
|
+
const answerParts = (data.candidates?.[0]?.content?.parts ?? [])
|
|
167
|
+
.filter((part) => part.thought !== true && typeof part.text === 'string');
|
|
168
|
+
const text = answerParts.map((part) => part.text).join('');
|
|
157
169
|
// totalTokenCount = promptTokenCount (cached part included) + candidates
|
|
158
170
|
// + thoughts (verified live on 3.6 Flash, 2026-11-07). Google bills
|
|
159
171
|
// thoughts at the output rate and implicit-cache hits at a tenth of the
|
|
@@ -180,6 +192,8 @@ export const geminiProvider = {
|
|
|
180
192
|
status: response.status, latencyMs, tokensUsed, outputTokens, finishReason,
|
|
181
193
|
...(reasoningTokens !== undefined ? { reasoningTokens } : {}),
|
|
182
194
|
...(cacheReadTokens !== undefined ? { cacheReadTokens } : {}),
|
|
195
|
+
// A split answer is rare and has meant leaked reasoning (above).
|
|
196
|
+
...(answerParts.length > 1 ? { textParts: answerParts.length } : {}),
|
|
183
197
|
...(request.callSite ? { callSite: request.callSite } : {}),
|
|
184
198
|
});
|
|
185
199
|
return {
|
package/package.json
CHANGED