Skip to content

Commit

Permalink
Release v0.2.31
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 18, 2024
1 parent 980c929 commit 6243fa0
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 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.30"
version = "v0.2.31"
description = ""
readme = "README.md"
authors = []
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 @@ -16,7 +16,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.30",
"X-Fern-SDK-Version": "v0.2.31",
}
token = self._get_token()
if token is not None:
Expand Down
82 changes: 82 additions & 0 deletions src/superagent/resources/vector_database/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,47 @@ def get(
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def delete(self, vector_db_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
"""
Delete a Vector Database
Parameters:
- vector_db_id: str.
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
"""
_response = self._client_wrapper.httpx_client.request(
"DELETE",
urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"api/v1/vector-dbs/{jsonable_encoder(vector_db_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else 60,
retries=0,
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
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:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def update(
self,
vector_db_id: str,
Expand Down Expand Up @@ -338,6 +379,47 @@ async def get(
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def delete(self, vector_db_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
"""
Delete a Vector Database
Parameters:
- vector_db_id: str.
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
"""
_response = await self._client_wrapper.httpx_client.request(
"DELETE",
urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"api/v1/vector-dbs/{jsonable_encoder(vector_db_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else 60,
retries=0,
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
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:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def update(
self,
vector_db_id: str,
Expand Down

0 comments on commit 6243fa0

Please sign in to comment.