Only 1 finding when asked for as many as possible?

Hello - i try to use this request to the API -

    resp = client.responses.parse(
      model = "gpt-4o",
      input=[
        {"role": "system", "content": """You are a helpful assistant.""",},
        {"role": "user", "content": """
Please find as many matches as possible for DHL in Germany for the same type and similar size companies
"""},
      ],
      text_format = OutputData,
    )

As you can see i try to ask for “as many matches” as possible.
But most of the time i only get on response / answer looking like that:

['IBM Watson Health', 'Hermes Germany GmbH', 'https://www.myhermes.de/', 'Hamburg, Germany']

Only very rarely (1 out of 10 runs i would say) i get a more comprehensive list like:

['IBM Watson Health', 'DPDgroup', 'https://www.dpd.com', 'Aschaffenburg, Germany']
['IBM Watson Health', 'Hermes', 'https://www.hermesworld.com', 'Hamburg, Germany']
['IBM Watson Health', 'UPS Germany', 'https://www.ups.com', 'Neuss, Germany']
['IBM Watson Health', 'FedEx Germany', 'https://www.fedex.com', 'Kelsterbach, Germany']
['IBM Watson Health', 'GLS Germany', 'https://gls-group.eu', 'Eschborn, Germany']

What can i do or how can i rephrase the prompt so i will get all the possible matches as output an not only one when running the request=

With the API request that you show, which has no additional tools or grounding, the AI has no actual mechanism, “find”. So better would be a prompt, “provide from your extensive knowledge..”

Plus, if you want factual information, you’ll likely want the web search tool or your own web search query context injection in a format that the AI can process it for improvement.

Then, you don’t show us the schema that you are passing. It seems the desired output is for the AI to make multiple lists on lines - NOT a valid JSON, and only a fluke of the API allowing the AI to repeat itself.

If you have an object with an array of objects (whereas here you show a list of strings), you’ll need language right in the properties description of the number of items supported, that the AI can continue adding items to the array, the maximum items are 20, etc.

Here’s no schema, just an AI that is instructed to write lists, and the clearly-phrased request for language production:

2 Likes