Skip to content

Commit

Permalink
Release v0.1.47
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 22, 2023
1 parent 2a4892f commit 46ce887
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 49 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.1.45"
version = "v0.1.47"
description = ""
readme = "README.md"
authors = []
Expand Down
6 changes: 6 additions & 0 deletions src/superagent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
AppModelsRequestLlm,
AppModelsRequestTool,
AppModelsRequestWorkflow,
AppModelsRequestWorkflowStep,
AppModelsResponseAgent,
AppModelsResponseAgentInvoke,
AppModelsResponseApiUser,
AppModelsResponseDatasource,
AppModelsResponseLlm,
AppModelsResponseTool,
AppModelsResponseWorkflow,
AppModelsResponseWorkflowStep,
DatasourceList,
DatasourceStatus,
DatasourceType,
Expand All @@ -39,6 +41,7 @@
ValidationError,
ValidationErrorLocItem,
WorkflowList,
WorkflowStepList,
)
from .errors import UnprocessableEntityError
from .resources import agent, api_user, datasource, llm, tool, workflow
Expand All @@ -54,13 +57,15 @@
"AppModelsRequestLlm",
"AppModelsRequestTool",
"AppModelsRequestWorkflow",
"AppModelsRequestWorkflowStep",
"AppModelsResponseAgent",
"AppModelsResponseAgentInvoke",
"AppModelsResponseApiUser",
"AppModelsResponseDatasource",
"AppModelsResponseLlm",
"AppModelsResponseTool",
"AppModelsResponseWorkflow",
"AppModelsResponseWorkflowStep",
"DatasourceList",
"DatasourceStatus",
"DatasourceType",
Expand All @@ -85,6 +90,7 @@
"ValidationError",
"ValidationErrorLocItem",
"WorkflowList",
"WorkflowStepList",
"agent",
"api_user",
"datasource",
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.1.45",
"X-Fern-SDK-Version": "v0.1.47",
}
token = self._get_token()
if token is not None:
Expand Down
21 changes: 19 additions & 2 deletions src/superagent/resources/agent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
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.agent_datasosurce_list import AgentDatasosurceList
from ...types.agent_list import AgentList
Expand All @@ -30,18 +31,26 @@ class AgentClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper

def list(self) -> AgentList:
def list(self, *, skip: typing.Optional[int] = None, limit: typing.Optional[int] = None) -> AgentList:
"""
List all agents
Parameters:
- skip: typing.Optional[int].
- limit: typing.Optional[int].
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/agents"),
params=remove_none_from_dict({"skip": skip, "limit": limit}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AgentList, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -420,18 +429,26 @@ class AsyncAgentClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper

async def list(self) -> AgentList:
async def list(self, *, skip: typing.Optional[int] = None, limit: typing.Optional[int] = None) -> AgentList:
"""
List all agents
Parameters:
- skip: typing.Optional[int].
- limit: typing.Optional[int].
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/agents"),
params=remove_none_from_dict({"skip": skip, "limit": limit}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AgentList, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down
Loading

0 comments on commit 46ce887

Please sign in to comment.