Hi, I am using chatGPT to power/feed data to my app via the api. I have not found a way to output the data from the api in a format to take advantage of the JSON to Data Field functionality (seen here: https://docs.flutterflow.io/data-and-backend/custom-data-types/custom-data-type-with-api).
I have therefore gone a different route which is to take the output from the api, run it through a custom function to convert the format so that it's readable by JSON paths and store it in an App State. I was then hoping, knowing that it is now in the correct format to be able to extract the relevant objects (in my case: name, description and google search link) from the App State but I cannot see any way of achieving this.
Does anyone have any experience or tips as to how I can achieve my goal (which is essentially getting JSON objects from the chatGPT output to my data fields)?
I am new to Flutterflow, so apologues in advance if I have not included all the data I should have here. Please let me know if you need more!
The ChatGPT Output before running through Custom Function
{id: chatcmpl-xxxx-removedkey-xxxx, object: chat.completion, created: 1700169287, model: gpt-3.5-turbo-1106, choices: [{index: 0, message: {role: assistant, content: null, function_call: {name: formatSuggestions, arguments: {"suggestions":[{"name":"Paris","description":"The city of love, art, and culture. Known for iconic landmarks like the Eiffel Tower and the Louvre Museum.","google_search_link":"https://www.google.com/search?q=Paris"},{"name":"Barcelona","description":"A vibrant and lively city with unique architecture, beautiful beaches, and a rich culinary scene. Home to the famous Sagrada Familia and Park Güell.","google_search_link":"https://www.google.com/search?q=Barcelona"}]}}}, finish_reason: stop}], usage: {prompt_tokens: 94, completion_tokens: 105, total_tokens: 199}, system_fingerprint: fp_eeff13170a}
The ouput after running through my Custom Function:
{"names":["Paris","Barcelona"],"descriptions":["The city of light, known for its art, cuisine, and iconic landmarks like the Eiffel Tower and Louvre Museum.","A vibrant city with stunning architecture, beautiful beaches, and a rich cultural heritage, including the famous Sagrada Familia."],"links":["https://www.google.com/search?q=Paris","https://www.google.com/search?q=Barcelona"]}
it is the above that I was hoping to use a JSON paths to extract the names, descriptions and links to store as custom data fields to then display in various text boxes on my app:
names: $..names
descriptions: $..descriptions
google_search_link: $..google_search_link