Skip to content

Commit

Permalink
Release v0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 10, 2024
1 parent 7bec1b3 commit 1e4f6e4
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 53 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "superagent-py"
version = "v0.2.1"
version = "v0.2.2"
description = ""
readme = "README.md"
authors = []
Expand Down
2 changes: 0 additions & 2 deletions src/superagent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
AppModelsRequestApiUser,
AppModelsRequestDatasource,
AppModelsRequestLlm,
AppModelsRequestTool,
AppModelsRequestVectorDb,
AppModelsRequestWorkflow,
AppModelsRequestWorkflowStep,
Expand Down Expand Up @@ -73,7 +72,6 @@
"AppModelsRequestApiUser",
"AppModelsRequestDatasource",
"AppModelsRequestLlm",
"AppModelsRequestTool",
"AppModelsRequestVectorDb",
"AppModelsRequestWorkflow",
"AppModelsRequestWorkflowStep",
Expand Down
2 changes: 1 addition & 1 deletion src/superagent/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "superagent-py",
"X-Fern-SDK-Version": "v0.2.1",
"X-Fern-SDK-Version": "v0.2.2",
}
token = self._get_token()
if token is not None:
Expand Down
127 changes: 114 additions & 13 deletions src/superagent/resources/tool/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from ...core.jsonable_encoder import jsonable_encoder
from ...core.remove_none_from_dict import remove_none_from_dict
from ...errors.unprocessable_entity_error import UnprocessableEntityError
from ...types.app_models_request_tool import AppModelsRequestTool
from ...types.app_models_response_tool import AppModelsResponseTool
from ...types.http_validation_error import HttpValidationError
from ...types.tool_list import ToolList
Expand Down Expand Up @@ -53,17 +52,40 @@ def list(self, *, skip: typing.Optional[int] = None, take: typing.Optional[int]
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def create(self, *, request: AppModelsRequestTool) -> AppModelsResponseTool:
def create(
self,
*,
name: str,
description: typing.Optional[str] = OMIT,
type: str,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
return_direct: typing.Optional[bool] = OMIT,
) -> AppModelsResponseTool:
"""
Create a new tool
Parameters:
- request: AppModelsRequestTool.
- name: str.
- description: typing.Optional[str].
- type: str.
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
- return_direct: typing.Optional[bool].
"""
_request: typing.Dict[str, typing.Any] = {"name": name, "type": type}
if description is not OMIT:
_request["description"] = description
if metadata is not OMIT:
_request["metadata"] = metadata
if return_direct is not OMIT:
_request["returnDirect"] = return_direct
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/tools"),
json=jsonable_encoder(request),
json=jsonable_encoder(_request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -123,19 +145,47 @@ def delete(self, tool_id: str) -> typing.Any:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def update(self, tool_id: str, *, request: AppModelsRequestTool) -> AppModelsResponseTool:
def update(
self,
tool_id: str,
*,
name: typing.Optional[str] = OMIT,
description: typing.Optional[str] = OMIT,
type: typing.Optional[str] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
return_direct: typing.Optional[bool] = OMIT,
) -> AppModelsResponseTool:
"""
Update a specific tool
Parameters:
- tool_id: str.
- request: AppModelsRequestTool.
- name: typing.Optional[str].
- description: typing.Optional[str].
- type: typing.Optional[str].
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
- return_direct: typing.Optional[bool].
"""
_request: typing.Dict[str, typing.Any] = {}
if name is not OMIT:
_request["name"] = name
if description is not OMIT:
_request["description"] = description
if type is not OMIT:
_request["type"] = type
if metadata is not OMIT:
_request["metadata"] = metadata
if return_direct is not OMIT:
_request["returnDirect"] = return_direct
_response = self._client_wrapper.httpx_client.request(
"PATCH",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/tools/{tool_id}"),
json=jsonable_encoder(request),
json=jsonable_encoder(_request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -180,17 +230,40 @@ async def list(self, *, skip: typing.Optional[int] = None, take: typing.Optional
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def create(self, *, request: AppModelsRequestTool) -> AppModelsResponseTool:
async def create(
self,
*,
name: str,
description: typing.Optional[str] = OMIT,
type: str,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
return_direct: typing.Optional[bool] = OMIT,
) -> AppModelsResponseTool:
"""
Create a new tool
Parameters:
- request: AppModelsRequestTool.
- name: str.
- description: typing.Optional[str].
- type: str.
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
- return_direct: typing.Optional[bool].
"""
_request: typing.Dict[str, typing.Any] = {"name": name, "type": type}
if description is not OMIT:
_request["description"] = description
if metadata is not OMIT:
_request["metadata"] = metadata
if return_direct is not OMIT:
_request["returnDirect"] = return_direct
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/tools"),
json=jsonable_encoder(request),
json=jsonable_encoder(_request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -250,19 +323,47 @@ async def delete(self, tool_id: str) -> typing.Any:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def update(self, tool_id: str, *, request: AppModelsRequestTool) -> AppModelsResponseTool:
async def update(
self,
tool_id: str,
*,
name: typing.Optional[str] = OMIT,
description: typing.Optional[str] = OMIT,
type: typing.Optional[str] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
return_direct: typing.Optional[bool] = OMIT,
) -> AppModelsResponseTool:
"""
Update a specific tool
Parameters:
- tool_id: str.
- request: AppModelsRequestTool.
- name: typing.Optional[str].
- description: typing.Optional[str].
- type: typing.Optional[str].
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
- return_direct: typing.Optional[bool].
"""
_request: typing.Dict[str, typing.Any] = {}
if name is not OMIT:
_request["name"] = name
if description is not OMIT:
_request["description"] = description
if type is not OMIT:
_request["type"] = type
if metadata is not OMIT:
_request["metadata"] = metadata
if return_direct is not OMIT:
_request["returnDirect"] = return_direct
_response = await self._client_wrapper.httpx_client.request(
"PATCH",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/tools/{tool_id}"),
json=jsonable_encoder(request),
json=jsonable_encoder(_request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down
2 changes: 0 additions & 2 deletions src/superagent/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from .app_models_request_api_user import AppModelsRequestApiUser
from .app_models_request_datasource import AppModelsRequestDatasource
from .app_models_request_llm import AppModelsRequestLlm
from .app_models_request_tool import AppModelsRequestTool
from .app_models_request_vector_db import AppModelsRequestVectorDb
from .app_models_request_workflow import AppModelsRequestWorkflow
from .app_models_request_workflow_step import AppModelsRequestWorkflowStep
Expand Down Expand Up @@ -70,7 +69,6 @@
"AppModelsRequestApiUser",
"AppModelsRequestDatasource",
"AppModelsRequestLlm",
"AppModelsRequestTool",
"AppModelsRequestVectorDb",
"AppModelsRequestWorkflow",
"AppModelsRequestWorkflowStep",
Expand Down
2 changes: 1 addition & 1 deletion src/superagent/types/app_models_request_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class AppModelsRequestDatasource(pydantic.BaseModel):
name: str
description: str
description: typing.Optional[str]
type: str
content: typing.Optional[str]
url: typing.Optional[str]
Expand Down
33 changes: 0 additions & 33 deletions src/superagent/types/app_models_request_tool.py

This file was deleted.

0 comments on commit 1e4f6e4

Please sign in to comment.