How do I present structured function output data to the model?

I understand how Structured Outputs work for when the model’s function call needs to be structured. But what about structured input?

For example, I have a function that returns an excerpt of a markdown document along with some metadata:

[
  {
    "sha1": "document-and-metadata-hash",
    "content": "a long string with markdown formatting, likely containing \n newlines\n, and code blocks",
    "meta": {
      "url": "https://example.com/souce-url",
      "section_heading": "Original heading of excerpt"
    }
  }
]

How should I present this data to the model in my function response? Should I keep it in JSON format, use pseudo-xml tags, or just plain text (and let the model figure it out)?

I only see examples in the documentation of simple data types of a single number or string of text.

You can return anything you want to the language model. The text will just be placed as contents to a new message.

  • Plain text will be the least consumption of tokens.
  • key:value will be the best representation of data, as a stream of tokens doesn’t have visual alignment of columns or headings to an AI.
  • the information will be better understood if it includes some context about where it came from, just like you would need in order to understand what was sent back.

The return should just be what is expected and described to be returned by the function description.