How to use the MakerSuite Google API in a Node.js frontend?

213 views Asked by At

I recently obtained access to the MakerSuite API from Google. I have been following their documentation, but I'm encountering difficulties in integrating the provided code with my frontend files so I can have a user import a prompt instead of it being preset. The issues arise primarily due to the "require" statement or incompatible file types, such as MIME.

This is where the code is for node.js https://developers.generativeai.google/tutorials/text_node_quickstart#generating_messages

I have tried the following, calling it similar to how the OpenAI api is used, I have tried using google Bard, type='module' and 'import' but it has to be require.

If anyone can help me with this it would be very appreciated, Thank you.

0

There are 0 answers