Skip to content

Commit

Permalink
Release 0.0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Aug 26, 2023
1 parent 759b20b commit 49d2593
Show file tree
Hide file tree
Showing 9 changed files with 267 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 = "vocode-api"
version = "0.0.17"
version = "0.0.18"
description = ""
readme = "README.md"
authors = []
Expand Down
5 changes: 4 additions & 1 deletion src/vocode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
Usage,
ValidationError,
ValidationErrorLocItem,
VectorDatabasePage,
VoicePage,
VoicePageItemsItem,
VoicePageItemsItem_VoiceAzure,
Expand Down Expand Up @@ -183,7 +184,7 @@
WebhookUpdateParamsUrl,
)
from .errors import UnprocessableEntityError
from .resources import actions, agents, calls, numbers, prompts, usage, voices, webhooks
from .resources import actions, agents, calls, numbers, prompts, usage, vector_databases, voices, webhooks
from .environment import VocodeEnvironment

__all__ = [
Expand Down Expand Up @@ -340,6 +341,7 @@
"Usage",
"ValidationError",
"ValidationErrorLocItem",
"VectorDatabasePage",
"VocodeEnvironment",
"VoicePage",
"VoicePageItemsItem",
Expand Down Expand Up @@ -375,6 +377,7 @@
"numbers",
"prompts",
"usage",
"vector_databases",
"voices",
"webhooks",
]
3 changes: 3 additions & 0 deletions src/vocode/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .resources.numbers.client import AsyncNumbersClient, NumbersClient
from .resources.prompts.client import AsyncPromptsClient, PromptsClient
from .resources.usage.client import AsyncUsageClient, UsageClient
from .resources.vector_databases.client import AsyncVectorDatabasesClient, VectorDatabasesClient
from .resources.voices.client import AsyncVoicesClient, VoicesClient
from .resources.webhooks.client import AsyncWebhooksClient, WebhooksClient

Expand All @@ -38,6 +39,7 @@ def __init__(
self.voices = VoicesClient(client_wrapper=self._client_wrapper)
self.webhooks = WebhooksClient(client_wrapper=self._client_wrapper)
self.prompts = PromptsClient(client_wrapper=self._client_wrapper)
self.vector_databases = VectorDatabasesClient(client_wrapper=self._client_wrapper)


class AsyncVocode:
Expand All @@ -62,6 +64,7 @@ def __init__(
self.voices = AsyncVoicesClient(client_wrapper=self._client_wrapper)
self.webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)
self.prompts = AsyncPromptsClient(client_wrapper=self._client_wrapper)
self.vector_databases = AsyncVectorDatabasesClient(client_wrapper=self._client_wrapper)


def _get_base_url(*, base_url: typing.Optional[str] = None, environment: VocodeEnvironment) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/vocode/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": "vocode-api",
"X-Fern-SDK-Version": "0.0.17",
"X-Fern-SDK-Version": "0.0.18",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
Expand Down
4 changes: 2 additions & 2 deletions src/vocode/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 actions, agents, calls, numbers, prompts, usage, voices, webhooks
from . import actions, agents, calls, numbers, prompts, usage, vector_databases, voices, webhooks

__all__ = ["actions", "agents", "calls", "numbers", "prompts", "usage", "voices", "webhooks"]
__all__ = ["actions", "agents", "calls", "numbers", "prompts", "usage", "vector_databases", "voices", "webhooks"]
2 changes: 2 additions & 0 deletions src/vocode/resources/vector_databases/__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.

223 changes: 223 additions & 0 deletions src/vocode/resources/vector_databases/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
# This file was auto-generated by Fern from our API Definition.

import typing
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.jsonable_encoder import jsonable_encoder
from ...core.remove_none_from_dict import remove_none_from_dict
from ...errors.unprocessable_entity_error import UnprocessableEntityError
from ...types.http_validation_error import HttpValidationError
from ...types.pinecone_vector_database import PineconeVectorDatabase
from ...types.pinecone_vector_database_params import PineconeVectorDatabaseParams
from ...types.pinecone_vector_database_update_params import PineconeVectorDatabaseUpdateParams
from ...types.vector_database_page import VectorDatabasePage

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class VectorDatabasesClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper

def get_vector_database(self, *, id: str) -> PineconeVectorDatabase:
"""
Parameters:
- id: str.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases"),
params=remove_none_from_dict({"id": id}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PineconeVectorDatabase, _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_vector_databases(
self, *, page: typing.Optional[int] = None, size: typing.Optional[int] = None
) -> VectorDatabasePage:
"""
Parameters:
- page: typing.Optional[int].
- size: typing.Optional[int].
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/list"),
params=remove_none_from_dict({"page": page, "size": size}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(VectorDatabasePage, _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 create_vector_database(self, *, request: PineconeVectorDatabaseParams) -> PineconeVectorDatabase:
"""
Parameters:
- request: PineconeVectorDatabaseParams.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/create"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PineconeVectorDatabase, _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_vector_database(self, *, id: str, request: PineconeVectorDatabaseUpdateParams) -> PineconeVectorDatabase:
"""
Parameters:
- id: str.
- request: PineconeVectorDatabaseUpdateParams.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/update"),
params=remove_none_from_dict({"id": id}),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PineconeVectorDatabase, _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 AsyncVectorDatabasesClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper

async def get_vector_database(self, *, id: str) -> PineconeVectorDatabase:
"""
Parameters:
- id: str.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases"),
params=remove_none_from_dict({"id": id}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PineconeVectorDatabase, _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_vector_databases(
self, *, page: typing.Optional[int] = None, size: typing.Optional[int] = None
) -> VectorDatabasePage:
"""
Parameters:
- page: typing.Optional[int].
- size: typing.Optional[int].
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/list"),
params=remove_none_from_dict({"page": page, "size": size}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(VectorDatabasePage, _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 create_vector_database(self, *, request: PineconeVectorDatabaseParams) -> PineconeVectorDatabase:
"""
Parameters:
- request: PineconeVectorDatabaseParams.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/create"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PineconeVectorDatabase, _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_vector_database(
self, *, id: str, request: PineconeVectorDatabaseUpdateParams
) -> PineconeVectorDatabase:
"""
Parameters:
- id: str.
- request: PineconeVectorDatabaseUpdateParams.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/update"),
params=remove_none_from_dict({"id": id}),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PineconeVectorDatabase, _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)
2 changes: 2 additions & 0 deletions src/vocode/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
from .usage import Usage
from .validation_error import ValidationError
from .validation_error_loc_item import ValidationErrorLocItem
from .vector_database_page import VectorDatabasePage
from .voice_page import VoicePage
from .voice_page_items_item import (
VoicePageItemsItem,
Expand Down Expand Up @@ -366,6 +367,7 @@
"Usage",
"ValidationError",
"ValidationErrorLocItem",
"VectorDatabasePage",
"VoicePage",
"VoicePageItemsItem",
"VoicePageItemsItem_VoiceAzure",
Expand Down
29 changes: 29 additions & 0 deletions src/vocode/types/vector_database_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime
from .pinecone_vector_database import PineconeVectorDatabase


class VectorDatabasePage(pydantic.BaseModel):
items: typing.List[PineconeVectorDatabase]
page: int
size: int
has_more: bool

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().dict(**kwargs_with_defaults)

class Config:
frozen = True
smart_union = True
json_encoders = {dt.datetime: serialize_datetime}

0 comments on commit 49d2593

Please sign in to comment.