-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcec6b9
commit 710f2c6
Showing
16 changed files
with
423 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from . import agent, api_user, datasource, llm, tool, workflow | ||
from . import agent, api_user, datasource, llm, tool, vector_database, workflow | ||
|
||
__all__ = ["agent", "api_user", "datasource", "llm", "tool", "workflow"] | ||
__all__ = ["agent", "api_user", "datasource", "llm", "tool", "vector_database", "workflow"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
import typing | ||
import urllib.parse | ||
from json.decoder import JSONDecodeError | ||
|
||
from ...core.api_error import ApiError | ||
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper | ||
from ...core.jsonable_encoder import jsonable_encoder | ||
from ...errors.unprocessable_entity_error import UnprocessableEntityError | ||
from ...types.app_models_request_vector_db import AppModelsRequestVectorDb | ||
from ...types.app_models_response_vector_db import AppModelsResponseVectorDb | ||
from ...types.http_validation_error import HttpValidationError | ||
from ...types.vector_db_list import VectorDbList | ||
|
||
try: | ||
import pydantic.v1 as pydantic # type: ignore | ||
except ImportError: | ||
import pydantic # type: ignore | ||
|
||
# this is used as the default value for optional parameters | ||
OMIT = typing.cast(typing.Any, ...) | ||
|
||
|
||
class VectorDatabaseClient: | ||
def __init__(self, *, client_wrapper: SyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
def create(self, *, request: AppModelsRequestVectorDb) -> AppModelsResponseVectorDb: | ||
""" | ||
Create a new Vector Database | ||
Parameters: | ||
- request: AppModelsRequestVectorDb. | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/vector-db"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseVectorDb, _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 list(self) -> VectorDbList: | ||
""" | ||
List all Vector Databases | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"GET", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/vector-dbs"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(VectorDbList, _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 get(self, vector_db_id: str) -> AppModelsResponseVectorDb: | ||
""" | ||
Get a single Vector Database | ||
Parameters: | ||
- vector_db_id: str. | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"GET", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/vector-dbs/{vector_db_id}"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseVectorDb, _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, *, request: AppModelsRequestVectorDb) -> AppModelsResponseVectorDb: | ||
""" | ||
Patch a Vector Database | ||
Parameters: | ||
- vector_db_id: str. | ||
- request: AppModelsRequestVectorDb. | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"PATCH", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/vector-dbs/{vector_db_id}"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseVectorDb, _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) | ||
|
||
|
||
class AsyncVectorDatabaseClient: | ||
def __init__(self, *, client_wrapper: AsyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
async def create(self, *, request: AppModelsRequestVectorDb) -> AppModelsResponseVectorDb: | ||
""" | ||
Create a new Vector Database | ||
Parameters: | ||
- request: AppModelsRequestVectorDb. | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/vector-db"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseVectorDb, _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 list(self) -> VectorDbList: | ||
""" | ||
List all Vector Databases | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"GET", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/vector-dbs"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(VectorDbList, _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 get(self, vector_db_id: str) -> AppModelsResponseVectorDb: | ||
""" | ||
Get a single Vector Database | ||
Parameters: | ||
- vector_db_id: str. | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"GET", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/vector-dbs/{vector_db_id}"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseVectorDb, _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, *, request: AppModelsRequestVectorDb) -> AppModelsResponseVectorDb: | ||
""" | ||
Patch a Vector Database | ||
Parameters: | ||
- vector_db_id: str. | ||
- request: AppModelsRequestVectorDb. | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"PATCH", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/vector-dbs/{vector_db_id}"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseVectorDb, _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) |
Oops, something went wrong.