Skip to content

Commit 6c9534d

Browse files
committed
style: fix formatting in content-with-toolcalls test and gemini
1 parent 1ff6e46 commit 6c9534d

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

src/__tests__/content-with-toolcalls.test.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -400,23 +400,18 @@ describe("Gemini — content + toolCalls", () => {
400400
});
401401
await mock.start();
402402

403-
const res = await fetch(
404-
`${mock.url}/v1beta/models/gemini-2.0-flash:generateContent`,
405-
{
406-
method: "POST",
407-
headers: { "Content-Type": "application/json" },
408-
body: JSON.stringify({
409-
contents: [{ role: "user", parts: [{ text: "test gemini combined ns" }] }],
410-
}),
411-
},
412-
);
403+
const res = await fetch(`${mock.url}/v1beta/models/gemini-2.0-flash:generateContent`, {
404+
method: "POST",
405+
headers: { "Content-Type": "application/json" },
406+
body: JSON.stringify({
407+
contents: [{ role: "user", parts: [{ text: "test gemini combined ns" }] }],
408+
}),
409+
});
413410

414411
const body = await res.json();
415412
const parts = body.candidates[0].content.parts;
416413
const textParts = parts.filter((p: { text?: string }) => p.text !== undefined);
417-
const fcParts = parts.filter(
418-
(p: { functionCall?: unknown }) => p.functionCall !== undefined,
419-
);
414+
const fcParts = parts.filter((p: { functionCall?: unknown }) => p.functionCall !== undefined);
420415

421416
expect(textParts.length).toBeGreaterThan(0);
422417
expect(textParts[0].text).toBe("Sure.");
@@ -499,19 +494,15 @@ describe("stream-collapse — content + toolCalls coexistence", () => {
499494
it("Gemini: preserves both content and toolCalls", () => {
500495
const body = [
501496
`data: ${JSON.stringify({
502-
candidates: [
503-
{ content: { role: "model", parts: [{ text: "Hello" }] }, index: 0 },
504-
],
497+
candidates: [{ content: { role: "model", parts: [{ text: "Hello" }] }, index: 0 }],
505498
})}`,
506499
"",
507500
`data: ${JSON.stringify({
508501
candidates: [
509502
{
510503
content: {
511504
role: "model",
512-
parts: [
513-
{ functionCall: { name: "get_weather", args: { city: "NYC" } } },
514-
],
505+
parts: [{ functionCall: { name: "get_weather", args: { city: "NYC" } } }],
515506
},
516507
finishReason: "FUNCTION_CALL",
517508
index: 0,

src/gemini.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ function parseToolCallPart(tc: ToolCall, logger: Logger): GeminiPart {
242242
try {
243243
argsObj = JSON.parse(tc.arguments || "{}") as Record<string, unknown>;
244244
} catch {
245-
logger.warn(
246-
`Malformed JSON in fixture tool call arguments for "${tc.name}": ${tc.arguments}`,
247-
);
245+
logger.warn(`Malformed JSON in fixture tool call arguments for "${tc.name}": ${tc.arguments}`);
248246
argsObj = {};
249247
}
250248
return { functionCall: { name: tc.name, args: argsObj, id: tc.id || generateToolCallId() } };

0 commit comments

Comments
 (0)