Skip to content

Commit

Permalink
Release v0.1.53
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jan 2, 2024
1 parent bcec6b9 commit 710f2c6
Show file tree
Hide file tree
Showing 16 changed files with 423 additions and 5 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.52"
version = "v0.1.53"
description = ""
readme = "README.md"
authors = []
Expand Down
13 changes: 12 additions & 1 deletion src/superagent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
AppModelsRequestDatasource,
AppModelsRequestLlm,
AppModelsRequestTool,
AppModelsRequestVectorDb,
AppModelsRequestWorkflow,
AppModelsRequestWorkflowStep,
AppModelsResponseAgent,
Expand All @@ -17,6 +18,7 @@
AppModelsResponseDatasource,
AppModelsResponseLlm,
AppModelsResponseTool,
AppModelsResponseVectorDb,
AppModelsResponseWorkflow,
AppModelsResponseWorkflowStep,
DatasourceList,
Expand All @@ -34,17 +36,20 @@
PrismaModelsDatasource,
PrismaModelsLlm,
PrismaModelsTool,
PrismaModelsVectorDb,
PrismaModelsWorkflow,
PrismaModelsWorkflowStep,
ToolList,
ToolType,
ValidationError,
ValidationErrorLocItem,
VectorDbList,
VectorDbProvider,
WorkflowList,
WorkflowStepList,
)
from .errors import UnprocessableEntityError
from .resources import agent, api_user, datasource, llm, tool, workflow
from .resources import agent, api_user, datasource, llm, tool, vector_database, workflow
from .environment import SuperagentEnvironment

__all__ = [
Expand All @@ -56,6 +61,7 @@
"AppModelsRequestDatasource",
"AppModelsRequestLlm",
"AppModelsRequestTool",
"AppModelsRequestVectorDb",
"AppModelsRequestWorkflow",
"AppModelsRequestWorkflowStep",
"AppModelsResponseAgent",
Expand All @@ -64,6 +70,7 @@
"AppModelsResponseDatasource",
"AppModelsResponseLlm",
"AppModelsResponseTool",
"AppModelsResponseVectorDb",
"AppModelsResponseWorkflow",
"AppModelsResponseWorkflowStep",
"DatasourceList",
Expand All @@ -81,6 +88,7 @@
"PrismaModelsDatasource",
"PrismaModelsLlm",
"PrismaModelsTool",
"PrismaModelsVectorDb",
"PrismaModelsWorkflow",
"PrismaModelsWorkflowStep",
"SuperagentEnvironment",
Expand All @@ -89,12 +97,15 @@
"UnprocessableEntityError",
"ValidationError",
"ValidationErrorLocItem",
"VectorDbList",
"VectorDbProvider",
"WorkflowList",
"WorkflowStepList",
"agent",
"api_user",
"datasource",
"llm",
"tool",
"vector_database",
"workflow",
]
3 changes: 3 additions & 0 deletions src/superagent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .resources.datasource.client import AsyncDatasourceClient, DatasourceClient
from .resources.llm.client import AsyncLlmClient, LlmClient
from .resources.tool.client import AsyncToolClient, ToolClient
from .resources.vector_database.client import AsyncVectorDatabaseClient, VectorDatabaseClient
from .resources.workflow.client import AsyncWorkflowClient, WorkflowClient


Expand All @@ -35,6 +36,7 @@ def __init__(
self.datasource = DatasourceClient(client_wrapper=self._client_wrapper)
self.tool = ToolClient(client_wrapper=self._client_wrapper)
self.workflow = WorkflowClient(client_wrapper=self._client_wrapper)
self.vector_database = VectorDatabaseClient(client_wrapper=self._client_wrapper)


class AsyncSuperagent:
Expand All @@ -58,6 +60,7 @@ def __init__(
self.datasource = AsyncDatasourceClient(client_wrapper=self._client_wrapper)
self.tool = AsyncToolClient(client_wrapper=self._client_wrapper)
self.workflow = AsyncWorkflowClient(client_wrapper=self._client_wrapper)
self.vector_database = AsyncVectorDatabaseClient(client_wrapper=self._client_wrapper)


def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SuperagentEnvironment) -> str:
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.52",
"X-Fern-SDK-Version": "v0.1.53",
}
token = self._get_token()
if token is not None:
Expand Down
4 changes: 2 additions & 2 deletions src/superagent/resources/__init__.py
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"]
2 changes: 2 additions & 0 deletions src/superagent/resources/vector_database/__init__.py
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.

214 changes: 214 additions & 0 deletions src/superagent/resources/vector_database/client.py
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)
Loading

0 comments on commit 710f2c6

Please sign in to comment.