AgentMark supports structured Object/JSON output through JSON Schema definitions. This allows you to define exactly what data structure you expect from the model, ensuring consistent and parseable responses.

Basic Usage

Define a schema in your prompt’s config to get structured output:

---
name: extract-contacts
object_config:
  model_name: gpt-4
  schema:
    type: object
    properties:
      contacts:
        type: array
        items:
          type: object
          properties:
            name:
              type: string
              description: "Full name of the person"
            email:
              type: string
              description: "Email address if mentioned"
          required: ["name"]
---

<System>
Extract contact information from the provided text.
</System>

<User>
Please contact John Smith (john@example.com) or Sarah Wilson regarding the project.
</User>

This will return:

{
  "contacts": [
    {
      "name": "John Smith",
      "email": "john@example.com"
    },
    {
      "name": "Sarah Wilson"
    }
  ]
}

Learn More

For detailed information about schema types, complex structures, and best practices, see the AgentMark Object Schema Documentation.

Key features include:

  • Multiple data types (string, number, boolean, array, object)
  • Nested structures
  • Required field specifications
  • Type validations
  • Detailed property descriptions

Have Questions?

We’re here to help! Choose the best way to reach us: