Skip to content

Commit

Permalink
fix: change schemas field in PlanResponse to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalAI21 committed Jan 13, 2025
1 parent 4a7dfe0 commit 2f8172c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
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()

0 comments on commit 2f8172c

Please sign in to comment.