3 ms·
why on earth did they design the Node.js and Web APIs to be slightly different and incompatible? (edit: this might just be a bug/oversight on the landing page?
by brrrrrm 3y ago
why on earth did they design the Node.js and Web APIs to be slightly different and incompatible? (edit: this might just be a bug/oversight on the landing page?)
Node.js:
const model = genAI.getGenerativeModel({ model: "gemini-pro-vision"});
const result = model.generateContent({ contents: [{parts: [
{text: "What’s in this photo?"},
{inlineData: {data: imgBase64, mimeType: 'image/png'}}
] }] })
Web:
const model = genAI.getGenerativeModel({ model: "gemini-pro-vision"});
const result = await model.generateContent([
"What’s in this photo?",
{inlineData: {data: imgDataInBase64, mimeType: 'image/png'}}
]);
- magemgem 3y agoWhat do you mean? They look exactly the same to me.
- aidabbler 3y agoYou may be a host
- miguelramos 3y agoHey! This is Miguel from Google working of these SDKS. I'm confused about this comment, Both Web and Node.js are the same. Can you clarify where you see the difference?
- brrrrrm 3y agoas documented it looks different (async vs sync + the necessity of `text:` annotations in the Node.js version?) updated my comment to paste in what's written in the docs
- miguelramos 3y agoThanks, that helps to understand the confusion. The web and Node.js are the same, each of them has many function overloads so users can call functions with simplified or complex arguments, as they prefer. We are going to fix the doc and code snippets so both Web and Node.js consistently show the same code to avoid misunderstandings. Thanks a lot!