Skip to content

Commit

Permalink
feat: Update typespec for integrations
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Sep 24, 2024
1 parent 6896c23 commit a914e7c
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 78 deletions.
135 changes: 116 additions & 19 deletions agents-api/agents_api/autogen/Tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class CreateToolRequest(BaseModel):
"""
Name of the tool (must be unique for this agent and a valid python identifier string )
"""
function: FunctionDef
function: FunctionDef | None = None
"""
The function to call
"""
integration: Any | None = None
system: Any | None = None
integration: IntegrationDef | None = None
system: SystemDef | None = None
api_call: Any | None = None


Expand All @@ -75,14 +75,7 @@ class FunctionDef(BaseModel):
"""
DO NOT USE: This will be overriden by the tool name. Here only for compatibility reasons.
"""
description: Annotated[
str | None,
Field(
None,
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}]*$",
),
]
description: str | None = None
"""
Description of the function
"""
Expand All @@ -92,6 +85,66 @@ class FunctionDef(BaseModel):
"""


class IntegrationDef(BaseModel):
"""
Integration definition
"""

model_config = ConfigDict(
populate_by_name=True,
)
provider: str
"""
The provider of the integration
"""
method: str | None = None
"""
The specific method of the integration to call
"""
description: str | None = None
"""
Optional description of the integration
"""
setup: dict[str, Any] | None = None
"""
The setup parameters the integration accepts
"""
arguments: dict[str, Any] | None = None
"""
The arguments to pre-apply to the integration call
"""


class IntegrationDefUpdate(BaseModel):
"""
Integration definition
"""

model_config = ConfigDict(
populate_by_name=True,
)
provider: str | None = None
"""
The provider of the integration
"""
method: str | None = None
"""
The specific method of the integration to call
"""
description: str | None = None
"""
Optional description of the integration
"""
setup: dict[str, Any] | None = None
"""
The setup parameters the integration accepts
"""
arguments: dict[str, Any] | None = None
"""
The arguments to pre-apply to the integration call
"""


class NamedToolChoice(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -126,11 +179,55 @@ class PatchToolRequest(BaseModel):
"""
The function to call
"""
integration: Any | None = None
system: Any | None = None
integration: IntegrationDefUpdate | None = None
system: SystemDefUpdate | None = None
api_call: Any | None = None


class SystemDef(BaseModel):
"""
System definition
"""

model_config = ConfigDict(
populate_by_name=True,
)
call: str
"""
The name of the system call
"""
description: str | None = None
"""
Optional description of the system call
"""
arguments: dict[str, Any] | None = None
"""
The arguments to pre-apply to the system call
"""


class SystemDefUpdate(BaseModel):
"""
System definition
"""

model_config = ConfigDict(
populate_by_name=True,
)
call: str | None = None
"""
The name of the system call
"""
description: str | None = None
"""
Optional description of the system call
"""
arguments: dict[str, Any] | None = None
"""
The arguments to pre-apply to the system call
"""


class Tool(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
Expand All @@ -143,12 +240,12 @@ class Tool(BaseModel):
"""
Name of the tool (must be unique for this agent and a valid python identifier string )
"""
function: FunctionDef
function: FunctionDef | None = None
"""
The function to call
"""
integration: Any | None = None
system: Any | None = None
integration: IntegrationDef | None = None
system: SystemDef | None = None
api_call: Any | None = None
created_at: Annotated[AwareDatetime, Field(json_schema_extra={"readOnly": True})]
"""
Expand Down Expand Up @@ -188,12 +285,12 @@ class UpdateToolRequest(BaseModel):
"""
Name of the tool (must be unique for this agent and a valid python identifier string )
"""
function: FunctionDef
function: FunctionDef | None = None
"""
The function to call
"""
integration: Any | None = None
system: Any | None = None
integration: IntegrationDef | None = None
system: SystemDef | None = None
api_call: Any | None = None


Expand Down
97 changes: 49 additions & 48 deletions typespec/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a914e7c

Please sign in to comment.