Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ai21/models/responses/plan_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PlanResponse(AI21BaseModel):
updated_at: datetime
assistant_id: str
code: str
schemas: List[Dict[str, Any]]
schemas: Optional[List[Dict[str, Any]]] = None


class ListPlanResponse(AI21BaseModel):
Expand Down
15 changes: 11 additions & 4 deletions examples/studio/assistant/user_defined_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
TIMEOUT = 20


def test_func():
def func():
pass


Expand All @@ -18,8 +18,15 @@ def main():

assistant = ai21_client.beta.assistants.create(name="My Assistant")

plan = ai21_client.beta.assistants.plans.create(assistant_id=assistant.id, code=test_func, schemas=[ExampleSchema])
route = ai21_client.beta.assistants.routes.create(
plan = ai21_client.beta.assistants.plans.create(assistant_id=assistant.id, code=func, schemas=[ExampleSchema])
ai21_client.beta.assistants.routes.create(
assistant_id=assistant.id, plan_id=plan.id, name="My Route", examples=["hi"], description="My Route Description"
)
print(f"Route: {route}")
routes = ai21_client.beta.assistants.routes.list(assistant_id=assistant.id)
print(f"Routes: {routes}")
plans = ai21_client.beta.assistants.plans.list(assistant_id=assistant.id)
print(f"Plans: {plans}")


if __name__ == "__main__":
main()
Loading