Text parser to output bundles for subsequent steps

I’m uploading an image to A.I. to help label it. It’s returning:

  1. Category label
  2. Description of item
  3. Value of item
  4. Quantity

The gemini AI returns the text and I tried to seperate the output into different bundles using an iterator.

I want to get the parsed data as label, description, quantity and value so I can pass onto the next module. But right now it’s giving me total number of bundles, value and bundle order position.

How do I fix this? THANKS!!

Welcome to the Make community!

You should not use an Iterator module.

Try using a Text Parser “Match Elements” module instead for “Key-Value Pairs”

If you need further assistance, please provide the following:

Please provide the output bundles of the module [13] 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. Upload as Text File

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

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format 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.

This will allow others to better assist you. Thanks!

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

if you need to map only the four items from the text response every time then you can do it without using the iterator using a set multiple variable module

in the image below i have split the text response using | instead of newline because i don’t have the actual response

assume this is the response we are getting
image

add a set multiple variable after it and add the variable names label, name, value, quantity etc

in the variable values add this

{{get(split(get(split(5.Text Response; newline); orderofthevariablehere); “=”); 2)}}

and change the orderofthevariable

in your case it would look like this

output of the set variable will look like this
image

later you can map it to the fields in the xl sheet

Thank you so much for your help. I’ve implemented your idea but I’m getting empty values.

  1. Here’s the prompt I gave the A.I. to analyse the image.
You are labelling all the items in a house. Analyse this photo of a household item.

Output a string in this format
label=kitchen|name=Bowl|Value=$15|Quantity=1

Where:
Label = Imagine you are labelling all the items in a house, give it a category label for this item
Name = Description of the item 
Value =  give it an estimated value in HKD
Quantity = how many identical items there are

  1. Here’s the output of the A.I. module.
[
    {
        "textResponse": " label=electronics|name=Ipad|Value=$500|Quantity=1",
        "predictions": [
            {
                "candidates": [
                    {
                        "content": {
                            "role": "model",
                            "parts": [
                                {
                                    "text": " label=electronics|name=Ipad|Value=$500|Quantity=1"
                                }
                            ]
                        },
                        "safetyRatings": [
                            {
                                "category": "HARM_CATEGORY_HATE_SPEECH",
                                "probability": "NEGLIGIBLE",
                                "probabilityScore": 0.078125,
                                "severity": "HARM_SEVERITY_LOW",
                                "severityScore": 0.20703125
                            },
                            {
                                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                                "probability": "NEGLIGIBLE",
                                "probabilityScore": 0.28320313,
                                "severity": "HARM_SEVERITY_LOW",
                                "severityScore": 0.20703125
                            },
                            {
                                "category": "HARM_CATEGORY_HARASSMENT",
                                "probability": "NEGLIGIBLE",
                                "probabilityScore": 0.09667969,
                                "severity": "HARM_SEVERITY_NEGLIGIBLE",
                                "severityScore": 0.06542969
                            },
                            {
                                "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                                "probability": "NEGLIGIBLE",
                                "probabilityScore": 0.06933594,
                                "severity": "HARM_SEVERITY_NEGLIGIBLE",
                                "severityScore": 0.06738281
                            }
                        ]
                    }
                ]
            },
            {
                "candidates": [
                    {
                        "content": {
                            "role": "model",
                            "parts": [
                                {
                                    "text": ""
                                }
                            ]
                        },
                        "finishReason": "STOP"
                    }
                ],
                "usageMetadata": {
                    "promptTokenCount": 356,
                    "candidatesTokenCount": 18,
                    "totalTokenCount": 374
                }
            }
        ]
    }
]
  1. For the set variable module. This is the input and output

Input

[
    {
        "scope": "roundtrip",
        "variables": [
            {
                "name": "label",
                "value": null
            },
            {
                "name": "name",
                "value": null
            },
            {
                "name": "value",
                "value": null
            },
            {
                "name": "quantity",
                "value": null
            }
        ]
    }
]

Output

[
    {
        "label": null,
        "name": null,
        "value": null,
        "quantity": null
    }
]

Thank you so much for your help! The key is correct but just missing the value now.

Remove the double quotes and use the text = not the green one it should give the result