Control line display - helph

I am using an API that returns lines with content, and for that, I am using the functions tab. However, I want to define a number of lines to be returned, which is 8. Inside the function, in the “Description”, I specify that it should return a maximum of 8 lines, but it does not follow this recommendation and brings a random number instead.

Your posting, and what you are doing, is a bit indecipherable based on the language you have written. As best as I can interpret what you might be discussing:

  • You are employing a non-OpenAI API that returns information.
  • One of the fields that this API accepts is a line count, which determines the length of content that is returned.

then

  • You are here because you are using OpenAI products
  • You are using an AI model’s function-call ability (where you see a “tab”, I don’t know)
  • The AI is being tasked with writing the exact API call that the outside service needs
  • You provide some instruction about a maximum number of lines, but the AI is not employing the API correctly.

or an alternate interpretation:

  • your use of an external API function is placing a long multi-line text passage as the return value for the tool call made by the AI.
  • when the AI then writes to the user with this knowledge, it employs amounts of the text that don’t seem to fulfill your length desires.

If the issue is with calling an external API correctly, we’d normally provide a function for the AI to use that has only the relevant fields. For example, your code might interact with an SQL database, but you’d not want the AI writing SQL queries: you want to give it a function recent_customers(days:number) that is task-specific. Your code fills in the defaults and writes the external API call.

If the issue is with how much the AI writes, this should be either system message instructions, or better, instructions for the AI that you add as a preface to the information being returned in the tool call output, such as, “Recite at most six lines from this automatic data retrieval, finding those lines most relevant to user concerns”.

Description will help the AI use the tool correctly, but really won’t guide what happens after.

Does one of these fit what you are doing, experiencing, and offer a solution?

Hi, thanks for the reply. I’m not really sure if I wrote my issue very clearly. I’m also using a translator to create the text.

My issue is that when the assistant returns the API data, it returns an “x” amount of rows, and my doubt is whether there’s any way to control the amount of data returned in the chat using the “Function” part.

To exemplify how the API works, it’s a search for invoices with tax discrepancies. Currently, in the test server, we have several invoices with discrepancies, and what we want is to display the first 8 discrepancies. If there are more than 8, we want to notify that access to the dashboard is required.

I’ll try the solution you sent, thanks again for the reply.