Is there an easy way to make an array from ChatGPT into mappable items?

Is there an easy way to take a chatgGPT output that is formatted as an array (ex [“item1”, “item2”, “item3”]) and then break it down into mappable items ( I am not sure if my terminology is correct, but i want to be able to use the individual items of the array in different fields.)? I tried mapping the chat gpt output to Flow Control, but it just passes it on as 1 item. Thanks.

Welcome to the Make community!

I don’t want to make any assumptions here, so can you please provide an example output bundle of the GPT module?

Please provide the output bundles of the 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”.
Screenshot_2023-10-06_141025

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:
    Screenshot_2023-10-02_191027

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.

This will allow others to better assist you. Thanks!

2 Likes

What I am trying to do is have chatgpt generate tags for printify products, I tried to do it by having chat gpt output the lists as an array and then break them into individual items in the iterator module , but when I enter the chatgpt output into iterator, it just outputs the entire array as one bundle. Thanks for your help. I am new to this so hopefully it makes sense.

Basically I am looking for the simplest nocode way to turn a lists of items from chatgpt into individual variables that I can insert into fields.

‘’’
Input bundle:

[
{
“array”: [
{
“value”: “["Tag1", "Tag2", "Tag3", "Tag4", "Tag5"]”
}
]
}
]

Output Bundle:

[
{
“value”: “["Tag1", "Tag2", "Tag3", "Tag4", "Tag5"]”,
IMTINDEX”: 1,
IMTLENGTH”: 1
}
]
‘’’

This doesn’t look like the output bundle of the GPT module.

It should look something like this:

[
    {
        "id": "chatcmpl-8xR486Ppct4CxUU2D8jhdbrAFJ1TU",
        "object": "chat.completion",
        "created": "2024-02-29T03:08:04.000Z",
        "model": "gpt-4-0125-preview",
        "choices": [
            {
                "index": 0,
                "message": {
                    "role": "assistant",
                    "content": "content goes here"
                },
                "logprobs": null,
                "finish_reason": "stop"
            }
        ],
        "usage": {
            "prompt_tokens": 130,
            "completion_tokens": 149,
            "total_tokens": 279
        },
        "system_fingerprint": "fp_91aa3742b1"
    }
]

Also, can you format the code in this forum? Otherwise the forum changes the double quotes and make the JSON invalid. Instructions have been provided above.

2 Likes

Sorry, here are some screen shots. I want to get it so $1 for each bundle is an item that i can insert into a field. but I can only get $1 for the first bundle to appear.


Screenshot 2024-02-29 at 12.08.09 AM

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module.

Screenshot_2024-02-29_170247

The next popular aggregator is the Text Aggregator which is very flexible and has applies to many use-cases.

Links

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

3 Likes

Got it. Thanks. Used the array aggregator on the data from the text parser and then was able to map each item of the array to a different field.

1 Like

No problem, glad I could help!

1. If you have 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!

2 Likes

Pro tip for in the future…if you expressly state in your prompt all output should be formatted in strict json format, you can then just use the json parser to do whatever u need, might save you a few operations.

3 Likes