I am trying to use an itterator to split up text and then use it as separate items. Unfortunately, I am not getting anywhere.
What am I doing wrong?
I am trying to use an itterator to split up text and then use it as separate items. Unfortunately, I am not getting anywhere.
What am I doing wrong?
Iterate does not just split up your text you need to define the split using a split function.
Iterator will just combine bundles. So all of your values no matter the format will be added into the array then aggregated over so you are basically creating the same value you put into it.
What is you goal here how are you trying to split up your values?
Welcome to the Make community!
Please provide the output bundles of the OpenAI 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”.
Save each bundle contents in your text editor as a bundle.txt
file, and upload it here into this discussion thread.
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.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!
[
{
"result": "Automation Anxiety: Is Your Job Safe?\n\nMany worry that AI will take over human jobs. However, the reality is more complex than simple replacement.\n\n---\n\nAI Will Disrupt Jobs, But Create New Ones\n\nA shift is coming where many roles may be displaced. But new opportunities will also arise, balancing the job market.\n\n---\n\nAI Augments Human Potential\n\nInstead of replacing individuals, AI enhances our work capabilities. It allows us to focus on creative and complex tasks that require human insight.\n\n---\n\nNew Industries Will Emerge\n\nThe growth of AI will lead to unprecedented job opportunities. Fields like data science and machine learning will see increasing demand.\n\n---\n\nPrepare Yourself for an AI Future\n\nUpskilling is essential to remain relevant in a changing job landscape. Emphasizing human skills like empathy and creativity will provide a competitive edge.",
"id": "chatcmpl-9wnVWFaW2m7qVnvhXagjwhT8QAVPt",
"object": "chat.completion",
"created": "2024-08-16T09:25:58.000Z",
"model": "gpt-4o-mini-2024-07-18",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Automation Anxiety: Is Your Job Safe?\n\nMany worry that AI will take over human jobs. However, the reality is more complex than simple replacement.\n\n---\n\nAI Will Disrupt Jobs, But Create New Ones\n\nA shift is coming where many roles may be displaced. But new opportunities will also arise, balancing the job market.\n\n---\n\nAI Augments Human Potential\n\nInstead of replacing individuals, AI enhances our work capabilities. It allows us to focus on creative and complex tasks that require human insight.\n\n---\n\nNew Industries Will Emerge\n\nThe growth of AI will lead to unprecedented job opportunities. Fields like data science and machine learning will see increasing demand.\n\n---\n\nPrepare Yourself for an AI Future\n\nUpskilling is essential to remain relevant in a changing job landscape. Emphasizing human skills like empathy and creativity will provide a competitive edge.",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 843,
"completion_tokens": 164,
"total_tokens": 1007
},
"system_fingerprint": "fp_48196bc67a"
}
]
@Mr.Make my goal is, that the text what is created by OpenAI will be seperated.
It is for a LinkedIn Carrousel what will be created by RenderForm.
So:
Page 1:
Title
Subtitle
And so on
Every Title and Subtitle need to be seperated, so i can use these for the RenderForm module.
Think i find something, what was needed, but im still not there:
{{split(151.result; newline)}}
This i use for the split, but i just need them one by one. So i can choose where i put the vallue.
Welcome to the Make community!
You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):
(?<title>.+)\s+(?<text>[\w\W]+?)\s*(?:---|$)
Proof https://regex101.com/r/d5jwWC/1
For more information, see Text Parser in the Make Help Center:
Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.
- The complete list of metacharacters can be found on the MDN web docs website.
- For a tutorial on how to create regular expressions, we recommend the RegexOne website.
- For an easy, quick regex generator, try the Regular Expressions generator.
- For experimenting with regular expressions, we recommend the regular expressions 101 website. Just make sure to tick the ECMAScript (JavaScript) FLAVOR in the left panel.
You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.
Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.
Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.
JSON - Copy and Paste this directly in the scenario editor
{"subflows":[{"flow":[{"id":144,"module":"regexp:Parser","version":1,"parameters":{"pattern":"(?<title>.+)\\s+(?<text>[\\w\\W]+?)\\s*(?:---|$)","global":true,"sensitive":true,"multiline":false,"singleline":false,"continueWhenNoRes":false,"ignoreInfiniteLoopsWhenGlobal":false},"mapper":{"text":"{{143.result}}"},"metadata":{"designer":{"x":1459,"y":-650},"parameters":[{"name":"pattern","type":"text","label":"Pattern","required":true},{"name":"global","type":"boolean","label":"Global match","required":true},{"name":"sensitive","type":"boolean","label":"Case sensitive","required":true},{"name":"multiline","type":"boolean","label":"Multiline","required":true},{"name":"singleline","type":"boolean","label":"Singleline","required":true},{"name":"continueWhenNoRes","type":"boolean","label":"Continue the execution of the route even if the module finds no matches","required":true},{"name":"ignoreInfiniteLoopsWhenGlobal","type":"boolean","label":"Ignore errors when there is an infinite search loop","required":true}]}}]}],"metadata":{"version":1}}
Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!
Get this as output:
This is my OpenAI:
[
{
"result": "Hook title: Hoe AI bedrijfsprocessen automatiseert en efficiënter maakt\n\nTitel 1: Beperkingen van traditionele BPA\nSubtitle: Traditionele BPA-systemen kunnen moeite hebben met uitzonderingen en bieden weinig real-time inzichten. Dit beperkt hun effectiviteit in een dynamische omgeving.\n\nTitel 2: De kracht van AI in BPA\nSubtitle: AI stelt bedrijven in staat om complexe processen te automatiseren met behulp van machine learning en natuurlijke taalverwerking. Dit verbetert besluitvorming, efficiëntie en klantbeleving.\n\nTitel 3: Toepassingen van AI in verschillende sectoren\nSubtitle: Van financiële diensten tot de gezondheidszorg, AI wordt breed ingezet om workflows te optimaliseren. Dit leidt tot snellere processen en betere klantondersteuning.\n\nTitel 4: Voordelen van AI in BPA\nSubtitle: AI verhoogt de efficiëntie en nauwkeurigheid, bespaart kosten en verbetert de klantenservice. Deze factoren dragen bij aan een concurrentievoordeel voor organisaties.\n\nTitel 5: Uitdagingen en toekomstige richtingen\nSubtitle: Kwaliteit van data, integratie en een tekort aan vaardigheden zijn belangrijke obstakels. Oplossingen hiervoor zijn essentieel voor succesvolle implementatie van AI in BPA.",
"id": "chatcmpl-9xAmCSwK2J9uxkQf3GdxvCt3tNwX1",
"object": "chat.completion",
"created": "2024-08-17T10:16:44.000Z",
"model": "gpt-4o-mini-2024-07-18",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hook title: Hoe AI bedrijfsprocessen automatiseert en efficiënter maakt\n\nTitel 1: Beperkingen van traditionele BPA\nSubtitle: Traditionele BPA-systemen kunnen moeite hebben met uitzonderingen en bieden weinig real-time inzichten. Dit beperkt hun effectiviteit in een dynamische omgeving.\n\nTitel 2: De kracht van AI in BPA\nSubtitle: AI stelt bedrijven in staat om complexe processen te automatiseren met behulp van machine learning en natuurlijke taalverwerking. Dit verbetert besluitvorming, efficiëntie en klantbeleving.\n\nTitel 3: Toepassingen van AI in verschillende sectoren\nSubtitle: Van financiële diensten tot de gezondheidszorg, AI wordt breed ingezet om workflows te optimaliseren. Dit leidt tot snellere processen en betere klantondersteuning.\n\nTitel 4: Voordelen van AI in BPA\nSubtitle: AI verhoogt de efficiëntie en nauwkeurigheid, bespaart kosten en verbetert de klantenservice. Deze factoren dragen bij aan een concurrentievoordeel voor organisaties.\n\nTitel 5: Uitdagingen en toekomstige richtingen\nSubtitle: Kwaliteit van data, integratie en een tekort aan vaardigheden zijn belangrijke obstakels. Oplossingen hiervoor zijn essentieel voor succesvolle implementatie van AI in BPA.",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 784,
"completion_tokens": 256,
"total_tokens": 1040
},
"system_fingerprint": "fp_48196bc67a"
}
]
Your text doesn’t match the previous format, hence the previous pattern did not work for this one.
Just make it the same as the previous output so that the pattern will work.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!