Examples

List who was there and what they will do

Open in playground →

Meeting notes name a different number of people each day. An array returns as many items as the notes hold: here, the names of the people at the standup.

  • array
  • String lists

Challenges

  • Marco is mentioned but was out sick, so he does not belong in attendees. The array takes only the items its instructions ask for.
  • The number of items is not fixed: an array ends when no more items belong in it. minItems and maxItems can bound it.
  • Each item is a typed string, and the items of an array are distinct.
import os
from typellm import TypeLLMClient

client = TypeLLMClient(api_key=os.environ["TYPELLM_API_KEY"])
response = client.generate(
    context="Standup, Tuesday 6 October. Present: Priya, Jun and Leo. Marco is out sick. Jun shipped the CSV export yesterday. Priya will fix the login timeout by Thursday, Jun will write the release notes, and Leo will review the new pricing page.",
    questions={
      "attendees": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "instructions": "Names of the people at the standup."
      }
    },
)
print(response)

Time 0.36 s · Cost $0.0000044

Generation(
    result={
        'attendees': [
            'Priya',
            'Jun',
            'Leo',
        ],
    },
    thinking={},
    usage=Usage(input_tokens=88, thinking_tokens=0),
)