diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c5aa11..98cf5d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,106 @@ Full Changelog: [v0.2.0...v0.2.0](https://github.com/dedalus-labs/dedalus-sdk-py * structured outputs for tools ([b0434ca](https://github.com/dedalus-labs/dedalus-sdk-python/commit/b0434ca32e43dc5ef254e3fecb5493a2d3896384)) +### Bug Fixes + +* **api:** add shared DedalusModel type ([8855a07](https://github.com/dedalus-labs/dedalus-sdk-python/commit/8855a07e4ea638102e71a049e182891e76e3d34d)) +* **api:** add thought signature ([d2203b1](https://github.com/dedalus-labs/dedalus-sdk-python/commit/d2203b129e6b64bbae0b1966654723c2f1ca1159)) +* **api:** docstring truncation ([699f8b9](https://github.com/dedalus-labs/dedalus-sdk-python/commit/699f8b962472ddb4ff2514cc1e515f76ccae5c21)) +* **api:** hardened _compat types ([312b628](https://github.com/dedalus-labs/dedalus-sdk-python/commit/312b628b48d15aaae5b4d2765a75d2b6b830e318)) +* **api:** improve types ([e3a3293](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e3a32933f4d8a568502dc6896ec6ea4ef9054bf4)) +* **api:** mcp credential types ([3cdef11](https://github.com/dedalus-labs/dedalus-sdk-python/commit/3cdef112c7f647bcdcca903be56cf89115d47c0a)) +* **api:** relocate parts of auth logic ([a0d8615](https://github.com/dedalus-labs/dedalus-sdk-python/commit/a0d8615f237331f8b79012e9cb5991dc929711d1)) +* **api:** standardize to use automatic_tool_execution ([731f753](https://github.com/dedalus-labs/dedalus-sdk-python/commit/731f753421de4a90b775fff8bee210d3aaf29a21)) +* **api:** syntactical sugar for json types ([6908b05](https://github.com/dedalus-labs/dedalus-sdk-python/commit/6908b05580ce26b04590170dd24ccef0196cb900)) +* **api:** syntactical sugar for json types ([#37](https://github.com/dedalus-labs/dedalus-sdk-python/issues/37)) ([8f29baf](https://github.com/dedalus-labs/dedalus-sdk-python/commit/8f29baf09cc732459f2d14335e39caa0084513c9)) +* **api:** typed json objects ([db161b2](https://github.com/dedalus-labs/dedalus-sdk-python/commit/db161b27ca2608d08a915323ced9d76fab6263bb)) +* **api:** typed json objects ([6dbc75d](https://github.com/dedalus-labs/dedalus-sdk-python/commit/6dbc75dc331cd2542e19aa7d2cc530dd091d7e65)) +* **api:** update types/docstrings ([8c0b864](https://github.com/dedalus-labs/dedalus-sdk-python/commit/8c0b864a31673bdd62166eaffcceb911166054d3)) +* **client:** close streams without requiring full consumption ([24c4190](https://github.com/dedalus-labs/dedalus-sdk-python/commit/24c4190ccb71d2c369b3d79f5764be31f2e8ead7)) +* compat with Python 3.14 ([aacb192](https://github.com/dedalus-labs/dedalus-sdk-python/commit/aacb192910f8bdd09625f098874cf54d3c0c0971)) +* **compat:** update signatures of `model_dump` and `model_dump_json` for Pydantic v1 ([bd1df12](https://github.com/dedalus-labs/dedalus-sdk-python/commit/bd1df12d6c26ad35101bd7b181f33ee8f7fe75ce)) +* ensure streams are always closed ([e0e6406](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e0e6406dc5faeaae21286324d4d247e2706481e1)) +* import paths and tests ([70c967f](https://github.com/dedalus-labs/dedalus-sdk-python/commit/70c967f97d9479307128d6215731a8296bf3fa18)) +* mcp auth types ([7eca858](https://github.com/dedalus-labs/dedalus-sdk-python/commit/7eca858a6967eb789ef1282b28ec63971c2975dd)) +* remove rootmodel hack ([6bae04e](https://github.com/dedalus-labs/dedalus-sdk-python/commit/6bae04eacd8f4ccd87dfbaf57223147ff6f2896e)) +* runner tool calling mechanics ([a07f8eb](https://github.com/dedalus-labs/dedalus-sdk-python/commit/a07f8ebd7d65d9a054bba7838443da90f396762d)) +* **runner:** import and dict issues ([fd500d6](https://github.com/dedalus-labs/dedalus-sdk-python/commit/fd500d6c9ba7c503bfecbf7a3c53b8eaef149d59)) +* **runner:** narrow mcp types ([172b56b](https://github.com/dedalus-labs/dedalus-sdk-python/commit/172b56b0ff518004f1bfb65fd0c28dca3215b026)) +* **runner:** use TypeAlias from typing_extensions for py3.9+ support ([0625b2c](https://github.com/dedalus-labs/dedalus-sdk-python/commit/0625b2c9cd7569140fb81848b9d77bbbfbe256b9)) +* **streaming:** correct stream type detection ([7b6576c](https://github.com/dedalus-labs/dedalus-sdk-python/commit/7b6576c23400bca2420e6782defa633b0f3dbff9)) +* **tests:** update bug reporting parameters/paths ([3838ebe](https://github.com/dedalus-labs/dedalus-sdk-python/commit/3838ebe4db440a852c233cd2a96c2b7a4f0c4082)) +* tool call format and custom_auth validation ([b822aa2](https://github.com/dedalus-labs/dedalus-sdk-python/commit/b822aa214cbf0f735c4480a156639888a80956b1)) +* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([624e2b6](https://github.com/dedalus-labs/dedalus-sdk-python/commit/624e2b67c3b784d64548fb6a3ebde7283b593279)) +* **types:** remove manual DedalusModel ([e1ce236](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e1ce236b931b0715b9fa280ef329bfa451eb05c1)) +* use async_to_httpx_files in patch method ([056ef78](https://github.com/dedalus-labs/dedalus-sdk-python/commit/056ef7802bda00b3037af8d745776e4aa836ba8c)) +* use typealiastype to prevent recursive type issues ([0aeaf80](https://github.com/dedalus-labs/dedalus-sdk-python/commit/0aeaf80d4b51a28a60dbb9f7527e46c5881bd837)) + + +### Chores + +* add missing docstrings ([52ded59](https://github.com/dedalus-labs/dedalus-sdk-python/commit/52ded5987a0cd141499157a3bf9804fe342e5494)) +* **api:** point local dev to 4010 port for prism ([ad0ec37](https://github.com/dedalus-labs/dedalus-sdk-python/commit/ad0ec3766423c5e6374a96afe55bf415a9c2792c)) +* **api:** rename MCPToolExecution -> MCPToolResult ([973611a](https://github.com/dedalus-labs/dedalus-sdk-python/commit/973611a9f411002a00f5b703b30d44c3b2de450a)) +* **auth:** add minor auth params ([c39bcfc](https://github.com/dedalus-labs/dedalus-sdk-python/commit/c39bcfc6366411658cc12e81b5f473176a26fad3)) +* bump `httpx-aiohttp` version to 0.1.9 ([6b5f606](https://github.com/dedalus-labs/dedalus-sdk-python/commit/6b5f60653d76bfe6b4a85d841f115d59c5eba976)) +* bump required `uv` version ([cb3f674](https://github.com/dedalus-labs/dedalus-sdk-python/commit/cb3f674dbc9f6392493de7984bcd5fee385adfa0)) +* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([cb4d323](https://github.com/dedalus-labs/dedalus-sdk-python/commit/cb4d3232c845b60eeccd23efa06057c8408085f5)) +* **docs:** use environment variables for authentication in code snippets ([e4330c0](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e4330c0db0f371c49f320ffb6f8238da0229f890)) +* **internal/tests:** avoid race condition with implicit client cleanup ([0854f1d](https://github.com/dedalus-labs/dedalus-sdk-python/commit/0854f1d8f52ad5d75c2da1781358f96543793c02)) +* **internal:** add `--fix` argument to lint script ([b25908b](https://github.com/dedalus-labs/dedalus-sdk-python/commit/b25908bef7007756e7596fda321ab986366f39dc)) +* **internal:** add missing files argument to base client ([f3a6008](https://github.com/dedalus-labs/dedalus-sdk-python/commit/f3a60083b1a37c3bb798e8c07b97af5f04c16b0d)) +* **internal:** avoid using unstable Python versions in tests ([5905b55](https://github.com/dedalus-labs/dedalus-sdk-python/commit/5905b553aaacf8ef4512d851d68b0e0eb7bc647c)) +* **internal:** codegen related update ([d288b0b](https://github.com/dedalus-labs/dedalus-sdk-python/commit/d288b0b4f8098c0aab0d79d45f27fd7b7cd8d127)) +* **internal:** detect missing future annotations with ruff ([6909c09](https://github.com/dedalus-labs/dedalus-sdk-python/commit/6909c09996be7fe019ec6737a18b7e330b325c4a)) +* **internal:** grammar fix (it's -> its) ([f0c5880](https://github.com/dedalus-labs/dedalus-sdk-python/commit/f0c58800e495c0cd5c1f13a9799e8e2025154a1c)) +* **package:** drop Python 3.8 support ([ef5e794](https://github.com/dedalus-labs/dedalus-sdk-python/commit/ef5e794d49c800706eeb693170ea4a3ac0245290)) +* remove custom code ([81f922b](https://github.com/dedalus-labs/dedalus-sdk-python/commit/81f922b8eabc571abf4cfd1b87e08517b4564128)) +* **repo:** update contributing doc and mock test script ([fd52f5a](https://github.com/dedalus-labs/dedalus-sdk-python/commit/fd52f5acd095279bd26d647ee3f93c2daf7977df)) +* tidy protocol docstrings ([99c65f6](https://github.com/dedalus-labs/dedalus-sdk-python/commit/99c65f6f3f89f1958a94f5aaa0daf9511aafbcd1)) +* tidying ([354f95b](https://github.com/dedalus-labs/dedalus-sdk-python/commit/354f95b1efde6b3df27275b3b8a36510f28d1858)) +* update lockfile ([46f1379](https://github.com/dedalus-labs/dedalus-sdk-python/commit/46f13790651a2c284d50c414556fee925c7ff089)) + + +### Refactors + +* **api:** types for mcp server serialization ([2f614ca](https://github.com/dedalus-labs/dedalus-sdk-python/commit/2f614ca5493c9d57807aea9105e77a66c4703130)) +* **api:** update auth types ([9b17190](https://github.com/dedalus-labs/dedalus-sdk-python/commit/9b17190b28400652ccbdb3f60499a163168e0b80)) +* **api:** update types ([584fe2a](https://github.com/dedalus-labs/dedalus-sdk-python/commit/584fe2aa544ce99955d1d0a712cb51267e06357d)) + +## 0.2.0 (2025-12-19) + +Full Changelog: [v0.2.0...v0.2.0](https://github.com/dedalus-labs/dedalus-sdk-python/compare/v0.2.0...v0.2.0) + +### Features + +* add image edits/variation and vision format support ([f8a8c84](https://github.com/dedalus-labs/dedalus-sdk-python/commit/f8a8c84f3379d92619de56929d6ad3048989b18c)) +* **api:** add endpoints ([c10d7b5](https://github.com/dedalus-labs/dedalus-sdk-python/commit/c10d7b55a8ec6bb82556b3efe4db20c91959131d)) +* **api:** add streaming ([745c331](https://github.com/dedalus-labs/dedalus-sdk-python/commit/745c33166a671b79a978961d576064618cc80bcb)) +* **api:** add streaming configuration ([0172ad5](https://github.com/dedalus-labs/dedalus-sdk-python/commit/0172ad5175dd15650252a084f213b16c56b8befc)) +* **api:** api update ([280a595](https://github.com/dedalus-labs/dedalus-sdk-python/commit/280a595b3d3900625cfdf26be12027a88eff9618)) +* **api:** auto exec tools ([780162b](https://github.com/dedalus-labs/dedalus-sdk-python/commit/780162b01d27703bb873488702ebede232791ed2)) +* **api:** config update for dedalus-ai/dev ([34e7a71](https://github.com/dedalus-labs/dedalus-sdk-python/commit/34e7a7167f6db94bb7c8c10a7c11746656aec5a6)) +* **api:** config update for dedalus-ai/dev ([197d11b](https://github.com/dedalus-labs/dedalus-sdk-python/commit/197d11bf57da500e05cde2861146da9e3ec278f3)) +* **api:** convenient bug reporting ux ([5aa032f](https://github.com/dedalus-labs/dedalus-sdk-python/commit/5aa032f24a9fe44d23cfbf83f12fc79104529c8d)) +* **api:** image support ([ca28133](https://github.com/dedalus-labs/dedalus-sdk-python/commit/ca281334db05ac2e939436050d1cf70ca5359ab4)) +* **api:** improve types ([62cf7e1](https://github.com/dedalus-labs/dedalus-sdk-python/commit/62cf7e1a643cda58ee5112a1a8fc35253fe50f07)) +* **api:** manual updates ([9bb6d0d](https://github.com/dedalus-labs/dedalus-sdk-python/commit/9bb6d0d0433111d177410f7ff21d3de254d899a0)) +* **api:** manual updates ([9b2851a](https://github.com/dedalus-labs/dedalus-sdk-python/commit/9b2851a6bdbf861c0db0b01aa3e7a8f5a45bfa77)) +* **api:** mcp server params ([bf78aad](https://github.com/dedalus-labs/dedalus-sdk-python/commit/bf78aad94d159622460b3a9ecddb9c5d1e1c82bb)) +* **api:** messages param nullable ([e905235](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e9052357b7efa9d49b4f8b8d4c7dfc026d69414b)) +* **api:** response format ([660ac29](https://github.com/dedalus-labs/dedalus-sdk-python/commit/660ac2954efc08eaed5212da934203b5b80f522e)) +* **api:** revert streaming for now ([56d57d5](https://github.com/dedalus-labs/dedalus-sdk-python/commit/56d57d5a19034eec13d5a98a86d133d36ac2830a)) +* **api:** schema compiler landed ([9aeb7a7](https://github.com/dedalus-labs/dedalus-sdk-python/commit/9aeb7a78bfaa81c07e920268afcacbba4a4ff9c9)) +* **api:** standardize name casing with stainless initialism ([ba1e188](https://github.com/dedalus-labs/dedalus-sdk-python/commit/ba1e188beb62f6def79720d7d2ec8e22853fadaf)) +* **api:** stream helper for pydantic ([c4ab8b0](https://github.com/dedalus-labs/dedalus-sdk-python/commit/c4ab8b0d911b92afe76de99143567e6898e9e95c)) +* **api:** streaming support for structured output ([48ddd0a](https://github.com/dedalus-labs/dedalus-sdk-python/commit/48ddd0a996e99b65fb4635f276a5562ef567ed26)) +* **api:** update via SDK Studio ([9407b44](https://github.com/dedalus-labs/dedalus-sdk-python/commit/9407b44fa8dbd4df7c18c36eab95a5573399810a)) +* **client:** support file upload requests ([caadecd](https://github.com/dedalus-labs/dedalus-sdk-python/commit/caadecdf5c75297819cd41fe3adcc5f7af3de772)) +* encryption ([d72d130](https://github.com/dedalus-labs/dedalus-sdk-python/commit/d72d130279b78fb4f946199a003032001b9c162e)) +* flexible input params for .parse() ([b208fbe](https://github.com/dedalus-labs/dedalus-sdk-python/commit/b208fbed8300526b323ac7c935d6d50bb652f0d3)) +* structured outputs for tools ([b0434ca](https://github.com/dedalus-labs/dedalus-sdk-python/commit/b0434ca32e43dc5ef254e3fecb5493a2d3896384)) + + ### Bug Fixes * **api:** add shared DedalusModel type ([8855a07](https://github.com/dedalus-labs/dedalus-sdk-python/commit/8855a07e4ea638102e71a049e182891e76e3d34d)) diff --git a/pyproject.toml b/pyproject.toml index 6b1b303..6cf32bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,14 @@ version = "0.2.0" description = "The official Python library for the Dedalus API" dynamic = ["readme"] license = "MIT" -authors = [{ name = "Dedalus Labs", email = "oss@dedaluslabs.ai" }] +authors = [ +{ name = "Dedalus Labs", email = "founders@dedaluslabs.ai" } +] dependencies = [ "httpx>=0.23.0, <1", "pydantic>=1.9.0, <3", - "typing-extensions>=4.11, <5", + "typing-extensions>=4.10, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", @@ -32,7 +34,7 @@ classifiers = [ "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", "Topic :: Software Development :: Libraries :: Python Modules", - "License :: OSI Approved :: MIT License", + "License :: OSI Approved :: MIT License" ] [project.urls] @@ -48,7 +50,12 @@ auth = [ [tool.uv] managed = true required-version = ">=0.9" -conflicts = [[{ group = "pydantic-v1" }, { group = "pydantic-v2" }]] +conflicts = [ + [ + { group = "pydantic-v1" }, + { group = "pydantic-v2" }, + ], +] [dependency-groups] # version pins are in uv.lock @@ -76,7 +83,9 @@ requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] build-backend = "hatchling.build" [tool.hatch.build] -include = ["src/*"] +include = [ + "src/*" +] [tool.hatch.build.targets.wheel] packages = ["src/dedalus_labs"] @@ -113,7 +122,9 @@ addopts = "--tb=short -n auto" xfail_strict = true asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "session" -filterwarnings = ["error"] +filterwarnings = [ + "error" +] [tool.pyright] # this enables practically every flag given by pyright. @@ -122,7 +133,12 @@ filterwarnings = ["error"] typeCheckingMode = "strict" pythonVersion = "3.9" -exclude = ["_dev", ".venv", ".nox", ".git"] +exclude = [ + "_dev", + ".venv", + ".nox", + ".git", +] reportImplicitOverride = true reportOverlappingOverload = false diff --git a/scripts/mock b/scripts/mock index 8bb86e5..0b28f6e 100755 --- a/scripts/mock +++ b/scripts/mock @@ -17,18 +17,11 @@ if [ -z "$URL" ]; then exit 1 fi -# Prefer bunx (bun) over npx (npm) -if command -v bunx &> /dev/null; then - EXEC_CMD="bunx @stainless-api/prism-cli@5.15.0 prism" -else - EXEC_CMD="npx @stainless-api/prism-cli@5.15.0 prism" -fi - echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - $EXEC_CMD mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -44,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - $EXEC_CMD mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi diff --git a/src/dedalus_labs/_client.py b/src/dedalus_labs/_client.py index 1e64d82..3954b65 100644 --- a/src/dedalus_labs/_client.py +++ b/src/dedalus_labs/_client.py @@ -42,20 +42,20 @@ from .resources.audio.audio import AudioResource, AsyncAudioResource __all__ = [ - "ENVIRONMENTS", - "Timeout", - "Transport", - "ProxiesTypes", - "RequestOptions", - "Dedalus", - "AsyncDedalus", - "Client", - "AsyncClient", + 'ENVIRONMENTS', + 'Timeout', + 'Transport', + 'ProxiesTypes', + 'RequestOptions', + 'Dedalus', + 'AsyncDedalus', + 'Client', + 'AsyncClient', ] ENVIRONMENTS: Dict[str, str] = { - "production": "https://api.dedaluslabs.ai", - "development": "http://localhost:4010", + 'production': 'https://api.dedaluslabs.ai', + 'development': 'http://localhost:4010', } @@ -69,7 +69,7 @@ class Dedalus(SyncAPIClient): provider_key: str | None provider_model: str | None - _environment: Literal["production", "development"] | NotGiven + _environment: Literal['production', 'development'] | NotGiven def __init__( self, @@ -81,7 +81,7 @@ def __init__( provider: str | None = None, provider_key: str | None = None, provider_model: str | None = None, - environment: Literal["production", "development"] | NotGiven = not_given, + environment: Literal['production', 'development'] | NotGiven = not_given, base_url: str | httpx.URL | None | NotGiven = not_given, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, @@ -121,7 +121,7 @@ def __init__( self.x_api_key = x_api_key if as_base_url is None: - as_base_url = os.environ.get("DEDALUS_AS_URL") + as_base_url = os.environ.get('DEDALUS_AS_URL') self.as_base_url = as_base_url if dedalus_org_id is None: @@ -142,29 +142,29 @@ def __init__( self._environment = environment - base_url_env = os.environ.get("DEDALUS_BASE_URL") + base_url_env = os.environ.get('DEDALUS_BASE_URL') if is_given(base_url) and base_url is not None: # cast required because mypy doesn't understand the type narrowing - base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast] + base_url = cast('str | httpx.URL', base_url) # pyright: ignore[reportUnnecessaryCast] elif is_given(environment): if base_url_env and base_url is not None: raise ValueError( - "Ambiguous URL; The `DEDALUS_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None", + 'Ambiguous URL; The `DEDALUS_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None', ) try: base_url = ENVIRONMENTS[environment] except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc + raise ValueError(f'Unknown environment: {environment}') from exc elif base_url_env is not None: base_url = base_url_env else: - self._environment = environment = "production" + self._environment = environment = 'production' try: base_url = ENVIRONMENTS[environment] except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc + raise ValueError(f'Unknown environment: {environment}') from exc super().__init__( version=__version__, @@ -277,7 +277,7 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: return raise TypeError( - '"Could not resolve authentication method. Expected either api_key or x_api_key to be set. Or for one of the `Authorization` or `x-api-key` headers to be explicitly omitted"' + 'Could not resolve authentication method. Expected either api_key or x_api_key to be set. Or for one of the `Authorization` or `x-api-key` headers to be explicitly omitted' ) def copy( @@ -290,7 +290,7 @@ def copy( provider: str | None = None, provider_key: str | None = None, provider_model: str | None = None, - environment: Literal["production", "development"] | None = None, + environment: Literal['production', 'development'] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, @@ -401,7 +401,7 @@ class AsyncDedalus(AsyncAPIClient): provider_key: str | None provider_model: str | None - _environment: Literal["production", "development"] | NotGiven + _environment: Literal['production', 'development'] | NotGiven def __init__( self, @@ -413,7 +413,7 @@ def __init__( provider: str | None = None, provider_key: str | None = None, provider_model: str | None = None, - environment: Literal["production", "development"] | NotGiven = not_given, + environment: Literal['production', 'development'] | NotGiven = not_given, base_url: str | httpx.URL | None | NotGiven = not_given, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, @@ -453,7 +453,7 @@ def __init__( self.x_api_key = x_api_key if as_base_url is None: - as_base_url = os.environ.get("DEDALUS_AS_URL") + as_base_url = os.environ.get('DEDALUS_AS_URL') self.as_base_url = as_base_url if dedalus_org_id is None: @@ -474,29 +474,29 @@ def __init__( self._environment = environment - base_url_env = os.environ.get("DEDALUS_BASE_URL") + base_url_env = os.environ.get('DEDALUS_BASE_URL') if is_given(base_url) and base_url is not None: # cast required because mypy doesn't understand the type narrowing - base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast] + base_url = cast('str | httpx.URL', base_url) # pyright: ignore[reportUnnecessaryCast] elif is_given(environment): if base_url_env and base_url is not None: raise ValueError( - "Ambiguous URL; The `DEDALUS_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None", + 'Ambiguous URL; The `DEDALUS_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None', ) try: base_url = ENVIRONMENTS[environment] except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc + raise ValueError(f'Unknown environment: {environment}') from exc elif base_url_env is not None: base_url = base_url_env else: - self._environment = environment = "production" + self._environment = environment = 'production' try: base_url = ENVIRONMENTS[environment] except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc + raise ValueError(f'Unknown environment: {environment}') from exc super().__init__( version=__version__, @@ -609,7 +609,7 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: return raise TypeError( - '"Could not resolve authentication method. Expected either api_key or x_api_key to be set. Or for one of the `Authorization` or `x-api-key` headers to be explicitly omitted"' + 'Could not resolve authentication method. Expected either api_key or x_api_key to be set. Or for one of the `Authorization` or `x-api-key` headers to be explicitly omitted' ) def copy( @@ -622,7 +622,7 @@ def copy( provider: str | None = None, provider_key: str | None = None, provider_model: str | None = None, - environment: Literal["production", "development"] | None = None, + environment: Literal['production', 'development'] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, diff --git a/src/dedalus_labs/lib/streaming/chat/_completions.py b/src/dedalus_labs/lib/streaming/chat/_completions.py index b831b97..1d1486e 100644 --- a/src/dedalus_labs/lib/streaming/chat/_completions.py +++ b/src/dedalus_labs/lib/streaming/chat/_completions.py @@ -37,9 +37,8 @@ parse_function_tool_arguments, ) from ...._streaming import Stream, AsyncStream -from ....types.chat.chat_completion_chunk import ChatCompletionChunk, Choice as ChoiceChunk +from ....types.chat.chat_completion_chunk import ChatCompletionChunk, Choice as ChoiceChunk, ChoiceLogprobs from ....types.chat.parsed_chat_completion import ParsedChatCompletion -from ....types.chat.choice_logprobs import ChoiceLogprobs InputTool = Dict[str, Any] diff --git a/src/dedalus_labs/types/chat/parsed_chat_completion.py b/src/dedalus_labs/types/chat/parsed_chat_completion.py index 42cdcf8..38ae7eb 100644 --- a/src/dedalus_labs/types/chat/parsed_chat_completion.py +++ b/src/dedalus_labs/types/chat/parsed_chat_completion.py @@ -2,9 +2,8 @@ from typing import List, Generic, TypeVar, Optional -from .choice import Choice from ..._models import GenericModel -from .chat_completion import ChatCompletion +from .chat_completion import ChatCompletion, Choice from .chat_completion_message import ChatCompletionMessage from .parsed_function_tool_call import ParsedFunctionToolCall diff --git a/src/dedalus_labs/types/chat/parsed_function_tool_call.py b/src/dedalus_labs/types/chat/parsed_function_tool_call.py index 18b0b2c..f2fef19 100644 --- a/src/dedalus_labs/types/chat/parsed_function_tool_call.py +++ b/src/dedalus_labs/types/chat/parsed_function_tool_call.py @@ -2,8 +2,7 @@ from typing import Optional -from .function import Function -from .chat_completion_message_tool_call import ChatCompletionMessageToolCall as FunctionToolCall +from .chat_completion_message_tool_call import ChatCompletionMessageToolCall as FunctionToolCall, Function __all__ = ["ParsedFunctionToolCall", "ParsedFunction"] diff --git a/src/dedalus_labs/types/shared/__init__.py b/src/dedalus_labs/types/shared/__init__.py index f966ee9..4b8aec8 100644 --- a/src/dedalus_labs/types/shared/__init__.py +++ b/src/dedalus_labs/types/shared/__init__.py @@ -2,8 +2,6 @@ from .reasoning import Reasoning as Reasoning from .credential import Credential as Credential -from .json_value_input import JSONValueInput as JSONValueInput -from .json_object_input import JSONObjectInput as JSONObjectInput from .mcp_servers import MCPServers as MCPServers from .tool_choice import ToolChoice as ToolChoice from .dedalus_model import DedalusModel as DedalusModel @@ -11,8 +9,6 @@ from .mcp_credentials import MCPCredentials as MCPCredentials from .mcp_server_spec import MCPServerSpec as MCPServerSpec from .mcp_tool_result import MCPToolResult as MCPToolResult -from .json_value_output import JSONValueOutput as JSONValueOutput -from .json_object_output import JSONObjectOutput as JSONObjectOutput from .function_definition import FunctionDefinition as FunctionDefinition from .dedalus_model_choice import DedalusModelChoice as DedalusModelChoice from .response_format_text import ResponseFormatText as ResponseFormatText diff --git a/src/dedalus_labs/types/shared/json_object_input.py b/src/dedalus_labs/types/shared/json_object_input.py deleted file mode 100644 index 45ab301..0000000 --- a/src/dedalus_labs/types/shared/json_object_input.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import TypeAliasType - -from .json_value_input import JSONValueInput - -__all__ = ["JSONObjectInput"] - -JSONObjectInput = TypeAliasType( - "JSONObjectInput", - Dict[str, Optional[JSONValueInput]], -) diff --git a/src/dedalus_labs/types/shared/json_object_output.py b/src/dedalus_labs/types/shared/json_object_output.py deleted file mode 100644 index ae913b3..0000000 --- a/src/dedalus_labs/types/shared/json_object_output.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import TypeAliasType - -from .json_value_output import JSONValueOutput - -__all__ = ["JSONObjectOutput"] - -JSONObjectOutput = TypeAliasType( - "JSONObjectOutput", - Dict[str, Optional[JSONValueOutput]], -) diff --git a/src/dedalus_labs/types/shared/json_value_input.py b/src/dedalus_labs/types/shared/json_value_input.py deleted file mode 100644 index cfd22c6..0000000 --- a/src/dedalus_labs/types/shared/json_value_input.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, List, Union, Optional -from typing_extensions import TypeAliasType - -__all__ = ["JSONValueInput"] - -JSONValueInput = TypeAliasType( - "JSONValueInput", - Union[str, float, bool, Dict[str, Optional["JSONValueInput"]], List[Optional["JSONValueInput"]], None], -) diff --git a/src/dedalus_labs/types/shared/json_value_output.py b/src/dedalus_labs/types/shared/json_value_output.py deleted file mode 100644 index a20ba69..0000000 --- a/src/dedalus_labs/types/shared/json_value_output.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, List, Union, Optional -from typing_extensions import TypeAliasType - -__all__ = ["JSONValueOutput"] - -JSONValueOutput = TypeAliasType( - "JSONValueOutput", - Union[str, float, bool, Dict[str, Optional["JSONValueOutput"]], List[Optional["JSONValueOutput"]], None], -) diff --git a/src/dedalus_labs/types/shared_params/__init__.py b/src/dedalus_labs/types/shared_params/__init__.py index ceda706..81370b6 100644 --- a/src/dedalus_labs/types/shared_params/__init__.py +++ b/src/dedalus_labs/types/shared_params/__init__.py @@ -8,8 +8,6 @@ from .model_settings import ModelSettings as ModelSettings from .mcp_credentials import MCPCredentials as MCPCredentials from .mcp_server_spec import MCPServerSpec as MCPServerSpec -from .json_value_input import JSONValueInput as JSONValueInput -from .json_object_input import JSONObjectInput as JSONObjectInput from .function_definition import FunctionDefinition as FunctionDefinition from .dedalus_model_choice import DedalusModelChoice as DedalusModelChoice from .response_format_text import ResponseFormatText as ResponseFormatText diff --git a/src/dedalus_labs/types/shared_params/json_object_input.py b/src/dedalus_labs/types/shared_params/json_object_input.py deleted file mode 100644 index 45ab301..0000000 --- a/src/dedalus_labs/types/shared_params/json_object_input.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import TypeAliasType - -from .json_value_input import JSONValueInput - -__all__ = ["JSONObjectInput"] - -JSONObjectInput = TypeAliasType( - "JSONObjectInput", - Dict[str, Optional[JSONValueInput]], -) diff --git a/src/dedalus_labs/types/shared_params/json_value_input.py b/src/dedalus_labs/types/shared_params/json_value_input.py deleted file mode 100644 index cfd22c6..0000000 --- a/src/dedalus_labs/types/shared_params/json_value_input.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, List, Union, Optional -from typing_extensions import TypeAliasType - -__all__ = ["JSONValueInput"] - -JSONValueInput = TypeAliasType( - "JSONValueInput", - Union[str, float, bool, Dict[str, Optional["JSONValueInput"]], List[Optional["JSONValueInput"]], None], -)