Trying to get Gemini prompt completions

,

Hi everyone,

I’ve been simply trying to get prompt completions from Gemini, because it’s better than OpenAI. I haven’t even been able to successfully accomplish this simple task for the whole day… I’ve tried so many modules: HTTP API call, all the Gemini modules…

My end goal: I want to input a title and body from a Reddit post and get a Gemini-generated response to the Reddit post… Thanks in advance.

Welcome to the Make community!

You can get a Gemini API token here https://ai.google.dev/gemini-api/docs/api-key

If you need assistance in setting up the HTTP module, please provide additional information about what you have tried with regards to the external service’s Developer API Reference – how you are setting the connection up, a link to the endpoint are you trying to connect to, and what errors you are encountering.

You can also complete this brand new course/tutorial in the Make Academy on how to use external APIs — API calls with HTTP modules

  • API and Endpoints
  • Header and body
  • Multipart/form-data
  • OAuth 2.0

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

To create a connection in the HTTP “Make an API Key Auth Request” module,

Calling the generateContent endpoint, as described here

There are no additional headers or query parameters required.

Output

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Hi @Beata_Tali_Gold

Have you tried Make’s verified own Gemini app?

If tried and did not work, please share the input prompt to understand the issue in detail.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support | Book Live Implementation
Visit us here
Youtube Channel

1 Like

Thank you! I did that and got a 400 error… I know there’s nothing wrong w the API key, as it has connected in the past…

Yes, I did. For the chat prompt module, it worked once and then stopped running afterwards…

For the text prompt module, I want to use Gemini Pro not Unicorn, so I didn’t use it.

For the API Call module, I couldnt get it to work… the URL for the API call is different from the documentation so maybe that has something to do with it…

You can try getting a new API key, or you can share the full error message, scenario, output bundles, etc.

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.


(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Input/Output bundles

Please provide the output bundles of the trigger/iterator/aggregator modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

blueprint.json (9.6 KB)

input:

[
    {
        "ca": null,
        "qs": [],
        "url": "https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent",
        "data": "{contents\":[\n            {\n\"role\": \"user\",\n              \"parts\":[{\"text\": \"Give me five subcategories of jazz?\"}]}]}",
        "gzip": true,
        "method": "post",
        "headers": [
            {
                "name": "Content-Type",
                "value": "application/json"
            }
        ],
        "timeout": null,
        "useMtls": false,
        "bodyType": "raw",
        "contentType": "application/json",
        "serializeUrl": false,
        "shareCookies": false,
        "parseResponse": true,
        "followRedirect": true,
        "useQuerystring": false,
        "followAllRedirects": false,
        "rejectUnauthorized": true
    }
]

output:

[
    {
        "statusCode": 400,
        "headers": [
            {
                "name": "vary",
                "value": "Origin, X-Origin, Referer"
            },
            {
                "name": "content-type",
                "value": "application/json; charset=UTF-8"
            },
            {
                "name": "content-encoding",
                "value": "gzip"
            },
            {
                "name": "date",
                "value": "Tue, 25 Jun 2024 04:14:56 GMT"
            },
            {
                "name": "server",
                "value": "scaffolding on HTTPServer2"
            },
            {
                "name": "cache-control",
                "value": "private"
            },
            {
                "name": "x-xss-protection",
                "value": "0"
            },
            {
                "name": "x-frame-options",
                "value": "SAMEORIGIN"
            },
            {
                "name": "x-content-type-options",
                "value": "nosniff"
            },
            {
                "name": "server-timing",
                "value": "gfet4t7; dur=57"
            },
            {
                "name": "alt-svc",
                "value": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
            },
            {
                "name": "connection",
                "value": "close"
            },
            {
                "name": "transfer-encoding",
                "value": "chunked"
            }
        ],
        "cookieHeaders": [],
        "data": {
            "error": {
                "code": 400,
                "message": "Invalid JSON payload received. Expected : between key:value pair.\n{contents\":[\n            {\n\"r\n         ^",
                "status": "INVALID_ARGUMENT"
            }
        },
        "fileSize": 202
    }
]

Your JSON was invalid. You can verify it by copy-pasting into https://jsonformatter.org, and it will tell you where and what the error is.

JSON Is very strict. You need to ensure the format is correct, all keys are properly double-quoted, etc.

You are missing a double-quote in front of the key "contents"

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Thanks!!! That worked for me.

No problem, glad I could help!

1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

4. Do join the unofficial Make Discord server for live chat and video assistance

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

2 Likes