Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typespec,agents-api): Add system tool call types #584

Closed
wants to merge 1 commit into from
Closed
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
54 changes: 44 additions & 10 deletions agents-api/agents_api/autogen/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,37 @@

from __future__ import annotations

from typing import Annotated
from typing import Annotated, Literal
from uuid import UUID

from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, RootModel


class JinjaTemplate(RootModel[str]):
class IdentifierSafeUnicode(RootModel[str]):
model_config = ConfigDict(
populate_by_name=True,
)
root: str
root: Annotated[
str,
Field(
max_length=120,
pattern="^[\\p{L}\\p{Nl}\\p{Pattern_Syntax}\\p{Pattern_White_Space}]+[\\p{ID_Start}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\p{Pattern_Syntax}\\p{Pattern_White_Space}]*$",
),
]
"""
A valid jinja template.
For Unicode character safety
See: https://unicode.org/reports/tr31/
See: https://www.unicode.org/reports/tr39/#Identifier_Characters
"""


class Limit(RootModel[int]):
class JinjaTemplate(RootModel[str]):
model_config = ConfigDict(
populate_by_name=True,
)
root: Annotated[int, Field(ge=1, lt=1000)]
root: str
"""
Limit the number of results
A valid jinja template.
"""


Expand All @@ -36,13 +44,29 @@ class LogitBias(RootModel[float]):
root: Annotated[float, Field(ge=-100.0, le=100.0)]


class Offset(RootModel[int]):
class PaginationOptions(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
root: Annotated[int, Field(ge=0)]
limit: Annotated[int, Field(100, ge=1, lt=1000)]
"""
Limit the number of items returned
"""
offset: Annotated[int, Field(0, ge=0)]
"""
Offset the items returned
"""
sort_by: Literal["created_at", "updated_at"] = "created_at"
"""
Sort by a field
"""
Offset to apply to the results
direction: Literal["asc", "desc"] = "asc"
"""
Sort direction
"""
metadata_filter: str = "{}"
"""
JSON string of object that should be used to filter objects by metadata
"""


Expand Down Expand Up @@ -115,3 +139,13 @@ class Uuid(RootModel[UUID]):
populate_by_name=True,
)
root: UUID


class ValidPythonIdentifier(RootModel[str]):
model_config = ConfigDict(
populate_by_name=True,
)
root: Annotated[str, Field(max_length=40, pattern="^[^\\W0-9]\\w*$")]
"""
Valid python identifier names
"""
15 changes: 14 additions & 1 deletion agents-api/agents_api/autogen/Sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
from typing import Annotated, Any, Literal
from uuid import UUID

from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, StrictBool
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, RootModel, StrictBool


class ContextOverflowType(RootModel[Literal["truncate", "adaptive"]]):
model_config = ConfigDict(
populate_by_name=True,
)
root: Literal["truncate", "adaptive"]


class CreateSessionRequest(BaseModel):
Expand Down Expand Up @@ -93,6 +100,12 @@ class PatchSessionRequest(BaseModel):
metadata: dict[str, Any] | None = None


class PatchSessionRequestUpdate(PatchSessionRequest):
"""
Payload for patching a session
"""


class Session(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
Expand Down
Loading
Loading