Split Open Ai output to multiple outputs

I want to split my open ai output to multiple variable and stock each one in a cell.
Example of my output:

Welcome to the Make community!

When reaching out for assistance with your regex pattern for a Text Parser module, it would be super helpful if you could share the actual text you’re trying to match. Screenshots of text can be a bit tricky, so if you could copy and paste the text directly here, that would be awesome! It ensures we can run it against test patterns effectively. If there’s any sensitive info, feel free to change it to something fictional yet still valid by keeping the format intact.

Providing clear text examples saves time on both ends and helps us give you the best possible solution. Without proper examples, we might end up playing a guessing game, and nobody wants that as it is a waste of time! You are more likely to get a correct answer faster. So, help us help you by sharing those text snippets.

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:

    ```
    content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the 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

The content:
[

    {
        "result": "1- Maîtrise des logiciels de conception graphique 2D et 3D tels que AutoCAD, SketchUp, 3D Studio Max, etc.\n2- Capacité à créer et développer des concepts visuels pour des projets.\n3- Expérience dans la création de modèles 3D, de textures, d'éclairages et d'animations.",
        "id": "chatcmpl-9KrAhuy4KhevMVIJkpAgBKUpLqppY",
        "object": "chat.completion",
        "created": "2024-05-03T17:39:39.000Z",
        "model": "gpt-4-0613",
        "choices": [
            {
                "index": 0,
                "message": {
                    "role": "assistant",
                    "content": "1- Maîtrise des logiciels de conception graphique 2D et 3D tels que AutoCAD, SketchUp, 3D Studio Max, etc.\n2- Capacité à créer et développer des concepts visuels pour des projets.\n3- Expérience dans la création de modèles 3D, de textures, d'éclairages et d'animations."
                },
                "logprobs": null,
                "finish_reason": "stop"
            }
        ],
        "usage": {
            "prompt_tokens": 57,
            "completion_tokens": 82,
            "total_tokens": 139
        },
        "system_fingerprint": null
    }
]
2 Likes

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of one module:

Output

Screenshot_2024-05-04_130511

Give it a go and let us know if you have any issues!

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

View Module Export Code

JSON

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 47,
                    "module": "builtin:BasicFeeder",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "array": "{{split(replace(45.result; \"/\\s*\\d+-\\s/g\"; newline); newline)}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 864,
                            "y": -725,
                            "messages": [
                                {
                                    "category": "last",
                                    "severity": "warning",
                                    "message": "A transformer should not be the last module in the route."
                                }
                            ]
                        },
                        "restore": {
                            "expect": {
                                "array": {
                                    "mode": "edit"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "array",
                                "type": "array",
                                "label": "Array",
                                "mode": "edit",
                                "spec": []
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

samliew – request private consultation

Join the Make unofficial Discord server!

1 Like

Thank you, now I can have 3 differents bundles.

But, I have a problem to put each bundle in specific a cell on a google sheet. The iterator module gives me 3 outputs:

  • Total number of bundles
  • Bundle order position
  • Values (contain the 3 bundles)

The purpose of the automation is to get each bundle as a single output and store it in a specific cell in the same row.

image

Every result from an iterator module will output a bundle. If you don’t want want multiple bundles, you shouldn’t be using an iterator module.

Then you can use You can use the built-in function get to get each item’s value from the array.

samliew – request private consultation

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

2 Likes

I added an array aggregator, his output is:
image

When I tried to use the built-in function get, I got the content of first collection for the both cells.

blueprint (6).json (62.4 KB)

image

In that case you’ll need to use the map function as well.

e.g.:

{{ get(map(51.array; "value"); 1) }}

For more information, see Mapping with arrays below:

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

samliew – request private consultation

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

2 Likes

Thank you ! It’s working now

2 Likes