3 Pro Tips for Consistent and Reliable AI Results in Your Flows

Many of us are using powerful AI actions to interact with models like Gemini and ChatGPT to extract information, summarize text, and generate content. But sometimes, you might notice the AI's output can be a little inconsistent. For example, you ask it to pull an "Invoice Number," and it returns "Invoice #" one time and "Inv. No." the next.

This can be frustrating when you need reliable, structured data for the next steps in your flow. Here are three powerful techniques you can use right inside the AI actions to boost consistency and get the exact output you need, every time.


1. Provide a Clear Example


The single most effective way to guide an AI model is to show it exactly what you want. The "Examples" section in the AI action is built for this. By providing a sample input and the corresponding perfect output, you give the AI a template to follow.

This technique, often called "few-shot prompting," dramatically improves reliability. For most data extraction tasks, providing just one or two good examples is enough to lock the AI onto your desired format.



2. Force the Output into a JSON Structure


If you need a rock-solid data structure, forcing the output into JSON format is the best approach. This tells the AI to act less like a creative writer and more like a data entry machine, using the exact field names you specify.

How to do it:

  • Enable the Output as JSON toggle in the action's settings.

  • In your prompt, provide a sample of the JSON structure you want. For example:

*"Please extract the data from the attached document and format it as the following JSON. Here is an example of the structure I need:

{
 "vendor_name": "The name of the vendor",
 "invoice_id": "The invoice number",
 "purchase_order": "The PO number"
}
```"*

Once you have the JSON output, add the 'Convert JSON to object' action right after the AI step. This will transform the JSON text into usable Zenphi tokens, which you can then easily select from the token picker (chain icon ⛓️) in your next actions.



3. Adjust the Generation Parameters


For fine-grained control, you can adjust the "Generation Config" parameters. These settings control the AI's "creativity." For data extraction, you usually want less creativity and more predictability.

You can adjust parameters like Temperature, Top-P, and Top-K to change the AI's response. We have a complete article explaining how each of these works and their effect on the output, which you can find here:

#Quick Guide: Tuning Gemini AI Settings in Zenphi

Pro-Tip: Not sure what the best settings are? Ask the AI itself! Go to the Gemini or ChatGPT web UI, paste your prompt and your desired output, and ask: "What are the best Temperature, Top-P, and Top-K settings to consistently get this type of output from this input?" It will give you a great starting point.



By combining these three techniques, you can transform the AI actions into a highly reliable and consistent tool for your automation needs.

How are you using AI in your flows? Share your own tips in the comments below!