Skip to content

Commit

Permalink
update pydantic
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya1503 committed Feb 7, 2025
1 parent 6b6f07a commit 89647dc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers = [
]
dependencies = [
"codex-sdk==0.1.0a9",
"pydantic>=1.9.0, <3",
"pydantic==2.10",
]

[project.urls]
Expand Down
4 changes: 1 addition & 3 deletions src/cleanlab_codex/internal/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@


def list_organizations(client: _Codex) -> list[Organization]:
return [
Organization.model_validate(org.model_dump()) for org in client.users.myself.organizations.list().organizations
]
return [Organization.model_validate(org) for org in client.users.myself.organizations.list().organizations]
6 changes: 2 additions & 4 deletions src/cleanlab_codex/internal/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ def query_project(
) -> tuple[Optional[str], Optional[Entry]]:
maybe_entry = client.projects.entries.query(project_id, question=question)
if maybe_entry is not None:
entry = Entry.model_validate(maybe_entry.model_dump())
entry = Entry.model_validate(maybe_entry)
if entry.answer is not None:
return entry.answer, entry

return fallback_answer, entry

if not read_only:
created_entry = Entry.model_validate(
client.projects.entries.add_question(project_id, question=question).model_dump()
)
created_entry = Entry.model_validate(client.projects.entries.add_question(project_id, question=question))
return fallback_answer, created_entry

return fallback_answer, None

0 comments on commit 89647dc

Please sign in to comment.