From 6243fa05f2309524331a08122059fc3c38523f2b Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:46:20 +0000 Subject: [PATCH] Release v0.2.31 --- pyproject.toml | 2 +- src/superagent/core/client_wrapper.py | 2 +- .../resources/vector_database/client.py | 82 +++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bc75047..5dee578 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "superagent-py" -version = "v0.2.30" +version = "v0.2.31" description = "" readme = "README.md" authors = [] diff --git a/src/superagent/core/client_wrapper.py b/src/superagent/core/client_wrapper.py index 75caa7b..aed63cf 100644 --- a/src/superagent/core/client_wrapper.py +++ b/src/superagent/core/client_wrapper.py @@ -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: diff --git a/src/superagent/resources/vector_database/client.py b/src/superagent/resources/vector_database/client.py index 0a0a2e2..7bb085e 100644 --- a/src/superagent/resources/vector_database/client.py +++ b/src/superagent/resources/vector_database/client.py @@ -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, @@ -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,