Introduction

The Transform API allows you to apply a prompt while transforming your data described by a JSON schema.

Example

In our python example we’ll use pydantic to describe our data.


class Person(BaseModel):
    name: str = Field(description="Full name of this person")
    hobbies: list[str] = Field(description="list of hobbies this person enjoys doing")
    skills: list[str] = Field(description="Skill this person can perform well)

class ActivityRequest(BaseModel):
    description: str = Field("Description of the occasion, the kind of activities the group is interested and other instructions")
    people: list[Person]


class GroupActivity(BaseModel):
    description: str = Field(description="Detailed description of the activity")
    people: list[str] = Field(description="Name of who will be part of this activity")


outropy_api.create_task(
    task_name="recommend_group_activity",
    task_type="transform",
    input_type=ActivityRequest,
    output_type=GroupActivity,
    prompt="Come up with an activity based on the user instructions that features most people while respecting their skills and hobbies."
)