Skip to content

Commit

Permalink
fixed text
Browse files Browse the repository at this point in the history
  • Loading branch information
alx13 committed Mar 11, 2024
1 parent 6a46b0b commit 2c971f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/main/src/requests/response-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function addHelpers(
if (response.candidates.length > 1) {
console.warn(
`This response had ${response.candidates.length} ` +
`candidates. Returning text from the first candidate only. ` +
`candidates. Returning function call from the first candidate only. ` +
`Access response.candidates directly to use the other candidates.`,
);
}
Expand All @@ -73,7 +73,7 @@ export function addHelpers(
return getFunctionCall(response);
} else if (response.promptFeedback) {
throw new GoogleGenerativeAIResponseError<GenerateContentResponse>(
`Text not available. ${formatBlockErrorMessage(response)}`,
`Function call not available. ${formatBlockErrorMessage(response)}`,
response,
);
}
Expand Down
10 changes: 5 additions & 5 deletions samples/node/advanced-function-calling.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function run() {
contents: [prompt],
});
const response = result.response;
console.dir(response, {depth: null});
console.dir(response, { depth: null });

if (response.candidates.length === 0) {
throw new Error("No candidates");
Expand All @@ -76,7 +76,7 @@ async function run() {
throw new Error("No parts");
}
const fc = content.parts[0].functionCall;
const text = content.parts.map((({ text }) => text)).join("");
const text = content.parts.map(({ text }) => text).join("");
if (fc) {
const { name, args } = fc;
const fn = functions[name];
Expand All @@ -98,10 +98,10 @@ async function run() {
],
};
const request2 = {
contents: [prompt, content, fr]
}
contents: [prompt, content, fr],
};
const response2 = await model.generateContent(request2);
const result2 = response2.response
const result2 = response2.response;
console.log(result2.text());
} else if (text) {
console.log(text);
Expand Down

0 comments on commit 2c971f1

Please sign in to comment.