Skip to content

Commit

Permalink
Release 0.1.36
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 29, 2023
1 parent 9e490f4 commit e6a42e1
Show file tree
Hide file tree
Showing 8 changed files with 616 additions and 95 deletions.
519 changes: 519 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "superagent-py"
version = "v0.1.33"
version = "v0.1.36"
description = ""
readme = "README.md"
authors = []
Expand All @@ -11,7 +11,7 @@ packages = [
[tool.poetry.dependencies]
python = "^3.7"
httpx = ">=0.21.2"
pydantic = ">= 1.9.2, < 3"
pydantic = ">= 1.9.2, < 2.5.0"

[tool.poetry.dev-dependencies]
mypy = "0.971"
Expand Down
10 changes: 6 additions & 4 deletions src/superagent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ def __init__(
base_url: typing.Optional[str] = None,
environment: SuperagentEnvironment = SuperagentEnvironment.DEFAULT,
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
timeout: typing.Optional[float] = 60
timeout: typing.Optional[float] = 60,
httpx_client: typing.Optional[httpx.Client] = None
):
self._client_wrapper = SyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
httpx_client=httpx.Client(timeout=timeout),
httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
)
self.agent = AgentClient(client_wrapper=self._client_wrapper)
self.llm = LlmClient(client_wrapper=self._client_wrapper)
Expand All @@ -43,12 +44,13 @@ def __init__(
base_url: typing.Optional[str] = None,
environment: SuperagentEnvironment = SuperagentEnvironment.DEFAULT,
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
timeout: typing.Optional[float] = 60
timeout: typing.Optional[float] = 60,
httpx_client: typing.Optional[httpx.AsyncClient] = None
):
self._client_wrapper = AsyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
httpx_client=httpx.AsyncClient(timeout=timeout),
httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
)
self.agent = AsyncAgentClient(client_wrapper=self._client_wrapper)
self.llm = AsyncLlmClient(client_wrapper=self._client_wrapper)
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.33",
"X-Fern-SDK-Version": "v0.1.36",
}
token = self._get_token()
if token is not None:
Expand Down
44 changes: 22 additions & 22 deletions src/superagent/resources/agent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,21 @@ def get(self, agent_id: str) -> AppModelsResponseAgent:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def update(self, agent_id: str, *, request: AppModelsRequestAgent) -> AppModelsResponseAgent:
def delete(self, agent_id: str) -> typing.Any:
"""
Patch an agent
Delete an agent
Parameters:
- agent_id: str.
- request: AppModelsRequestAgent.
"""
_response = self._client_wrapper.httpx_client.request(
"PATCH",
"DELETE",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/agents/{agent_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AppModelsResponseAgent, _response.json()) # type: ignore
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand All @@ -121,21 +118,24 @@ def update(self, agent_id: str, *, request: AppModelsRequestAgent) -> AppModelsR
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def delete(self, agent_id: str) -> typing.Any:
def update(self, agent_id: str, *, request: AppModelsRequestAgent) -> AppModelsResponseAgent:
"""
Delete an agent
Patch an agent
Parameters:
- agent_id: str.
- request: AppModelsRequestAgent.
"""
_response = self._client_wrapper.httpx_client.request(
"DELETE",
"PATCH",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/agents/{agent_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return pydantic.parse_obj_as(AppModelsResponseAgent, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down Expand Up @@ -485,24 +485,21 @@ async def get(self, agent_id: str) -> AppModelsResponseAgent:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def update(self, agent_id: str, *, request: AppModelsRequestAgent) -> AppModelsResponseAgent:
async def delete(self, agent_id: str) -> typing.Any:
"""
Patch an agent
Delete an agent
Parameters:
- agent_id: str.
- request: AppModelsRequestAgent.
"""
_response = await self._client_wrapper.httpx_client.request(
"PATCH",
"DELETE",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/agents/{agent_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AppModelsResponseAgent, _response.json()) # type: ignore
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand All @@ -511,21 +508,24 @@ async def update(self, agent_id: str, *, request: AppModelsRequestAgent) -> AppM
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def delete(self, agent_id: str) -> typing.Any:
async def update(self, agent_id: str, *, request: AppModelsRequestAgent) -> AppModelsResponseAgent:
"""
Delete an agent
Patch an agent
Parameters:
- agent_id: str.
- request: AppModelsRequestAgent.
"""
_response = await self._client_wrapper.httpx_client.request(
"DELETE",
"PATCH",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/agents/{agent_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return pydantic.parse_obj_as(AppModelsResponseAgent, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down
44 changes: 22 additions & 22 deletions src/superagent/resources/datasource/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,21 @@ def get(self, datasource_id: str) -> AppModelsResponseDatasource:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def update(self, datasource_id: str, *, request: AppModelsRequestDatasource) -> AppModelsResponseDatasource:
def delete(self, datasource_id: str) -> typing.Any:
"""
Update a specific datasource
Delete a specific datasource
Parameters:
- datasource_id: str.
- request: AppModelsRequestDatasource.
"""
_response = self._client_wrapper.httpx_client.request(
"PATCH",
"DELETE",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/datasources/{datasource_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AppModelsResponseDatasource, _response.json()) # type: ignore
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand All @@ -117,21 +114,24 @@ def update(self, datasource_id: str, *, request: AppModelsRequestDatasource) ->
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def delete(self, datasource_id: str) -> typing.Any:
def update(self, datasource_id: str, *, request: AppModelsRequestDatasource) -> AppModelsResponseDatasource:
"""
Delete a specific datasource
Update a specific datasource
Parameters:
- datasource_id: str.
- request: AppModelsRequestDatasource.
"""
_response = self._client_wrapper.httpx_client.request(
"DELETE",
"PATCH",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/datasources/{datasource_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return pydantic.parse_obj_as(AppModelsResponseDatasource, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down Expand Up @@ -210,24 +210,21 @@ async def get(self, datasource_id: str) -> AppModelsResponseDatasource:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def update(self, datasource_id: str, *, request: AppModelsRequestDatasource) -> AppModelsResponseDatasource:
async def delete(self, datasource_id: str) -> typing.Any:
"""
Update a specific datasource
Delete a specific datasource
Parameters:
- datasource_id: str.
- request: AppModelsRequestDatasource.
"""
_response = await self._client_wrapper.httpx_client.request(
"PATCH",
"DELETE",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/datasources/{datasource_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AppModelsResponseDatasource, _response.json()) # type: ignore
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand All @@ -236,21 +233,24 @@ async def update(self, datasource_id: str, *, request: AppModelsRequestDatasourc
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def delete(self, datasource_id: str) -> typing.Any:
async def update(self, datasource_id: str, *, request: AppModelsRequestDatasource) -> AppModelsResponseDatasource:
"""
Delete a specific datasource
Update a specific datasource
Parameters:
- datasource_id: str.
- request: AppModelsRequestDatasource.
"""
_response = await self._client_wrapper.httpx_client.request(
"DELETE",
"PATCH",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/datasources/{datasource_id}"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return pydantic.parse_obj_as(AppModelsResponseDatasource, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down
Loading

0 comments on commit e6a42e1

Please sign in to comment.