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: Add basic support for integration tools to ToolStep #519

Merged
merged 7 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
Loading