Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Optimize json format when connecting to LLM

amadra
8 - Asteroid

Hi Community,

I want to change & optimize my json format. Within the attached workflow, left side shows current json and the right side shows desired output (sample data). I am not an expert on the JSON Build tool and hence, asking for recommendations.

Background/context: 

I am using json format as part of my API call to a LLM.

The current format has redundant fields (repeated values for company name and comments fields) and I want to optimize the json format so I can ask the LLM to process less tokens.


7 REPLIES 7
amadra
8 - Asteroid

Anyone? Is this even possible using JSON Build?

apathetichell
19 - Altair

You have to take a step back and figure out which is your outer JSON and which is your inner JSON. I don't think my format replicates yours but the JSON should be the same.

amadra
8 - Asteroid

@apathetichell- This is great! Thanks for taking the time to put this together.
The only challenge is that the output is not a valid json format. I am trying to figure it out. Once I do, ill mark your answer as the solution.

apathetichell
19 - Altair

fixed/tested in a json linter. seems fine. Note --- for the nested part I totally dropped the build tool and manually built it (which is what I would normally do).

amadra
8 - Asteroid

wow.jpg

amadra
8 - Asteroid

Genius!!

Its even better and also valid json. Leant so much about building json in Alteryx - just looking at your workflow!
Thank you very much 🤗

apathetichell
19 - Altair

Glad that helps.

Labels
Top Solution Authors