Using the Gemini API with Node, how can I provide a JSON file to serve as a basis for some questions about it?
Welcome to the forums!
Since JSON files are fundamentally text, the easiest way would be to just include the text as part of your prompt that you send to Gemini. You don’t show how you’re doing that now, but it may be something as simple as
const obj = {
foo: "bar",
}
const prompt = `
Here is a JSON object I will ask you questions about:
${JSON.stringify(obj,null,2)}
What is the value of "foo"?
`
1 Like