From 7c5001224cf9471a4213dac6e1bfda0730572aea Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 26 Mar 2024 01:59:32 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- .github/workflows/ci.yml | 2 +- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- CONTRIBUTING.md | 2 +- LICENSE | 2 +- README.md | 60 +++---- api.md | 46 ++--- bin/check-release-environment | 2 +- mypy.ini | 2 +- pyproject.toml | 10 +- release-please-config.json | 2 +- src/{retell_sdk => retell}/__init__.py | 24 +-- src/{retell_sdk => retell}/_base_client.py | 0 src/{retell_sdk => retell}/_client.py | 58 +++---- src/{retell_sdk => retell}/_compat.py | 0 src/{retell_sdk => retell}/_constants.py | 0 src/{retell_sdk => retell}/_exceptions.py | 4 +- src/{retell_sdk => retell}/_files.py | 0 src/{retell_sdk => retell}/_models.py | 0 src/{retell_sdk => retell}/_qs.py | 0 src/{retell_sdk => retell}/_resource.py | 10 +- src/{retell_sdk => retell}/_response.py | 14 +- src/{retell_sdk => retell}/_streaming.py | 6 +- src/{retell_sdk => retell}/_types.py | 2 +- src/{retell_sdk => retell}/_utils/__init__.py | 0 src/{retell_sdk => retell}/_utils/_logs.py | 6 +- src/{retell_sdk => retell}/_utils/_proxy.py | 0 src/{retell_sdk => retell}/_utils/_streams.py | 0 src/{retell_sdk => retell}/_utils/_sync.py | 0 .../_utils/_transform.py | 0 src/{retell_sdk => retell}/_utils/_typing.py | 0 src/{retell_sdk => retell}/_utils/_utils.py | 0 src/{retell_sdk => retell}/_version.py | 2 +- src/retell/lib/.keep | 4 + src/{retell_sdk => retell}/py.typed | 0 .../resources/__init__.py | 0 src/{retell_sdk => retell}/resources/agent.py | 0 src/{retell_sdk => retell}/resources/call.py | 0 src/{retell_sdk => retell}/resources/llm.py | 0 .../resources/phone_number.py | 0 src/{retell_sdk => retell}/types/__init__.py | 0 .../types/agent_create_params.py | 0 .../types/agent_list_response.py | 0 .../types/agent_response.py | 0 .../types/agent_update_params.py | 0 .../types/call_create_params.py | 0 .../types/call_create_response.py | 0 .../types/call_detail_response.py | 0 .../types/call_list_params.py | 0 .../types/call_list_response.py | 0 .../types/call_register_params.py | 0 .../types/call_register_response.py | 0 .../types/llm_create_params.py | 0 .../types/llm_list_response.py | 0 .../types/llm_response.py | 0 .../types/llm_update_params.py | 0 .../types/phone_number_create_params.py | 0 .../types/phone_number_list_response.py | 0 .../types/phone_number_response.py | 0 .../types/phone_number_update_params.py | 0 tests/api_resources/test_agent.py | 84 ++++----- tests/api_resources/test_call.py | 68 ++++---- tests/api_resources/test_llm.py | 84 ++++----- tests/api_resources/test_phone_number.py | 80 ++++----- tests/conftest.py | 12 +- tests/test_client.py | 161 +++++++++--------- tests/test_deepcopy.py | 2 +- tests/test_extract_files.py | 4 +- tests/test_files.py | 2 +- tests/test_models.py | 6 +- tests/test_qs.py | 2 +- tests/test_required_args.py | 2 +- tests/test_response.py | 30 ++-- tests/test_streaming.py | 2 +- tests/test_transform.py | 8 +- tests/test_utils/test_proxy.py | 2 +- tests/test_utils/test_typing.py | 2 +- tests/utils.py | 8 +- 78 files changed, 403 insertions(+), 418 deletions(-) rename src/{retell_sdk => retell}/__init__.py (83%) rename src/{retell_sdk => retell}/_base_client.py (100%) rename src/{retell_sdk => retell}/_client.py (91%) rename src/{retell_sdk => retell}/_compat.py (100%) rename src/{retell_sdk => retell}/_constants.py (100%) rename src/{retell_sdk => retell}/_exceptions.py (97%) rename src/{retell_sdk => retell}/_files.py (100%) rename src/{retell_sdk => retell}/_models.py (100%) rename src/{retell_sdk => retell}/_qs.py (100%) rename src/{retell_sdk => retell}/_resource.py (81%) rename src/{retell_sdk => retell}/_response.py (98%) rename src/{retell_sdk => retell}/_streaming.py (98%) rename src/{retell_sdk => retell}/_types.py (99%) rename src/{retell_sdk => retell}/_utils/__init__.py (100%) rename src/{retell_sdk => retell}/_utils/_logs.py (70%) rename src/{retell_sdk => retell}/_utils/_proxy.py (100%) rename src/{retell_sdk => retell}/_utils/_streams.py (100%) rename src/{retell_sdk => retell}/_utils/_sync.py (100%) rename src/{retell_sdk => retell}/_utils/_transform.py (100%) rename src/{retell_sdk => retell}/_utils/_typing.py (100%) rename src/{retell_sdk => retell}/_utils/_utils.py (100%) rename src/{retell_sdk => retell}/_version.py (85%) create mode 100644 src/retell/lib/.keep rename src/{retell_sdk => retell}/py.typed (100%) rename src/{retell_sdk => retell}/resources/__init__.py (100%) rename src/{retell_sdk => retell}/resources/agent.py (100%) rename src/{retell_sdk => retell}/resources/call.py (100%) rename src/{retell_sdk => retell}/resources/llm.py (100%) rename src/{retell_sdk => retell}/resources/phone_number.py (100%) rename src/{retell_sdk => retell}/types/__init__.py (100%) rename src/{retell_sdk => retell}/types/agent_create_params.py (100%) rename src/{retell_sdk => retell}/types/agent_list_response.py (100%) rename src/{retell_sdk => retell}/types/agent_response.py (100%) rename src/{retell_sdk => retell}/types/agent_update_params.py (100%) rename src/{retell_sdk => retell}/types/call_create_params.py (100%) rename src/{retell_sdk => retell}/types/call_create_response.py (100%) rename src/{retell_sdk => retell}/types/call_detail_response.py (100%) rename src/{retell_sdk => retell}/types/call_list_params.py (100%) rename src/{retell_sdk => retell}/types/call_list_response.py (100%) rename src/{retell_sdk => retell}/types/call_register_params.py (100%) rename src/{retell_sdk => retell}/types/call_register_response.py (100%) rename src/{retell_sdk => retell}/types/llm_create_params.py (100%) rename src/{retell_sdk => retell}/types/llm_list_response.py (100%) rename src/{retell_sdk => retell}/types/llm_response.py (100%) rename src/{retell_sdk => retell}/types/llm_update_params.py (100%) rename src/{retell_sdk => retell}/types/phone_number_create_params.py (100%) rename src/{retell_sdk => retell}/types/phone_number_list_response.py (100%) rename src/{retell_sdk => retell}/types/phone_number_response.py (100%) rename src/{retell_sdk => retell}/types/phone_number_update_params.py (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b4d725..f5b1013 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,4 @@ jobs: - name: Ensure importable run: | - rye run python -c 'import retell_sdk' + rye run python -c 'import retell' diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 68bafab..67ee4dc 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -28,4 +28,4 @@ jobs: run: | bash ./bin/publish-pypi env: - PYPI_TOKEN: ${{ secrets.RETELL_SDK_PYPI_TOKEN || secrets.PYPI_TOKEN }} + PYPI_TOKEN: ${{ secrets.RETELL_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 2607298..af794ea 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -16,4 +16,4 @@ jobs: run: | bash ./bin/check-release-environment env: - PYPI_TOKEN: ${{ secrets.RETELL_SDK_PYPI_TOKEN || secrets.PYPI_TOKEN }} + PYPI_TOKEN: ${{ secrets.RETELL_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67a211f..d47873b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ $ pip install -r requirements-dev.lock ## Modifying/Adding code Most of the SDK is generated code, and any modified code will be overridden on the next generation. The -`src/retell_sdk/lib/` and `examples/` directories are exceptions and will never be overridden. +`src/retell/lib/` and `examples/` directories are exceptions and will never be overridden. ## Adding and running examples diff --git a/LICENSE b/LICENSE index 962fdb8..c8fa3b8 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Retell Sdk + Copyright 2024 Retell Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 6f5faff..cf3a53d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Retell Sdk Python API library +# Retell Python API library [![PyPI version](https://img.shields.io/pypi/v/retell-sdk.svg)](https://pypi.org/project/retell-sdk/) -The Retell Sdk Python library provides convenient access to the Retell Sdk REST API from any Python 3.7+ +The Retell Python library provides convenient access to the Retell REST API from any Python 3.7+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -25,9 +25,9 @@ The full API of this library can be found in [api.md](api.md). ```python import os -from retell_sdk import RetellSdk +from retell import Retell -client = RetellSdk( +client = Retell( # This is the default and can be omitted api_key=os.environ.get("RETELL_API_KEY"), ) @@ -46,14 +46,14 @@ so that your API Key is not stored in source control. ## Async usage -Simply import `AsyncRetellSdk` instead of `RetellSdk` and use `await` with each API call: +Simply import `AsyncRetell` instead of `Retell` and use `await` with each API call: ```python import os import asyncio -from retell_sdk import AsyncRetellSdk +from retell import AsyncRetell -client = AsyncRetellSdk( +client = AsyncRetell( # This is the default and can be omitted api_key=os.environ.get("RETELL_API_KEY"), ) @@ -83,30 +83,30 @@ Typed requests and responses provide autocomplete and documentation within your ## Handling errors -When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `retell_sdk.APIConnectionError` is raised. +When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `retell.APIConnectionError` is raised. When the API returns a non-success status code (that is, 4xx or 5xx -response), a subclass of `retell_sdk.APIStatusError` is raised, containing `status_code` and `response` properties. +response), a subclass of `retell.APIStatusError` is raised, containing `status_code` and `response` properties. -All errors inherit from `retell_sdk.APIError`. +All errors inherit from `retell.APIError`. ```python -import retell_sdk -from retell_sdk import RetellSdk +import retell +from retell import Retell -client = RetellSdk() +client = Retell() try: client.agent.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", ) -except retell_sdk.APIConnectionError as e: +except retell.APIConnectionError as e: print("The server could not be reached") print(e.__cause__) # an underlying Exception, likely raised within httpx. -except retell_sdk.RateLimitError as e: +except retell.RateLimitError as e: print("A 429 status code was received; we should back off a bit.") -except retell_sdk.APIStatusError as e: +except retell.APIStatusError as e: print("Another non-200-range status code was received") print(e.status_code) print(e.response) @@ -134,10 +134,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ You can use the `max_retries` option to configure or disable retry settings: ```python -from retell_sdk import RetellSdk +from retell import Retell # Configure the default for all requests: -client = RetellSdk( +client = Retell( # default is 2 max_retries=0, ) @@ -155,16 +155,16 @@ By default requests time out after 1 minute. You can configure this with a `time which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object: ```python -from retell_sdk import RetellSdk +from retell import Retell # Configure the default for all requests: -client = RetellSdk( +client = Retell( # 20 seconds (default is 1 minute) timeout=20.0, ) # More granular control: -client = RetellSdk( +client = Retell( timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0), ) @@ -185,10 +185,10 @@ Note that requests that time out are [retried twice by default](#retries). We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. -You can enable logging by setting the environment variable `RETELL_SDK_LOG` to `debug`. +You can enable logging by setting the environment variable `RETELL_LOG` to `debug`. ```shell -$ export RETELL_SDK_LOG=debug +$ export RETELL_LOG=debug ``` ### How to tell whether `None` means `null` or missing @@ -208,9 +208,9 @@ if response.my_field is None: The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g., ```py -from retell_sdk import RetellSdk +from retell import Retell -client = RetellSdk() +client = Retell() response = client.agent.with_raw_response.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -221,9 +221,9 @@ agent = response.parse() # get the object that `agent.create()` would have retu print(agent.agent_id) ``` -These methods return an [`APIResponse`](https://github.com/RetellAI/retell-python-sdk/tree/main/src/retell_sdk/_response.py) object. +These methods return an [`APIResponse`](https://github.com/RetellAI/retell-python-sdk/tree/main/src/retell/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/RetellAI/retell-python-sdk/tree/main/src/retell_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. +The async client returns an [`AsyncAPIResponse`](https://github.com/RetellAI/retell-python-sdk/tree/main/src/retell/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -289,10 +289,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c ```python import httpx -from retell_sdk import RetellSdk +from retell import Retell -client = RetellSdk( - # Or use the `RETELL_SDK_BASE_URL` env var +client = Retell( + # Or use the `RETELL_BASE_URL` env var base_url="http://my.test.server.example.com:8083", http_client=httpx.Client( proxies="http://my.test.proxy.example.com", diff --git a/api.md b/api.md index da55a9e..465186a 100644 --- a/api.md +++ b/api.md @@ -3,7 +3,7 @@ Types: ```python -from retell_sdk.types import ( +from retell.types import ( CallDetailResponse, CallCreateResponse, CallListResponse, @@ -13,55 +13,55 @@ from retell_sdk.types import ( Methods: -- client.call.create(\*\*params) -> CallCreateResponse -- client.call.retrieve(call_id) -> CallDetailResponse -- client.call.list(\*\*params) -> CallListResponse -- client.call.register(\*\*params) -> CallRegisterResponse +- client.call.create(\*\*params) -> CallCreateResponse +- client.call.retrieve(call_id) -> CallDetailResponse +- client.call.list(\*\*params) -> CallListResponse +- client.call.register(\*\*params) -> CallRegisterResponse # PhoneNumber Types: ```python -from retell_sdk.types import PhoneNumberResponse, PhoneNumberListResponse +from retell.types import PhoneNumberResponse, PhoneNumberListResponse ``` Methods: -- client.phone_number.create(\*\*params) -> PhoneNumberResponse -- client.phone_number.retrieve(phone_number) -> PhoneNumberResponse -- client.phone_number.update(phone_number, \*\*params) -> PhoneNumberResponse -- client.phone_number.list() -> PhoneNumberListResponse -- client.phone_number.delete(phone_number) -> None +- client.phone_number.create(\*\*params) -> PhoneNumberResponse +- client.phone_number.retrieve(phone_number) -> PhoneNumberResponse +- client.phone_number.update(phone_number, \*\*params) -> PhoneNumberResponse +- client.phone_number.list() -> PhoneNumberListResponse +- client.phone_number.delete(phone_number) -> None # Agent Types: ```python -from retell_sdk.types import AgentResponse, AgentListResponse +from retell.types import AgentResponse, AgentListResponse ``` Methods: -- client.agent.create(\*\*params) -> AgentResponse -- client.agent.retrieve(agent_id) -> AgentResponse -- client.agent.update(agent_id, \*\*params) -> AgentResponse -- client.agent.list() -> AgentListResponse -- client.agent.delete(agent_id) -> None +- client.agent.create(\*\*params) -> AgentResponse +- client.agent.retrieve(agent_id) -> AgentResponse +- client.agent.update(agent_id, \*\*params) -> AgentResponse +- client.agent.list() -> AgentListResponse +- client.agent.delete(agent_id) -> None # Llm Types: ```python -from retell_sdk.types import LlmResponse, LlmListResponse +from retell.types import LlmResponse, LlmListResponse ``` Methods: -- client.llm.create(\*\*params) -> LlmResponse -- client.llm.retrieve(llm_id) -> LlmResponse -- client.llm.update(llm_id, \*\*params) -> LlmResponse -- client.llm.list() -> LlmListResponse -- client.llm.delete(llm_id) -> None +- client.llm.create(\*\*params) -> LlmResponse +- client.llm.retrieve(llm_id) -> LlmResponse +- client.llm.update(llm_id, \*\*params) -> LlmResponse +- client.llm.list() -> LlmListResponse +- client.llm.delete(llm_id) -> None diff --git a/bin/check-release-environment b/bin/check-release-environment index df7be7d..ee23baf 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -4,7 +4,7 @@ warnings=() errors=() if [ -z "${PYPI_TOKEN}" ]; then - warnings+=("The RETELL_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") + warnings+=("The RETELL_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") fi lenWarnings=${#warnings[@]} diff --git a/mypy.ini b/mypy.ini index 764b18c..275bc24 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,7 +5,7 @@ show_error_codes = True # Exclude _files.py because mypy isn't smart enough to apply # the correct type narrowing and as this is an internal module # it's fine to just use Pyright. -exclude = ^(src/retell_sdk/_files\.py|_dev/.*\.py)$ +exclude = ^(src/retell/_files\.py|_dev/.*\.py)$ strict_equality = True implicit_reexport = True diff --git a/pyproject.toml b/pyproject.toml index 53ac643..1e62341 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,11 @@ [project] name = "retell-sdk" version = "0.1.0-alpha.2" -description = "The official Python library for the retell-sdk API" +description = "The official Python library for the retell API" readme = "README.md" license = "Apache-2.0" authors = [ -{ name = "Retell Sdk", email = "founders@retellai.com" }, +{ name = "Retell", email = "founders@retellai.com" }, ] dependencies = [ "httpx>=0.23.0, <1", @@ -84,7 +84,7 @@ typecheck = { chain = [ "typecheck:mypy" ]} "typecheck:pyright" = "pyright" -"typecheck:verify-types" = "pyright --verifytypes retell_sdk --ignoreexternal" +"typecheck:verify-types" = "pyright --verifytypes retell --ignoreexternal" "typecheck:mypy" = "mypy ." [build-system] @@ -97,7 +97,7 @@ include = [ ] [tool.hatch.build.targets.wheel] -packages = ["src/retell_sdk"] +packages = ["src/retell"] [tool.black] line-length = 120 @@ -171,7 +171,7 @@ length-sort = true length-sort-straight = true combine-as-imports = true extra-standard-library = ["typing_extensions"] -known-first-party = ["retell_sdk", "tests"] +known-first-party = ["retell", "tests"] [tool.ruff.per-file-ignores] "bin/**.py" = ["T201", "T203"] diff --git a/release-please-config.json b/release-please-config.json index bd09094..037b265 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -61,6 +61,6 @@ ], "release-type": "python", "extra-files": [ - "src/retell_sdk/_version.py" + "src/retell/_version.py" ] } \ No newline at end of file diff --git a/src/retell_sdk/__init__.py b/src/retell/__init__.py similarity index 83% rename from src/retell_sdk/__init__.py rename to src/retell/__init__.py index 8a0ab84..b4c3a4a 100644 --- a/src/retell_sdk/__init__.py +++ b/src/retell/__init__.py @@ -3,27 +3,17 @@ from . import types from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes from ._utils import file_from_path -from ._client import ( - Client, - Stream, - Timeout, - RetellSdk, - Transport, - AsyncClient, - AsyncStream, - AsyncRetellSdk, - RequestOptions, -) +from ._client import Client, Retell, Stream, Timeout, Transport, AsyncClient, AsyncRetell, AsyncStream, RequestOptions from ._models import BaseModel from ._version import __title__, __version__ from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse from ._exceptions import ( APIError, + RetellError, ConflictError, NotFoundError, APIStatusError, RateLimitError, - RetellSdkError, APITimeoutError, BadRequestError, APIConnectionError, @@ -44,7 +34,7 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", - "RetellSdkError", + "RetellError", "APIError", "APIStatusError", "APITimeoutError", @@ -64,8 +54,8 @@ "AsyncClient", "Stream", "AsyncStream", - "RetellSdk", - "AsyncRetellSdk", + "Retell", + "AsyncRetell", "file_from_path", "BaseModel", ] @@ -75,12 +65,12 @@ # Update the __module__ attribute for exported symbols so that # error messages point to this module instead of the module # it was originally defined in, e.g. -# retell_sdk._exceptions.NotFoundError -> retell_sdk.NotFoundError +# retell._exceptions.NotFoundError -> retell.NotFoundError __locals = locals() for __name in __all__: if not __name.startswith("__"): try: - __locals[__name].__module__ = "retell_sdk" + __locals[__name].__module__ = "retell" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. pass diff --git a/src/retell_sdk/_base_client.py b/src/retell/_base_client.py similarity index 100% rename from src/retell_sdk/_base_client.py rename to src/retell/_base_client.py diff --git a/src/retell_sdk/_client.py b/src/retell/_client.py similarity index 91% rename from src/retell_sdk/_client.py rename to src/retell/_client.py index 466202a..d6bdfdd 100644 --- a/src/retell_sdk/_client.py +++ b/src/retell/_client.py @@ -25,7 +25,7 @@ ) from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream -from ._exceptions import APIStatusError, RetellSdkError +from ._exceptions import RetellError, APIStatusError from ._base_client import ( DEFAULT_MAX_RETRIES, SyncAPIClient, @@ -38,20 +38,20 @@ "ProxiesTypes", "RequestOptions", "resources", - "RetellSdk", - "AsyncRetellSdk", + "Retell", + "AsyncRetell", "Client", "AsyncClient", ] -class RetellSdk(SyncAPIClient): +class Retell(SyncAPIClient): call: resources.Call phone_number: resources.PhoneNumber agent: resources.Agent llm: resources.Llm - with_raw_response: RetellSdkWithRawResponse - with_streaming_response: RetellSdkWithStreamedResponse + with_raw_response: RetellWithRawResponse + with_streaming_response: RetellWithStreamedResponse # client options api_key: str @@ -77,20 +77,20 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous retell-sdk client instance. + """Construct a new synchronous retell client instance. This automatically infers the `api_key` argument from the `RETELL_API_KEY` environment variable if it is not provided. """ if api_key is None: api_key = os.environ.get("RETELL_API_KEY") if api_key is None: - raise RetellSdkError( + raise RetellError( "The api_key client option must be set either by passing api_key to the client or by setting the RETELL_API_KEY environment variable" ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("RETELL_SDK_BASE_URL") + base_url = os.environ.get("RETELL_BASE_URL") if base_url is None: base_url = f"https://api.retellai.com" @@ -109,8 +109,8 @@ def __init__( self.phone_number = resources.PhoneNumber(self) self.agent = resources.Agent(self) self.llm = resources.Llm(self) - self.with_raw_response = RetellSdkWithRawResponse(self) - self.with_streaming_response = RetellSdkWithStreamedResponse(self) + self.with_raw_response = RetellWithRawResponse(self) + self.with_streaming_response = RetellWithStreamedResponse(self) @property @override @@ -217,13 +217,13 @@ def _make_status_error( return APIStatusError(err_msg, response=response, body=body) -class AsyncRetellSdk(AsyncAPIClient): +class AsyncRetell(AsyncAPIClient): call: resources.AsyncCall phone_number: resources.AsyncPhoneNumber agent: resources.AsyncAgent llm: resources.AsyncLlm - with_raw_response: AsyncRetellSdkWithRawResponse - with_streaming_response: AsyncRetellSdkWithStreamedResponse + with_raw_response: AsyncRetellWithRawResponse + with_streaming_response: AsyncRetellWithStreamedResponse # client options api_key: str @@ -249,20 +249,20 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async retell-sdk client instance. + """Construct a new async retell client instance. This automatically infers the `api_key` argument from the `RETELL_API_KEY` environment variable if it is not provided. """ if api_key is None: api_key = os.environ.get("RETELL_API_KEY") if api_key is None: - raise RetellSdkError( + raise RetellError( "The api_key client option must be set either by passing api_key to the client or by setting the RETELL_API_KEY environment variable" ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("RETELL_SDK_BASE_URL") + base_url = os.environ.get("RETELL_BASE_URL") if base_url is None: base_url = f"https://api.retellai.com" @@ -281,8 +281,8 @@ def __init__( self.phone_number = resources.AsyncPhoneNumber(self) self.agent = resources.AsyncAgent(self) self.llm = resources.AsyncLlm(self) - self.with_raw_response = AsyncRetellSdkWithRawResponse(self) - self.with_streaming_response = AsyncRetellSdkWithStreamedResponse(self) + self.with_raw_response = AsyncRetellWithRawResponse(self) + self.with_streaming_response = AsyncRetellWithStreamedResponse(self) @property @override @@ -389,38 +389,38 @@ def _make_status_error( return APIStatusError(err_msg, response=response, body=body) -class RetellSdkWithRawResponse: - def __init__(self, client: RetellSdk) -> None: +class RetellWithRawResponse: + def __init__(self, client: Retell) -> None: self.call = resources.CallWithRawResponse(client.call) self.phone_number = resources.PhoneNumberWithRawResponse(client.phone_number) self.agent = resources.AgentWithRawResponse(client.agent) self.llm = resources.LlmWithRawResponse(client.llm) -class AsyncRetellSdkWithRawResponse: - def __init__(self, client: AsyncRetellSdk) -> None: +class AsyncRetellWithRawResponse: + def __init__(self, client: AsyncRetell) -> None: self.call = resources.AsyncCallWithRawResponse(client.call) self.phone_number = resources.AsyncPhoneNumberWithRawResponse(client.phone_number) self.agent = resources.AsyncAgentWithRawResponse(client.agent) self.llm = resources.AsyncLlmWithRawResponse(client.llm) -class RetellSdkWithStreamedResponse: - def __init__(self, client: RetellSdk) -> None: +class RetellWithStreamedResponse: + def __init__(self, client: Retell) -> None: self.call = resources.CallWithStreamingResponse(client.call) self.phone_number = resources.PhoneNumberWithStreamingResponse(client.phone_number) self.agent = resources.AgentWithStreamingResponse(client.agent) self.llm = resources.LlmWithStreamingResponse(client.llm) -class AsyncRetellSdkWithStreamedResponse: - def __init__(self, client: AsyncRetellSdk) -> None: +class AsyncRetellWithStreamedResponse: + def __init__(self, client: AsyncRetell) -> None: self.call = resources.AsyncCallWithStreamingResponse(client.call) self.phone_number = resources.AsyncPhoneNumberWithStreamingResponse(client.phone_number) self.agent = resources.AsyncAgentWithStreamingResponse(client.agent) self.llm = resources.AsyncLlmWithStreamingResponse(client.llm) -Client = RetellSdk +Client = Retell -AsyncClient = AsyncRetellSdk +AsyncClient = AsyncRetell diff --git a/src/retell_sdk/_compat.py b/src/retell/_compat.py similarity index 100% rename from src/retell_sdk/_compat.py rename to src/retell/_compat.py diff --git a/src/retell_sdk/_constants.py b/src/retell/_constants.py similarity index 100% rename from src/retell_sdk/_constants.py rename to src/retell/_constants.py diff --git a/src/retell_sdk/_exceptions.py b/src/retell/_exceptions.py similarity index 97% rename from src/retell_sdk/_exceptions.py rename to src/retell/_exceptions.py index b780dc3..eece4f7 100644 --- a/src/retell_sdk/_exceptions.py +++ b/src/retell/_exceptions.py @@ -18,11 +18,11 @@ ] -class RetellSdkError(Exception): +class RetellError(Exception): pass -class APIError(RetellSdkError): +class APIError(RetellError): message: str request: httpx.Request diff --git a/src/retell_sdk/_files.py b/src/retell/_files.py similarity index 100% rename from src/retell_sdk/_files.py rename to src/retell/_files.py diff --git a/src/retell_sdk/_models.py b/src/retell/_models.py similarity index 100% rename from src/retell_sdk/_models.py rename to src/retell/_models.py diff --git a/src/retell_sdk/_qs.py b/src/retell/_qs.py similarity index 100% rename from src/retell_sdk/_qs.py rename to src/retell/_qs.py diff --git a/src/retell_sdk/_resource.py b/src/retell/_resource.py similarity index 81% rename from src/retell_sdk/_resource.py rename to src/retell/_resource.py index b7e8a61..7cc9f90 100644 --- a/src/retell_sdk/_resource.py +++ b/src/retell/_resource.py @@ -8,13 +8,13 @@ import anyio if TYPE_CHECKING: - from ._client import RetellSdk, AsyncRetellSdk + from ._client import Retell, AsyncRetell class SyncAPIResource: - _client: RetellSdk + _client: Retell - def __init__(self, client: RetellSdk) -> None: + def __init__(self, client: Retell) -> None: self._client = client self._get = client.get self._post = client.post @@ -28,9 +28,9 @@ def _sleep(self, seconds: float) -> None: class AsyncAPIResource: - _client: AsyncRetellSdk + _client: AsyncRetell - def __init__(self, client: AsyncRetellSdk) -> None: + def __init__(self, client: AsyncRetell) -> None: self._client = client self._get = client.get self._post = client.post diff --git a/src/retell_sdk/_response.py b/src/retell/_response.py similarity index 98% rename from src/retell_sdk/_response.py rename to src/retell/_response.py index 1851666..9ad1c00 100644 --- a/src/retell_sdk/_response.py +++ b/src/retell/_response.py @@ -29,7 +29,7 @@ from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type -from ._exceptions import RetellSdkError, APIResponseValidationError +from ._exceptions import RetellError, APIResponseValidationError if TYPE_CHECKING: from ._models import FinalRequestOptions @@ -203,9 +203,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: return cast(R, response) if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): - raise TypeError( - "Pydantic models must subclass our base model type, e.g. `from retell_sdk import BaseModel`" - ) + raise TypeError("Pydantic models must subclass our base model type, e.g. `from retell import BaseModel`") if ( cast_to is not object @@ -273,7 +271,7 @@ def parse(self, *, to: type[_T] | None = None) -> R | _T: the `to` argument, e.g. ```py - from retell_sdk import BaseModel + from retell import BaseModel class MyModel(BaseModel): @@ -377,7 +375,7 @@ async def parse(self, *, to: type[_T] | None = None) -> R | _T: the `to` argument, e.g. ```py - from retell_sdk import BaseModel + from retell import BaseModel class MyModel(BaseModel): @@ -548,11 +546,11 @@ async def stream_to_file( class MissingStreamClassError(TypeError): def __init__(self) -> None: super().__init__( - "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `retell_sdk._streaming` for reference", + "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `retell._streaming` for reference", ) -class StreamAlreadyConsumed(RetellSdkError): +class StreamAlreadyConsumed(RetellError): """ Attempted to read or stream content, but the content has already been streamed. diff --git a/src/retell_sdk/_streaming.py b/src/retell/_streaming.py similarity index 98% rename from src/retell_sdk/_streaming.py rename to src/retell/_streaming.py index a346050..101f8fe 100644 --- a/src/retell_sdk/_streaming.py +++ b/src/retell/_streaming.py @@ -12,7 +12,7 @@ from ._utils import extract_type_var_from_base if TYPE_CHECKING: - from ._client import RetellSdk, AsyncRetellSdk + from ._client import Retell, AsyncRetell _T = TypeVar("_T") @@ -30,7 +30,7 @@ def __init__( *, cast_to: type[_T], response: httpx.Response, - client: RetellSdk, + client: Retell, ) -> None: self.response = response self._cast_to = cast_to @@ -96,7 +96,7 @@ def __init__( *, cast_to: type[_T], response: httpx.Response, - client: AsyncRetellSdk, + client: AsyncRetell, ) -> None: self.response = response self._cast_to = cast_to diff --git a/src/retell_sdk/_types.py b/src/retell/_types.py similarity index 99% rename from src/retell_sdk/_types.py rename to src/retell/_types.py index 28fe193..3873d99 100644 --- a/src/retell_sdk/_types.py +++ b/src/retell/_types.py @@ -81,7 +81,7 @@ # This unfortunately means that you will either have # to import this type and pass it explicitly: # -# from retell_sdk import NoneType +# from retell import NoneType # client.get('/foo', cast_to=NoneType) # # or build it yourself: diff --git a/src/retell_sdk/_utils/__init__.py b/src/retell/_utils/__init__.py similarity index 100% rename from src/retell_sdk/_utils/__init__.py rename to src/retell/_utils/__init__.py diff --git a/src/retell_sdk/_utils/_logs.py b/src/retell/_utils/_logs.py similarity index 70% rename from src/retell_sdk/_utils/_logs.py rename to src/retell/_utils/_logs.py index 9da5a7b..b32adfb 100644 --- a/src/retell_sdk/_utils/_logs.py +++ b/src/retell/_utils/_logs.py @@ -1,12 +1,12 @@ import os import logging -logger: logging.Logger = logging.getLogger("retell_sdk") +logger: logging.Logger = logging.getLogger("retell") httpx_logger: logging.Logger = logging.getLogger("httpx") def _basic_config() -> None: - # e.g. [2023-10-05 14:12:26 - retell_sdk._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" + # e.g. [2023-10-05 14:12:26 - retell._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" logging.basicConfig( format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S", @@ -14,7 +14,7 @@ def _basic_config() -> None: def setup_logging() -> None: - env = os.environ.get("RETELL_SDK_LOG") + env = os.environ.get("RETELL_LOG") if env == "debug": _basic_config() logger.setLevel(logging.DEBUG) diff --git a/src/retell_sdk/_utils/_proxy.py b/src/retell/_utils/_proxy.py similarity index 100% rename from src/retell_sdk/_utils/_proxy.py rename to src/retell/_utils/_proxy.py diff --git a/src/retell_sdk/_utils/_streams.py b/src/retell/_utils/_streams.py similarity index 100% rename from src/retell_sdk/_utils/_streams.py rename to src/retell/_utils/_streams.py diff --git a/src/retell_sdk/_utils/_sync.py b/src/retell/_utils/_sync.py similarity index 100% rename from src/retell_sdk/_utils/_sync.py rename to src/retell/_utils/_sync.py diff --git a/src/retell_sdk/_utils/_transform.py b/src/retell/_utils/_transform.py similarity index 100% rename from src/retell_sdk/_utils/_transform.py rename to src/retell/_utils/_transform.py diff --git a/src/retell_sdk/_utils/_typing.py b/src/retell/_utils/_typing.py similarity index 100% rename from src/retell_sdk/_utils/_typing.py rename to src/retell/_utils/_typing.py diff --git a/src/retell_sdk/_utils/_utils.py b/src/retell/_utils/_utils.py similarity index 100% rename from src/retell_sdk/_utils/_utils.py rename to src/retell/_utils/_utils.py diff --git a/src/retell_sdk/_version.py b/src/retell/_version.py similarity index 85% rename from src/retell_sdk/_version.py rename to src/retell/_version.py index 9ba6f62..a12e4fe 100644 --- a/src/retell_sdk/_version.py +++ b/src/retell/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -__title__ = "retell_sdk" +__title__ = "retell" __version__ = "0.1.0-alpha.2" # x-release-please-version diff --git a/src/retell/lib/.keep b/src/retell/lib/.keep new file mode 100644 index 0000000..5e2c99f --- /dev/null +++ b/src/retell/lib/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store custom files to expand the SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/src/retell_sdk/py.typed b/src/retell/py.typed similarity index 100% rename from src/retell_sdk/py.typed rename to src/retell/py.typed diff --git a/src/retell_sdk/resources/__init__.py b/src/retell/resources/__init__.py similarity index 100% rename from src/retell_sdk/resources/__init__.py rename to src/retell/resources/__init__.py diff --git a/src/retell_sdk/resources/agent.py b/src/retell/resources/agent.py similarity index 100% rename from src/retell_sdk/resources/agent.py rename to src/retell/resources/agent.py diff --git a/src/retell_sdk/resources/call.py b/src/retell/resources/call.py similarity index 100% rename from src/retell_sdk/resources/call.py rename to src/retell/resources/call.py diff --git a/src/retell_sdk/resources/llm.py b/src/retell/resources/llm.py similarity index 100% rename from src/retell_sdk/resources/llm.py rename to src/retell/resources/llm.py diff --git a/src/retell_sdk/resources/phone_number.py b/src/retell/resources/phone_number.py similarity index 100% rename from src/retell_sdk/resources/phone_number.py rename to src/retell/resources/phone_number.py diff --git a/src/retell_sdk/types/__init__.py b/src/retell/types/__init__.py similarity index 100% rename from src/retell_sdk/types/__init__.py rename to src/retell/types/__init__.py diff --git a/src/retell_sdk/types/agent_create_params.py b/src/retell/types/agent_create_params.py similarity index 100% rename from src/retell_sdk/types/agent_create_params.py rename to src/retell/types/agent_create_params.py diff --git a/src/retell_sdk/types/agent_list_response.py b/src/retell/types/agent_list_response.py similarity index 100% rename from src/retell_sdk/types/agent_list_response.py rename to src/retell/types/agent_list_response.py diff --git a/src/retell_sdk/types/agent_response.py b/src/retell/types/agent_response.py similarity index 100% rename from src/retell_sdk/types/agent_response.py rename to src/retell/types/agent_response.py diff --git a/src/retell_sdk/types/agent_update_params.py b/src/retell/types/agent_update_params.py similarity index 100% rename from src/retell_sdk/types/agent_update_params.py rename to src/retell/types/agent_update_params.py diff --git a/src/retell_sdk/types/call_create_params.py b/src/retell/types/call_create_params.py similarity index 100% rename from src/retell_sdk/types/call_create_params.py rename to src/retell/types/call_create_params.py diff --git a/src/retell_sdk/types/call_create_response.py b/src/retell/types/call_create_response.py similarity index 100% rename from src/retell_sdk/types/call_create_response.py rename to src/retell/types/call_create_response.py diff --git a/src/retell_sdk/types/call_detail_response.py b/src/retell/types/call_detail_response.py similarity index 100% rename from src/retell_sdk/types/call_detail_response.py rename to src/retell/types/call_detail_response.py diff --git a/src/retell_sdk/types/call_list_params.py b/src/retell/types/call_list_params.py similarity index 100% rename from src/retell_sdk/types/call_list_params.py rename to src/retell/types/call_list_params.py diff --git a/src/retell_sdk/types/call_list_response.py b/src/retell/types/call_list_response.py similarity index 100% rename from src/retell_sdk/types/call_list_response.py rename to src/retell/types/call_list_response.py diff --git a/src/retell_sdk/types/call_register_params.py b/src/retell/types/call_register_params.py similarity index 100% rename from src/retell_sdk/types/call_register_params.py rename to src/retell/types/call_register_params.py diff --git a/src/retell_sdk/types/call_register_response.py b/src/retell/types/call_register_response.py similarity index 100% rename from src/retell_sdk/types/call_register_response.py rename to src/retell/types/call_register_response.py diff --git a/src/retell_sdk/types/llm_create_params.py b/src/retell/types/llm_create_params.py similarity index 100% rename from src/retell_sdk/types/llm_create_params.py rename to src/retell/types/llm_create_params.py diff --git a/src/retell_sdk/types/llm_list_response.py b/src/retell/types/llm_list_response.py similarity index 100% rename from src/retell_sdk/types/llm_list_response.py rename to src/retell/types/llm_list_response.py diff --git a/src/retell_sdk/types/llm_response.py b/src/retell/types/llm_response.py similarity index 100% rename from src/retell_sdk/types/llm_response.py rename to src/retell/types/llm_response.py diff --git a/src/retell_sdk/types/llm_update_params.py b/src/retell/types/llm_update_params.py similarity index 100% rename from src/retell_sdk/types/llm_update_params.py rename to src/retell/types/llm_update_params.py diff --git a/src/retell_sdk/types/phone_number_create_params.py b/src/retell/types/phone_number_create_params.py similarity index 100% rename from src/retell_sdk/types/phone_number_create_params.py rename to src/retell/types/phone_number_create_params.py diff --git a/src/retell_sdk/types/phone_number_list_response.py b/src/retell/types/phone_number_list_response.py similarity index 100% rename from src/retell_sdk/types/phone_number_list_response.py rename to src/retell/types/phone_number_list_response.py diff --git a/src/retell_sdk/types/phone_number_response.py b/src/retell/types/phone_number_response.py similarity index 100% rename from src/retell_sdk/types/phone_number_response.py rename to src/retell/types/phone_number_response.py diff --git a/src/retell_sdk/types/phone_number_update_params.py b/src/retell/types/phone_number_update_params.py similarity index 100% rename from src/retell_sdk/types/phone_number_update_params.py rename to src/retell/types/phone_number_update_params.py diff --git a/tests/api_resources/test_agent.py b/tests/api_resources/test_agent.py index fc9d1f6..ae8d73a 100644 --- a/tests/api_resources/test_agent.py +++ b/tests/api_resources/test_agent.py @@ -7,9 +7,9 @@ import pytest -from retell_sdk import RetellSdk, AsyncRetellSdk +from retell import Retell, AsyncRetell from tests.utils import assert_matches_type -from retell_sdk.types import AgentResponse, AgentListResponse +from retell.types import AgentResponse, AgentListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,7 +18,7 @@ class TestAgent: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create(self, client: RetellSdk) -> None: + def test_method_create(self, client: Retell) -> None: agent = client.agent.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -26,7 +26,7 @@ def test_method_create(self, client: RetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_method_create_with_all_params(self, client: RetellSdk) -> None: + def test_method_create_with_all_params(self, client: Retell) -> None: agent = client.agent.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_raw_response_create(self, client: RetellSdk) -> None: + def test_raw_response_create(self, client: Retell) -> None: response = client.agent.with_raw_response.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -57,7 +57,7 @@ def test_raw_response_create(self, client: RetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_streaming_response_create(self, client: RetellSdk) -> None: + def test_streaming_response_create(self, client: Retell) -> None: with client.agent.with_streaming_response.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -71,14 +71,14 @@ def test_streaming_response_create(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_retrieve(self, client: RetellSdk) -> None: + def test_method_retrieve(self, client: Retell) -> None: agent = client.agent.retrieve( "16b980523634a6dc504898cda492e939", ) assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: RetellSdk) -> None: + def test_raw_response_retrieve(self, client: Retell) -> None: response = client.agent.with_raw_response.retrieve( "16b980523634a6dc504898cda492e939", ) @@ -89,7 +89,7 @@ def test_raw_response_retrieve(self, client: RetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: RetellSdk) -> None: + def test_streaming_response_retrieve(self, client: Retell) -> None: with client.agent.with_streaming_response.retrieve( "16b980523634a6dc504898cda492e939", ) as response: @@ -102,21 +102,21 @@ def test_streaming_response_retrieve(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_retrieve(self, client: RetellSdk) -> None: + def test_path_params_retrieve(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): client.agent.with_raw_response.retrieve( "", ) @parametrize - def test_method_update(self, client: RetellSdk) -> None: + def test_method_update(self, client: Retell) -> None: agent = client.agent.update( "16b980523634a6dc504898cda492e939", ) assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_method_update_with_all_params(self, client: RetellSdk) -> None: + def test_method_update_with_all_params(self, client: Retell) -> None: agent = client.agent.update( "16b980523634a6dc504898cda492e939", agent_name="Jarvis", @@ -136,7 +136,7 @@ def test_method_update_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_raw_response_update(self, client: RetellSdk) -> None: + def test_raw_response_update(self, client: Retell) -> None: response = client.agent.with_raw_response.update( "16b980523634a6dc504898cda492e939", ) @@ -147,7 +147,7 @@ def test_raw_response_update(self, client: RetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - def test_streaming_response_update(self, client: RetellSdk) -> None: + def test_streaming_response_update(self, client: Retell) -> None: with client.agent.with_streaming_response.update( "16b980523634a6dc504898cda492e939", ) as response: @@ -160,19 +160,19 @@ def test_streaming_response_update(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_update(self, client: RetellSdk) -> None: + def test_path_params_update(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): client.agent.with_raw_response.update( "", ) @parametrize - def test_method_list(self, client: RetellSdk) -> None: + def test_method_list(self, client: Retell) -> None: agent = client.agent.list() assert_matches_type(AgentListResponse, agent, path=["response"]) @parametrize - def test_raw_response_list(self, client: RetellSdk) -> None: + def test_raw_response_list(self, client: Retell) -> None: response = client.agent.with_raw_response.list() assert response.is_closed is True @@ -181,7 +181,7 @@ def test_raw_response_list(self, client: RetellSdk) -> None: assert_matches_type(AgentListResponse, agent, path=["response"]) @parametrize - def test_streaming_response_list(self, client: RetellSdk) -> None: + def test_streaming_response_list(self, client: Retell) -> None: with client.agent.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -192,14 +192,14 @@ def test_streaming_response_list(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_delete(self, client: RetellSdk) -> None: + def test_method_delete(self, client: Retell) -> None: agent = client.agent.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) assert agent is None @parametrize - def test_raw_response_delete(self, client: RetellSdk) -> None: + def test_raw_response_delete(self, client: Retell) -> None: response = client.agent.with_raw_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) @@ -210,7 +210,7 @@ def test_raw_response_delete(self, client: RetellSdk) -> None: assert agent is None @parametrize - def test_streaming_response_delete(self, client: RetellSdk) -> None: + def test_streaming_response_delete(self, client: Retell) -> None: with client.agent.with_streaming_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) as response: @@ -223,7 +223,7 @@ def test_streaming_response_delete(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_delete(self, client: RetellSdk) -> None: + def test_path_params_delete(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): client.agent.with_raw_response.delete( "", @@ -234,7 +234,7 @@ class TestAsyncAgent: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_create(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create(self, async_client: AsyncRetell) -> None: agent = await async_client.agent.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -242,7 +242,7 @@ async def test_method_create(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncRetell) -> None: agent = await async_client.agent.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -261,7 +261,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_create(self, async_client: AsyncRetell) -> None: response = await async_client.agent.with_raw_response.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -273,7 +273,7 @@ async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_create(self, async_client: AsyncRetell) -> None: async with async_client.agent.with_streaming_response.create( llm_websocket_url="wss://your-websocket-endpoint", voice_id="11labs-Adrian", @@ -287,14 +287,14 @@ async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_method_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_method_retrieve(self, async_client: AsyncRetell) -> None: agent = await async_client.agent.retrieve( "16b980523634a6dc504898cda492e939", ) assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncRetell) -> None: response = await async_client.agent.with_raw_response.retrieve( "16b980523634a6dc504898cda492e939", ) @@ -305,7 +305,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncRetell) -> None: async with async_client.agent.with_streaming_response.retrieve( "16b980523634a6dc504898cda492e939", ) as response: @@ -318,21 +318,21 @@ async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) - assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_retrieve(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): await async_client.agent.with_raw_response.retrieve( "", ) @parametrize - async def test_method_update(self, async_client: AsyncRetellSdk) -> None: + async def test_method_update(self, async_client: AsyncRetell) -> None: agent = await async_client.agent.update( "16b980523634a6dc504898cda492e939", ) assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncRetell) -> None: agent = await async_client.agent.update( "16b980523634a6dc504898cda492e939", agent_name="Jarvis", @@ -352,7 +352,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncRetellSdk) assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_raw_response_update(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_update(self, async_client: AsyncRetell) -> None: response = await async_client.agent.with_raw_response.update( "16b980523634a6dc504898cda492e939", ) @@ -363,7 +363,7 @@ async def test_raw_response_update(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(AgentResponse, agent, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_update(self, async_client: AsyncRetell) -> None: async with async_client.agent.with_streaming_response.update( "16b980523634a6dc504898cda492e939", ) as response: @@ -376,19 +376,19 @@ async def test_streaming_response_update(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_update(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_update(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): await async_client.agent.with_raw_response.update( "", ) @parametrize - async def test_method_list(self, async_client: AsyncRetellSdk) -> None: + async def test_method_list(self, async_client: AsyncRetell) -> None: agent = await async_client.agent.list() assert_matches_type(AgentListResponse, agent, path=["response"]) @parametrize - async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_list(self, async_client: AsyncRetell) -> None: response = await async_client.agent.with_raw_response.list() assert response.is_closed is True @@ -397,7 +397,7 @@ async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(AgentListResponse, agent, path=["response"]) @parametrize - async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_list(self, async_client: AsyncRetell) -> None: async with async_client.agent.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -408,14 +408,14 @@ async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> No assert cast(Any, response.is_closed) is True @parametrize - async def test_method_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_method_delete(self, async_client: AsyncRetell) -> None: agent = await async_client.agent.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) assert agent is None @parametrize - async def test_raw_response_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_delete(self, async_client: AsyncRetell) -> None: response = await async_client.agent.with_raw_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) @@ -426,7 +426,7 @@ async def test_raw_response_delete(self, async_client: AsyncRetellSdk) -> None: assert agent is None @parametrize - async def test_streaming_response_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_delete(self, async_client: AsyncRetell) -> None: async with async_client.agent.with_streaming_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) as response: @@ -439,7 +439,7 @@ async def test_streaming_response_delete(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_delete(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): await async_client.agent.with_raw_response.delete( "", diff --git a/tests/api_resources/test_call.py b/tests/api_resources/test_call.py index b602940..9778db0 100644 --- a/tests/api_resources/test_call.py +++ b/tests/api_resources/test_call.py @@ -7,9 +7,9 @@ import pytest -from retell_sdk import RetellSdk, AsyncRetellSdk +from retell import Retell, AsyncRetell from tests.utils import assert_matches_type -from retell_sdk.types import ( +from retell.types import ( CallListResponse, CallCreateResponse, CallDetailResponse, @@ -23,7 +23,7 @@ class TestCall: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create(self, client: RetellSdk) -> None: + def test_method_create(self, client: Retell) -> None: call = client.call.create( phone_number={ "from": "string", @@ -33,7 +33,7 @@ def test_method_create(self, client: RetellSdk) -> None: assert_matches_type(CallCreateResponse, call, path=["response"]) @parametrize - def test_method_create_with_all_params(self, client: RetellSdk) -> None: + def test_method_create_with_all_params(self, client: Retell) -> None: call = client.call.create( phone_number={ "from": "string", @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(CallCreateResponse, call, path=["response"]) @parametrize - def test_raw_response_create(self, client: RetellSdk) -> None: + def test_raw_response_create(self, client: Retell) -> None: response = client.call.with_raw_response.create( phone_number={ "from": "string", @@ -59,7 +59,7 @@ def test_raw_response_create(self, client: RetellSdk) -> None: assert_matches_type(CallCreateResponse, call, path=["response"]) @parametrize - def test_streaming_response_create(self, client: RetellSdk) -> None: + def test_streaming_response_create(self, client: Retell) -> None: with client.call.with_streaming_response.create( phone_number={ "from": "string", @@ -75,14 +75,14 @@ def test_streaming_response_create(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_retrieve(self, client: RetellSdk) -> None: + def test_method_retrieve(self, client: Retell) -> None: call = client.call.retrieve( "119c3f8e47135a29e65947eeb34cf12d", ) assert_matches_type(CallDetailResponse, call, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: RetellSdk) -> None: + def test_raw_response_retrieve(self, client: Retell) -> None: response = client.call.with_raw_response.retrieve( "119c3f8e47135a29e65947eeb34cf12d", ) @@ -93,7 +93,7 @@ def test_raw_response_retrieve(self, client: RetellSdk) -> None: assert_matches_type(CallDetailResponse, call, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: RetellSdk) -> None: + def test_streaming_response_retrieve(self, client: Retell) -> None: with client.call.with_streaming_response.retrieve( "119c3f8e47135a29e65947eeb34cf12d", ) as response: @@ -106,19 +106,19 @@ def test_streaming_response_retrieve(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_retrieve(self, client: RetellSdk) -> None: + def test_path_params_retrieve(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `call_id` but received ''"): client.call.with_raw_response.retrieve( "", ) @parametrize - def test_method_list(self, client: RetellSdk) -> None: + def test_method_list(self, client: Retell) -> None: call = client.call.list() assert_matches_type(CallListResponse, call, path=["response"]) @parametrize - def test_method_list_with_all_params(self, client: RetellSdk) -> None: + def test_method_list_with_all_params(self, client: Retell) -> None: call = client.call.list( filter_criteria={ "agent_id": ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"], @@ -133,7 +133,7 @@ def test_method_list_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(CallListResponse, call, path=["response"]) @parametrize - def test_raw_response_list(self, client: RetellSdk) -> None: + def test_raw_response_list(self, client: Retell) -> None: response = client.call.with_raw_response.list() assert response.is_closed is True @@ -142,7 +142,7 @@ def test_raw_response_list(self, client: RetellSdk) -> None: assert_matches_type(CallListResponse, call, path=["response"]) @parametrize - def test_streaming_response_list(self, client: RetellSdk) -> None: + def test_streaming_response_list(self, client: Retell) -> None: with client.call.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -153,7 +153,7 @@ def test_streaming_response_list(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_register(self, client: RetellSdk) -> None: + def test_method_register(self, client: Retell) -> None: call = client.call.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", @@ -163,7 +163,7 @@ def test_method_register(self, client: RetellSdk) -> None: assert_matches_type(CallRegisterResponse, call, path=["response"]) @parametrize - def test_method_register_with_all_params(self, client: RetellSdk) -> None: + def test_method_register_with_all_params(self, client: Retell) -> None: call = client.call.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", @@ -178,7 +178,7 @@ def test_method_register_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(CallRegisterResponse, call, path=["response"]) @parametrize - def test_raw_response_register(self, client: RetellSdk) -> None: + def test_raw_response_register(self, client: Retell) -> None: response = client.call.with_raw_response.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", @@ -192,7 +192,7 @@ def test_raw_response_register(self, client: RetellSdk) -> None: assert_matches_type(CallRegisterResponse, call, path=["response"]) @parametrize - def test_streaming_response_register(self, client: RetellSdk) -> None: + def test_streaming_response_register(self, client: Retell) -> None: with client.call.with_streaming_response.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", @@ -212,7 +212,7 @@ class TestAsyncCall: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_create(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create(self, async_client: AsyncRetell) -> None: call = await async_client.call.create( phone_number={ "from": "string", @@ -222,7 +222,7 @@ async def test_method_create(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(CallCreateResponse, call, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncRetell) -> None: call = await async_client.call.create( phone_number={ "from": "string", @@ -234,7 +234,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) assert_matches_type(CallCreateResponse, call, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_create(self, async_client: AsyncRetell) -> None: response = await async_client.call.with_raw_response.create( phone_number={ "from": "string", @@ -248,7 +248,7 @@ async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(CallCreateResponse, call, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_create(self, async_client: AsyncRetell) -> None: async with async_client.call.with_streaming_response.create( phone_number={ "from": "string", @@ -264,14 +264,14 @@ async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_method_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_method_retrieve(self, async_client: AsyncRetell) -> None: call = await async_client.call.retrieve( "119c3f8e47135a29e65947eeb34cf12d", ) assert_matches_type(CallDetailResponse, call, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncRetell) -> None: response = await async_client.call.with_raw_response.retrieve( "119c3f8e47135a29e65947eeb34cf12d", ) @@ -282,7 +282,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None assert_matches_type(CallDetailResponse, call, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncRetell) -> None: async with async_client.call.with_streaming_response.retrieve( "119c3f8e47135a29e65947eeb34cf12d", ) as response: @@ -295,19 +295,19 @@ async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) - assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_retrieve(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `call_id` but received ''"): await async_client.call.with_raw_response.retrieve( "", ) @parametrize - async def test_method_list(self, async_client: AsyncRetellSdk) -> None: + async def test_method_list(self, async_client: AsyncRetell) -> None: call = await async_client.call.list() assert_matches_type(CallListResponse, call, path=["response"]) @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_list_with_all_params(self, async_client: AsyncRetell) -> None: call = await async_client.call.list( filter_criteria={ "agent_id": ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"], @@ -322,7 +322,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncRetellSdk) - assert_matches_type(CallListResponse, call, path=["response"]) @parametrize - async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_list(self, async_client: AsyncRetell) -> None: response = await async_client.call.with_raw_response.list() assert response.is_closed is True @@ -331,7 +331,7 @@ async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(CallListResponse, call, path=["response"]) @parametrize - async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_list(self, async_client: AsyncRetell) -> None: async with async_client.call.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -342,7 +342,7 @@ async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> No assert cast(Any, response.is_closed) is True @parametrize - async def test_method_register(self, async_client: AsyncRetellSdk) -> None: + async def test_method_register(self, async_client: AsyncRetell) -> None: call = await async_client.call.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", @@ -352,7 +352,7 @@ async def test_method_register(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(CallRegisterResponse, call, path=["response"]) @parametrize - async def test_method_register_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_register_with_all_params(self, async_client: AsyncRetell) -> None: call = await async_client.call.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", @@ -367,7 +367,7 @@ async def test_method_register_with_all_params(self, async_client: AsyncRetellSd assert_matches_type(CallRegisterResponse, call, path=["response"]) @parametrize - async def test_raw_response_register(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_register(self, async_client: AsyncRetell) -> None: response = await async_client.call.with_raw_response.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", @@ -381,7 +381,7 @@ async def test_raw_response_register(self, async_client: AsyncRetellSdk) -> None assert_matches_type(CallRegisterResponse, call, path=["response"]) @parametrize - async def test_streaming_response_register(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_register(self, async_client: AsyncRetell) -> None: async with async_client.call.with_streaming_response.register( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", audio_encoding="s16le", diff --git a/tests/api_resources/test_llm.py b/tests/api_resources/test_llm.py index dd3d6f9..667d0f7 100644 --- a/tests/api_resources/test_llm.py +++ b/tests/api_resources/test_llm.py @@ -7,9 +7,9 @@ import pytest -from retell_sdk import RetellSdk, AsyncRetellSdk +from retell import Retell, AsyncRetell from tests.utils import assert_matches_type -from retell_sdk.types import LlmResponse, LlmListResponse +from retell.types import LlmResponse, LlmListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,12 +18,12 @@ class TestLlm: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create(self, client: RetellSdk) -> None: + def test_method_create(self, client: Retell) -> None: llm = client.llm.create() assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_method_create_with_all_params(self, client: RetellSdk) -> None: + def test_method_create_with_all_params(self, client: Retell) -> None: llm = client.llm.create( begin_message="Hey I am a virtual assistant calling from Retell Hospital.", general_prompt="You are ...", @@ -111,7 +111,7 @@ def test_method_create_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_raw_response_create(self, client: RetellSdk) -> None: + def test_raw_response_create(self, client: Retell) -> None: response = client.llm.with_raw_response.create() assert response.is_closed is True @@ -120,7 +120,7 @@ def test_raw_response_create(self, client: RetellSdk) -> None: assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_streaming_response_create(self, client: RetellSdk) -> None: + def test_streaming_response_create(self, client: Retell) -> None: with client.llm.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -131,14 +131,14 @@ def test_streaming_response_create(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_retrieve(self, client: RetellSdk) -> None: + def test_method_retrieve(self, client: Retell) -> None: llm = client.llm.retrieve( "16b980523634a6dc504898cda492e939", ) assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: RetellSdk) -> None: + def test_raw_response_retrieve(self, client: Retell) -> None: response = client.llm.with_raw_response.retrieve( "16b980523634a6dc504898cda492e939", ) @@ -149,7 +149,7 @@ def test_raw_response_retrieve(self, client: RetellSdk) -> None: assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: RetellSdk) -> None: + def test_streaming_response_retrieve(self, client: Retell) -> None: with client.llm.with_streaming_response.retrieve( "16b980523634a6dc504898cda492e939", ) as response: @@ -162,21 +162,21 @@ def test_streaming_response_retrieve(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_retrieve(self, client: RetellSdk) -> None: + def test_path_params_retrieve(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `llm_id` but received ''"): client.llm.with_raw_response.retrieve( "", ) @parametrize - def test_method_update(self, client: RetellSdk) -> None: + def test_method_update(self, client: Retell) -> None: llm = client.llm.update( "16b980523634a6dc504898cda492e939", ) assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_method_update_with_all_params(self, client: RetellSdk) -> None: + def test_method_update_with_all_params(self, client: Retell) -> None: llm = client.llm.update( "16b980523634a6dc504898cda492e939", begin_message="Hey I am a virtual assistant calling from Retell Hospital.", @@ -265,7 +265,7 @@ def test_method_update_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_raw_response_update(self, client: RetellSdk) -> None: + def test_raw_response_update(self, client: Retell) -> None: response = client.llm.with_raw_response.update( "16b980523634a6dc504898cda492e939", ) @@ -276,7 +276,7 @@ def test_raw_response_update(self, client: RetellSdk) -> None: assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - def test_streaming_response_update(self, client: RetellSdk) -> None: + def test_streaming_response_update(self, client: Retell) -> None: with client.llm.with_streaming_response.update( "16b980523634a6dc504898cda492e939", ) as response: @@ -289,19 +289,19 @@ def test_streaming_response_update(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_update(self, client: RetellSdk) -> None: + def test_path_params_update(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `llm_id` but received ''"): client.llm.with_raw_response.update( "", ) @parametrize - def test_method_list(self, client: RetellSdk) -> None: + def test_method_list(self, client: Retell) -> None: llm = client.llm.list() assert_matches_type(LlmListResponse, llm, path=["response"]) @parametrize - def test_raw_response_list(self, client: RetellSdk) -> None: + def test_raw_response_list(self, client: Retell) -> None: response = client.llm.with_raw_response.list() assert response.is_closed is True @@ -310,7 +310,7 @@ def test_raw_response_list(self, client: RetellSdk) -> None: assert_matches_type(LlmListResponse, llm, path=["response"]) @parametrize - def test_streaming_response_list(self, client: RetellSdk) -> None: + def test_streaming_response_list(self, client: Retell) -> None: with client.llm.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -321,14 +321,14 @@ def test_streaming_response_list(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_delete(self, client: RetellSdk) -> None: + def test_method_delete(self, client: Retell) -> None: llm = client.llm.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) assert llm is None @parametrize - def test_raw_response_delete(self, client: RetellSdk) -> None: + def test_raw_response_delete(self, client: Retell) -> None: response = client.llm.with_raw_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) @@ -339,7 +339,7 @@ def test_raw_response_delete(self, client: RetellSdk) -> None: assert llm is None @parametrize - def test_streaming_response_delete(self, client: RetellSdk) -> None: + def test_streaming_response_delete(self, client: Retell) -> None: with client.llm.with_streaming_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) as response: @@ -352,7 +352,7 @@ def test_streaming_response_delete(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_delete(self, client: RetellSdk) -> None: + def test_path_params_delete(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `llm_id` but received ''"): client.llm.with_raw_response.delete( "", @@ -363,12 +363,12 @@ class TestAsyncLlm: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_create(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create(self, async_client: AsyncRetell) -> None: llm = await async_client.llm.create() assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncRetell) -> None: llm = await async_client.llm.create( begin_message="Hey I am a virtual assistant calling from Retell Hospital.", general_prompt="You are ...", @@ -456,7 +456,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_create(self, async_client: AsyncRetell) -> None: response = await async_client.llm.with_raw_response.create() assert response.is_closed is True @@ -465,7 +465,7 @@ async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_create(self, async_client: AsyncRetell) -> None: async with async_client.llm.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -476,14 +476,14 @@ async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_method_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_method_retrieve(self, async_client: AsyncRetell) -> None: llm = await async_client.llm.retrieve( "16b980523634a6dc504898cda492e939", ) assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncRetell) -> None: response = await async_client.llm.with_raw_response.retrieve( "16b980523634a6dc504898cda492e939", ) @@ -494,7 +494,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncRetell) -> None: async with async_client.llm.with_streaming_response.retrieve( "16b980523634a6dc504898cda492e939", ) as response: @@ -507,21 +507,21 @@ async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) - assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_retrieve(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `llm_id` but received ''"): await async_client.llm.with_raw_response.retrieve( "", ) @parametrize - async def test_method_update(self, async_client: AsyncRetellSdk) -> None: + async def test_method_update(self, async_client: AsyncRetell) -> None: llm = await async_client.llm.update( "16b980523634a6dc504898cda492e939", ) assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncRetell) -> None: llm = await async_client.llm.update( "16b980523634a6dc504898cda492e939", begin_message="Hey I am a virtual assistant calling from Retell Hospital.", @@ -610,7 +610,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncRetellSdk) assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_raw_response_update(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_update(self, async_client: AsyncRetell) -> None: response = await async_client.llm.with_raw_response.update( "16b980523634a6dc504898cda492e939", ) @@ -621,7 +621,7 @@ async def test_raw_response_update(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(LlmResponse, llm, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_update(self, async_client: AsyncRetell) -> None: async with async_client.llm.with_streaming_response.update( "16b980523634a6dc504898cda492e939", ) as response: @@ -634,19 +634,19 @@ async def test_streaming_response_update(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_update(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_update(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `llm_id` but received ''"): await async_client.llm.with_raw_response.update( "", ) @parametrize - async def test_method_list(self, async_client: AsyncRetellSdk) -> None: + async def test_method_list(self, async_client: AsyncRetell) -> None: llm = await async_client.llm.list() assert_matches_type(LlmListResponse, llm, path=["response"]) @parametrize - async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_list(self, async_client: AsyncRetell) -> None: response = await async_client.llm.with_raw_response.list() assert response.is_closed is True @@ -655,7 +655,7 @@ async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(LlmListResponse, llm, path=["response"]) @parametrize - async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_list(self, async_client: AsyncRetell) -> None: async with async_client.llm.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -666,14 +666,14 @@ async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> No assert cast(Any, response.is_closed) is True @parametrize - async def test_method_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_method_delete(self, async_client: AsyncRetell) -> None: llm = await async_client.llm.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) assert llm is None @parametrize - async def test_raw_response_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_delete(self, async_client: AsyncRetell) -> None: response = await async_client.llm.with_raw_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) @@ -684,7 +684,7 @@ async def test_raw_response_delete(self, async_client: AsyncRetellSdk) -> None: assert llm is None @parametrize - async def test_streaming_response_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_delete(self, async_client: AsyncRetell) -> None: async with async_client.llm.with_streaming_response.delete( "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) as response: @@ -697,7 +697,7 @@ async def test_streaming_response_delete(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_delete(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `llm_id` but received ''"): await async_client.llm.with_raw_response.delete( "", diff --git a/tests/api_resources/test_phone_number.py b/tests/api_resources/test_phone_number.py index e1ffb9d..8ad3fa7 100644 --- a/tests/api_resources/test_phone_number.py +++ b/tests/api_resources/test_phone_number.py @@ -7,9 +7,9 @@ import pytest -from retell_sdk import RetellSdk, AsyncRetellSdk +from retell import Retell, AsyncRetell from tests.utils import assert_matches_type -from retell_sdk.types import ( +from retell.types import ( PhoneNumberResponse, PhoneNumberListResponse, ) @@ -21,14 +21,14 @@ class TestPhoneNumber: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create(self, client: RetellSdk) -> None: + def test_method_create(self, client: Retell) -> None: phone_number = client.phone_number.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - def test_method_create_with_all_params(self, client: RetellSdk) -> None: + def test_method_create_with_all_params(self, client: Retell) -> None: phone_number = client.phone_number.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", area_code=415, @@ -36,7 +36,7 @@ def test_method_create_with_all_params(self, client: RetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - def test_raw_response_create(self, client: RetellSdk) -> None: + def test_raw_response_create(self, client: Retell) -> None: response = client.phone_number.with_raw_response.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) @@ -47,7 +47,7 @@ def test_raw_response_create(self, client: RetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - def test_streaming_response_create(self, client: RetellSdk) -> None: + def test_streaming_response_create(self, client: Retell) -> None: with client.phone_number.with_streaming_response.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) as response: @@ -60,14 +60,14 @@ def test_streaming_response_create(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_retrieve(self, client: RetellSdk) -> None: + def test_method_retrieve(self, client: Retell) -> None: phone_number = client.phone_number.retrieve( "string", ) assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: RetellSdk) -> None: + def test_raw_response_retrieve(self, client: Retell) -> None: response = client.phone_number.with_raw_response.retrieve( "string", ) @@ -78,7 +78,7 @@ def test_raw_response_retrieve(self, client: RetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: RetellSdk) -> None: + def test_streaming_response_retrieve(self, client: Retell) -> None: with client.phone_number.with_streaming_response.retrieve( "string", ) as response: @@ -91,14 +91,14 @@ def test_streaming_response_retrieve(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_retrieve(self, client: RetellSdk) -> None: + def test_path_params_retrieve(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): client.phone_number.with_raw_response.retrieve( "", ) @parametrize - def test_method_update(self, client: RetellSdk) -> None: + def test_method_update(self, client: Retell) -> None: phone_number = client.phone_number.update( "string", agent_id="string", @@ -106,7 +106,7 @@ def test_method_update(self, client: RetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - def test_raw_response_update(self, client: RetellSdk) -> None: + def test_raw_response_update(self, client: Retell) -> None: response = client.phone_number.with_raw_response.update( "string", agent_id="string", @@ -118,7 +118,7 @@ def test_raw_response_update(self, client: RetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - def test_streaming_response_update(self, client: RetellSdk) -> None: + def test_streaming_response_update(self, client: Retell) -> None: with client.phone_number.with_streaming_response.update( "string", agent_id="string", @@ -132,7 +132,7 @@ def test_streaming_response_update(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_update(self, client: RetellSdk) -> None: + def test_path_params_update(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): client.phone_number.with_raw_response.update( "", @@ -140,12 +140,12 @@ def test_path_params_update(self, client: RetellSdk) -> None: ) @parametrize - def test_method_list(self, client: RetellSdk) -> None: + def test_method_list(self, client: Retell) -> None: phone_number = client.phone_number.list() assert_matches_type(PhoneNumberListResponse, phone_number, path=["response"]) @parametrize - def test_raw_response_list(self, client: RetellSdk) -> None: + def test_raw_response_list(self, client: Retell) -> None: response = client.phone_number.with_raw_response.list() assert response.is_closed is True @@ -154,7 +154,7 @@ def test_raw_response_list(self, client: RetellSdk) -> None: assert_matches_type(PhoneNumberListResponse, phone_number, path=["response"]) @parametrize - def test_streaming_response_list(self, client: RetellSdk) -> None: + def test_streaming_response_list(self, client: Retell) -> None: with client.phone_number.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -165,14 +165,14 @@ def test_streaming_response_list(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_delete(self, client: RetellSdk) -> None: + def test_method_delete(self, client: Retell) -> None: phone_number = client.phone_number.delete( "string", ) assert phone_number is None @parametrize - def test_raw_response_delete(self, client: RetellSdk) -> None: + def test_raw_response_delete(self, client: Retell) -> None: response = client.phone_number.with_raw_response.delete( "string", ) @@ -183,7 +183,7 @@ def test_raw_response_delete(self, client: RetellSdk) -> None: assert phone_number is None @parametrize - def test_streaming_response_delete(self, client: RetellSdk) -> None: + def test_streaming_response_delete(self, client: Retell) -> None: with client.phone_number.with_streaming_response.delete( "string", ) as response: @@ -196,7 +196,7 @@ def test_streaming_response_delete(self, client: RetellSdk) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_delete(self, client: RetellSdk) -> None: + def test_path_params_delete(self, client: Retell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): client.phone_number.with_raw_response.delete( "", @@ -207,14 +207,14 @@ class TestAsyncPhoneNumber: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_create(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create(self, async_client: AsyncRetell) -> None: phone_number = await async_client.phone_number.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncRetell) -> None: phone_number = await async_client.phone_number.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", area_code=415, @@ -222,7 +222,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRetellSdk) assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_create(self, async_client: AsyncRetell) -> None: response = await async_client.phone_number.with_raw_response.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) @@ -233,7 +233,7 @@ async def test_raw_response_create(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_create(self, async_client: AsyncRetell) -> None: async with async_client.phone_number.with_streaming_response.create( agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", ) as response: @@ -246,14 +246,14 @@ async def test_streaming_response_create(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_method_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_method_retrieve(self, async_client: AsyncRetell) -> None: phone_number = await async_client.phone_number.retrieve( "string", ) assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncRetell) -> None: response = await async_client.phone_number.with_raw_response.retrieve( "string", ) @@ -264,7 +264,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncRetellSdk) -> None assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncRetell) -> None: async with async_client.phone_number.with_streaming_response.retrieve( "string", ) as response: @@ -277,14 +277,14 @@ async def test_streaming_response_retrieve(self, async_client: AsyncRetellSdk) - assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_retrieve(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_retrieve(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): await async_client.phone_number.with_raw_response.retrieve( "", ) @parametrize - async def test_method_update(self, async_client: AsyncRetellSdk) -> None: + async def test_method_update(self, async_client: AsyncRetell) -> None: phone_number = await async_client.phone_number.update( "string", agent_id="string", @@ -292,7 +292,7 @@ async def test_method_update(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - async def test_raw_response_update(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_update(self, async_client: AsyncRetell) -> None: response = await async_client.phone_number.with_raw_response.update( "string", agent_id="string", @@ -304,7 +304,7 @@ async def test_raw_response_update(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(PhoneNumberResponse, phone_number, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_update(self, async_client: AsyncRetell) -> None: async with async_client.phone_number.with_streaming_response.update( "string", agent_id="string", @@ -318,7 +318,7 @@ async def test_streaming_response_update(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_update(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_update(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): await async_client.phone_number.with_raw_response.update( "", @@ -326,12 +326,12 @@ async def test_path_params_update(self, async_client: AsyncRetellSdk) -> None: ) @parametrize - async def test_method_list(self, async_client: AsyncRetellSdk) -> None: + async def test_method_list(self, async_client: AsyncRetell) -> None: phone_number = await async_client.phone_number.list() assert_matches_type(PhoneNumberListResponse, phone_number, path=["response"]) @parametrize - async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_list(self, async_client: AsyncRetell) -> None: response = await async_client.phone_number.with_raw_response.list() assert response.is_closed is True @@ -340,7 +340,7 @@ async def test_raw_response_list(self, async_client: AsyncRetellSdk) -> None: assert_matches_type(PhoneNumberListResponse, phone_number, path=["response"]) @parametrize - async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_list(self, async_client: AsyncRetell) -> None: async with async_client.phone_number.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -351,14 +351,14 @@ async def test_streaming_response_list(self, async_client: AsyncRetellSdk) -> No assert cast(Any, response.is_closed) is True @parametrize - async def test_method_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_method_delete(self, async_client: AsyncRetell) -> None: phone_number = await async_client.phone_number.delete( "string", ) assert phone_number is None @parametrize - async def test_raw_response_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_raw_response_delete(self, async_client: AsyncRetell) -> None: response = await async_client.phone_number.with_raw_response.delete( "string", ) @@ -369,7 +369,7 @@ async def test_raw_response_delete(self, async_client: AsyncRetellSdk) -> None: assert phone_number is None @parametrize - async def test_streaming_response_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_streaming_response_delete(self, async_client: AsyncRetell) -> None: async with async_client.phone_number.with_streaming_response.delete( "string", ) as response: @@ -382,7 +382,7 @@ async def test_streaming_response_delete(self, async_client: AsyncRetellSdk) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_delete(self, async_client: AsyncRetellSdk) -> None: + async def test_path_params_delete(self, async_client: AsyncRetell) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): await async_client.phone_number.with_raw_response.delete( "", diff --git a/tests/conftest.py b/tests/conftest.py index 6b6cb48..c82cd40 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,14 +7,14 @@ import pytest -from retell_sdk import RetellSdk, AsyncRetellSdk +from retell import Retell, AsyncRetell if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest pytest.register_assert_rewrite("tests.utils") -logging.getLogger("retell_sdk").setLevel(logging.DEBUG) +logging.getLogger("retell").setLevel(logging.DEBUG) @pytest.fixture(scope="session") @@ -30,20 +30,20 @@ def event_loop() -> Iterator[asyncio.AbstractEventLoop]: @pytest.fixture(scope="session") -def client(request: FixtureRequest) -> Iterator[RetellSdk]: +def client(request: FixtureRequest) -> Iterator[Retell]: strict = getattr(request, "param", True) if not isinstance(strict, bool): raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - with RetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + with Retell(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: yield client @pytest.fixture(scope="session") -async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncRetellSdk]: +async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncRetell]: strict = getattr(request, "param", True) if not isinstance(strict, bool): raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - async with AsyncRetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + async with AsyncRetell(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: yield client diff --git a/tests/test_client.py b/tests/test_client.py index a67ca24..7776629 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -16,17 +16,12 @@ from respx import MockRouter from pydantic import ValidationError -from retell_sdk import RetellSdk, AsyncRetellSdk, APIResponseValidationError -from retell_sdk._client import RetellSdk, AsyncRetellSdk -from retell_sdk._models import BaseModel, FinalRequestOptions -from retell_sdk._constants import RAW_RESPONSE_HEADER -from retell_sdk._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError -from retell_sdk._base_client import ( - DEFAULT_TIMEOUT, - HTTPX_DEFAULT_TIMEOUT, - BaseClient, - make_request_options, -) +from retell import Retell, AsyncRetell, APIResponseValidationError +from retell._client import Retell, AsyncRetell +from retell._models import BaseModel, FinalRequestOptions +from retell._constants import RAW_RESPONSE_HEADER +from retell._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError +from retell._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, make_request_options from .utils import update_env @@ -44,7 +39,7 @@ def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 -def _get_open_connections(client: RetellSdk | AsyncRetellSdk) -> int: +def _get_open_connections(client: Retell | AsyncRetell) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -52,8 +47,8 @@ def _get_open_connections(client: RetellSdk | AsyncRetellSdk) -> int: return len(pool._requests) -class TestRetellSdk: - client = RetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) +class TestRetell: + client = Retell(base_url=base_url, api_key=api_key, _strict_response_validation=True) @pytest.mark.respx(base_url=base_url) def test_raw_response(self, respx_mock: MockRouter) -> None: @@ -100,7 +95,7 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = RetellSdk( + client = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) assert client.default_headers["X-Foo"] == "bar" @@ -134,7 +129,7 @@ def test_copy_default_headers(self) -> None: client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) def test_copy_default_query(self) -> None: - client = RetellSdk( + client = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) assert _get_params(client)["foo"] == "bar" @@ -225,10 +220,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic # to_raw_response_wrapper leaks through the @functools.wraps() decorator. # # removing the decorator fixes the leak for reasons we don't understand. - "retell_sdk/_legacy_response.py", - "retell_sdk/_response.py", + "retell/_legacy_response.py", + "retell/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "retell_sdk/_compat.py", + "retell/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -259,9 +254,7 @@ def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) def test_client_timeout_option(self) -> None: - client = RetellSdk( - base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) - ) + client = Retell(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -270,7 +263,7 @@ def test_client_timeout_option(self) -> None: def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: - client = RetellSdk( + client = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -280,7 +273,7 @@ def test_http_client_timeout_option(self) -> None: # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: - client = RetellSdk( + client = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -290,7 +283,7 @@ def test_http_client_timeout_option(self) -> None: # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = RetellSdk( + client = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -301,7 +294,7 @@ def test_http_client_timeout_option(self) -> None: async def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): async with httpx.AsyncClient() as http_client: - RetellSdk( + Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -309,14 +302,14 @@ async def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - client = RetellSdk( + client = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = RetellSdk( + client2 = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -330,7 +323,7 @@ def test_default_headers_option(self) -> None: assert request.headers.get("x-stainless-lang") == "my-overriding-header" def test_default_query_option(self) -> None: - client = RetellSdk( + client = Retell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -444,7 +437,7 @@ def test_request_extra_query(self) -> None: params = dict(request.url.params) assert params == {"foo": "2"} - def test_multipart_repeating_array(self, client: RetellSdk) -> None: + def test_multipart_repeating_array(self, client: Retell) -> None: request = client._build_request( FinalRequestOptions.construct( method="get", @@ -531,7 +524,7 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = RetellSdk(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) + client = Retell(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -539,15 +532,15 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(RETELL_SDK_BASE_URL="http://localhost:5000/from/env"): - client = RetellSdk(api_key=api_key, _strict_response_validation=True) + with update_env(RETELL_BASE_URL="http://localhost:5000/from/env"): + client = Retell(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @pytest.mark.parametrize( "client", [ - RetellSdk(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), - RetellSdk( + Retell(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Retell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -556,7 +549,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: RetellSdk) -> None: + def test_base_url_trailing_slash(self, client: Retell) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -569,8 +562,8 @@ def test_base_url_trailing_slash(self, client: RetellSdk) -> None: @pytest.mark.parametrize( "client", [ - RetellSdk(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), - RetellSdk( + Retell(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Retell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -579,7 +572,7 @@ def test_base_url_trailing_slash(self, client: RetellSdk) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: RetellSdk) -> None: + def test_base_url_no_trailing_slash(self, client: Retell) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -592,8 +585,8 @@ def test_base_url_no_trailing_slash(self, client: RetellSdk) -> None: @pytest.mark.parametrize( "client", [ - RetellSdk(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), - RetellSdk( + Retell(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Retell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -602,7 +595,7 @@ def test_base_url_no_trailing_slash(self, client: RetellSdk) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: RetellSdk) -> None: + def test_absolute_request_url(self, client: Retell) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -613,7 +606,7 @@ def test_absolute_request_url(self, client: RetellSdk) -> None: assert request.url == "https://myapi.com/foo" def test_copied_client_does_not_close_http(self) -> None: - client = RetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = Retell(base_url=base_url, api_key=api_key, _strict_response_validation=True) assert not client.is_closed() copied = client.copy() @@ -624,7 +617,7 @@ def test_copied_client_does_not_close_http(self) -> None: assert not client.is_closed() def test_client_context_manager(self) -> None: - client = RetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = Retell(base_url=base_url, api_key=api_key, _strict_response_validation=True) with client as c2: assert c2 is client assert not c2.is_closed() @@ -650,12 +643,12 @@ class Model(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) - strict_client = RetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + strict_client = Retell(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): strict_client.get("/foo", cast_to=Model) - client = RetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=False) + client = Retell(base_url=base_url, api_key=api_key, _strict_response_validation=False) response = client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] @@ -682,14 +675,14 @@ class Model(BaseModel): ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = RetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = Retell(base_url=base_url, api_key=api_key, _strict_response_validation=True) headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("retell_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("retell._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/create-agent").mock(side_effect=httpx.TimeoutException("Test timeout error")) @@ -704,7 +697,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No assert _get_open_connections(self.client) == 0 - @mock.patch("retell_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("retell._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/create-agent").mock(return_value=httpx.Response(500)) @@ -720,8 +713,8 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non assert _get_open_connections(self.client) == 0 -class TestAsyncRetellSdk: - client = AsyncRetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) +class TestAsyncRetell: + client = AsyncRetell(base_url=base_url, api_key=api_key, _strict_response_validation=True) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio @@ -770,7 +763,7 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) assert client.default_headers["X-Foo"] == "bar" @@ -804,7 +797,7 @@ def test_copy_default_headers(self) -> None: client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) def test_copy_default_query(self) -> None: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) assert _get_params(client)["foo"] == "bar" @@ -895,10 +888,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic # to_raw_response_wrapper leaks through the @functools.wraps() decorator. # # removing the decorator fixes the leak for reasons we don't understand. - "retell_sdk/_legacy_response.py", - "retell_sdk/_response.py", + "retell/_legacy_response.py", + "retell/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "retell_sdk/_compat.py", + "retell/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -929,7 +922,7 @@ async def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) async def test_client_timeout_option(self) -> None: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) ) @@ -940,7 +933,7 @@ async def test_client_timeout_option(self) -> None: async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -950,7 +943,7 @@ async def test_http_client_timeout_option(self) -> None: # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -960,7 +953,7 @@ async def test_http_client_timeout_option(self) -> None: # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -971,7 +964,7 @@ async def test_http_client_timeout_option(self) -> None: def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): with httpx.Client() as http_client: - AsyncRetellSdk( + AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -979,14 +972,14 @@ def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = AsyncRetellSdk( + client2 = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1000,7 +993,7 @@ def test_default_headers_option(self) -> None: assert request.headers.get("x-stainless-lang") == "my-overriding-header" def test_default_query_option(self) -> None: - client = AsyncRetellSdk( + client = AsyncRetell( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -1114,7 +1107,7 @@ def test_request_extra_query(self) -> None: params = dict(request.url.params) assert params == {"foo": "2"} - def test_multipart_repeating_array(self, async_client: AsyncRetellSdk) -> None: + def test_multipart_repeating_array(self, async_client: AsyncRetell) -> None: request = async_client._build_request( FinalRequestOptions.construct( method="get", @@ -1201,7 +1194,7 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = AsyncRetellSdk( + client = AsyncRetell( base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True ) assert client.base_url == "https://example.com/from_init/" @@ -1211,17 +1204,17 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(RETELL_SDK_BASE_URL="http://localhost:5000/from/env"): - client = AsyncRetellSdk(api_key=api_key, _strict_response_validation=True) + with update_env(RETELL_BASE_URL="http://localhost:5000/from/env"): + client = AsyncRetell(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @pytest.mark.parametrize( "client", [ - AsyncRetellSdk( + AsyncRetell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True ), - AsyncRetellSdk( + AsyncRetell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -1230,7 +1223,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: AsyncRetellSdk) -> None: + def test_base_url_trailing_slash(self, client: AsyncRetell) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1243,10 +1236,10 @@ def test_base_url_trailing_slash(self, client: AsyncRetellSdk) -> None: @pytest.mark.parametrize( "client", [ - AsyncRetellSdk( + AsyncRetell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True ), - AsyncRetellSdk( + AsyncRetell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -1255,7 +1248,7 @@ def test_base_url_trailing_slash(self, client: AsyncRetellSdk) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: AsyncRetellSdk) -> None: + def test_base_url_no_trailing_slash(self, client: AsyncRetell) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1268,10 +1261,10 @@ def test_base_url_no_trailing_slash(self, client: AsyncRetellSdk) -> None: @pytest.mark.parametrize( "client", [ - AsyncRetellSdk( + AsyncRetell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True ), - AsyncRetellSdk( + AsyncRetell( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -1280,7 +1273,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncRetellSdk) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: AsyncRetellSdk) -> None: + def test_absolute_request_url(self, client: AsyncRetell) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1291,7 +1284,7 @@ def test_absolute_request_url(self, client: AsyncRetellSdk) -> None: assert request.url == "https://myapi.com/foo" async def test_copied_client_does_not_close_http(self) -> None: - client = AsyncRetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = AsyncRetell(base_url=base_url, api_key=api_key, _strict_response_validation=True) assert not client.is_closed() copied = client.copy() @@ -1303,7 +1296,7 @@ async def test_copied_client_does_not_close_http(self) -> None: assert not client.is_closed() async def test_client_context_manager(self) -> None: - client = AsyncRetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = AsyncRetell(base_url=base_url, api_key=api_key, _strict_response_validation=True) async with client as c2: assert c2 is client assert not c2.is_closed() @@ -1331,12 +1324,12 @@ class Model(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) - strict_client = AsyncRetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + strict_client = AsyncRetell(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): await strict_client.get("/foo", cast_to=Model) - client = AsyncRetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=False) + client = AsyncRetell(base_url=base_url, api_key=api_key, _strict_response_validation=False) response = await client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] @@ -1364,14 +1357,14 @@ class Model(BaseModel): @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @pytest.mark.asyncio async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = AsyncRetellSdk(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = AsyncRetell(base_url=base_url, api_key=api_key, _strict_response_validation=True) headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("retell_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("retell._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/create-agent").mock(side_effect=httpx.TimeoutException("Test timeout error")) @@ -1386,7 +1379,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) assert _get_open_connections(self.client) == 0 - @mock.patch("retell_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("retell._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/create-agent").mock(return_value=httpx.Response(500)) diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 4ccfabd..629d6c3 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -1,4 +1,4 @@ -from retell_sdk._utils import deepcopy_minimal +from retell._utils import deepcopy_minimal def assert_different_identities(obj1: object, obj2: object) -> None: diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index fde5093..9e76b15 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -4,8 +4,8 @@ import pytest -from retell_sdk._types import FileTypes -from retell_sdk._utils import extract_files +from retell._types import FileTypes +from retell._utils import extract_files def test_removes_files_from_input() -> None: diff --git a/tests/test_files.py b/tests/test_files.py index 4eafdf5..79a810e 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -4,7 +4,7 @@ import pytest from dirty_equals import IsDict, IsList, IsBytes, IsTuple -from retell_sdk._files import to_httpx_files, async_to_httpx_files +from retell._files import to_httpx_files, async_to_httpx_files readme_path = Path(__file__).parent.parent.joinpath("README.md") diff --git a/tests/test_models.py b/tests/test_models.py index b7cd1e9..22dad2b 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -7,9 +7,9 @@ import pydantic from pydantic import Field -from retell_sdk._utils import PropertyInfo -from retell_sdk._compat import PYDANTIC_V2, parse_obj, model_dump, model_json -from retell_sdk._models import BaseModel, construct_type +from retell._utils import PropertyInfo +from retell._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from retell._models import BaseModel, construct_type class BasicModel(BaseModel): diff --git a/tests/test_qs.py b/tests/test_qs.py index 13622b0..1b8d598 100644 --- a/tests/test_qs.py +++ b/tests/test_qs.py @@ -4,7 +4,7 @@ import pytest -from retell_sdk._qs import Querystring, stringify +from retell._qs import Querystring, stringify def test_empty() -> None: diff --git a/tests/test_required_args.py b/tests/test_required_args.py index 723b968..87fdcb0 100644 --- a/tests/test_required_args.py +++ b/tests/test_required_args.py @@ -2,7 +2,7 @@ import pytest -from retell_sdk._utils import required_args +from retell._utils import required_args def test_too_many_positional_params() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index a63c805..eec63ca 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -6,8 +6,8 @@ import pytest import pydantic -from retell_sdk import BaseModel, RetellSdk, AsyncRetellSdk -from retell_sdk._response import ( +from retell import Retell, BaseModel, AsyncRetell +from retell._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, @@ -15,8 +15,8 @@ AsyncBinaryAPIResponse, extract_response_type, ) -from retell_sdk._streaming import Stream -from retell_sdk._base_client import FinalRequestOptions +from retell._streaming import Stream +from retell._base_client import FinalRequestOptions class ConcreteBaseAPIResponse(APIResponse[bytes]): @@ -40,7 +40,7 @@ def test_extract_response_type_direct_classes() -> None: def test_extract_response_type_direct_class_missing_type_arg() -> None: with pytest.raises( RuntimeError, - match="Expected type to have a type argument at index 0 but it did not", + match="Expected type to have a type argument at index 0 but it did not", ): extract_response_type(AsyncAPIResponse) @@ -60,7 +60,7 @@ class PydanticModel(pydantic.BaseModel): ... -def test_response_parse_mismatched_basemodel(client: RetellSdk) -> None: +def test_response_parse_mismatched_basemodel(client: Retell) -> None: response = APIResponse( raw=httpx.Response(200, content=b"foo"), client=client, @@ -72,13 +72,13 @@ def test_response_parse_mismatched_basemodel(client: RetellSdk) -> None: with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from retell_sdk import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from retell import BaseModel`", ): response.parse(to=PydanticModel) @pytest.mark.asyncio -async def test_async_response_parse_mismatched_basemodel(async_client: AsyncRetellSdk) -> None: +async def test_async_response_parse_mismatched_basemodel(async_client: AsyncRetell) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=b"foo"), client=async_client, @@ -90,12 +90,12 @@ async def test_async_response_parse_mismatched_basemodel(async_client: AsyncRete with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from retell_sdk import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from retell import BaseModel`", ): await response.parse(to=PydanticModel) -def test_response_parse_custom_stream(client: RetellSdk) -> None: +def test_response_parse_custom_stream(client: Retell) -> None: response = APIResponse( raw=httpx.Response(200, content=b"foo"), client=client, @@ -110,7 +110,7 @@ def test_response_parse_custom_stream(client: RetellSdk) -> None: @pytest.mark.asyncio -async def test_async_response_parse_custom_stream(async_client: AsyncRetellSdk) -> None: +async def test_async_response_parse_custom_stream(async_client: AsyncRetell) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=b"foo"), client=async_client, @@ -129,7 +129,7 @@ class CustomModel(BaseModel): bar: int -def test_response_parse_custom_model(client: RetellSdk) -> None: +def test_response_parse_custom_model(client: Retell) -> None: response = APIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=client, @@ -145,7 +145,7 @@ def test_response_parse_custom_model(client: RetellSdk) -> None: @pytest.mark.asyncio -async def test_async_response_parse_custom_model(async_client: AsyncRetellSdk) -> None: +async def test_async_response_parse_custom_model(async_client: AsyncRetell) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=async_client, @@ -160,7 +160,7 @@ async def test_async_response_parse_custom_model(async_client: AsyncRetellSdk) - assert obj.bar == 2 -def test_response_parse_annotated_type(client: RetellSdk) -> None: +def test_response_parse_annotated_type(client: Retell) -> None: response = APIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=client, @@ -177,7 +177,7 @@ def test_response_parse_annotated_type(client: RetellSdk) -> None: assert obj.bar == 2 -async def test_async_response_parse_annotated_type(async_client: AsyncRetellSdk) -> None: +async def test_async_response_parse_annotated_type(async_client: AsyncRetell) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=async_client, diff --git a/tests/test_streaming.py b/tests/test_streaming.py index bc9e2b0..6a80ee6 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -2,7 +2,7 @@ import pytest -from retell_sdk._streaming import SSEDecoder +from retell._streaming import SSEDecoder @pytest.mark.asyncio diff --git a/tests/test_transform.py b/tests/test_transform.py index 6f95b0d..2bdb76c 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,15 +8,15 @@ import pytest -from retell_sdk._types import Base64FileInput -from retell_sdk._utils import ( +from retell._types import Base64FileInput +from retell._utils import ( PropertyInfo, transform as _transform, parse_datetime, async_transform as _async_transform, ) -from retell_sdk._compat import PYDANTIC_V2 -from retell_sdk._models import BaseModel +from retell._compat import PYDANTIC_V2 +from retell._models import BaseModel _T = TypeVar("_T") diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 44b967a..de63e6a 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -2,7 +2,7 @@ from typing import Any from typing_extensions import override -from retell_sdk._utils import LazyProxy +from retell._utils import LazyProxy class RecursiveLazyProxy(LazyProxy[Any]): diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index 585e49a..7e21117 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -2,7 +2,7 @@ from typing import Generic, TypeVar, cast -from retell_sdk._utils import extract_type_var_from_base +from retell._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") diff --git a/tests/utils.py b/tests/utils.py index 0370cce..6d048cb 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,8 +8,8 @@ from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type -from retell_sdk._types import NoneType -from retell_sdk._utils import ( +from retell._types import NoneType +from retell._utils import ( is_dict, is_list, is_list_type, @@ -17,8 +17,8 @@ extract_type_arg, is_annotated_type, ) -from retell_sdk._compat import PYDANTIC_V2, field_outer_type, get_model_fields -from retell_sdk._models import BaseModel +from retell._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from retell._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel)