Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand All @@ -17,7 +19,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/dedalus-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6

Expand All @@ -33,7 +35,7 @@ jobs:
run: ./scripts/lint

build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
timeout-minutes: 10
name: build
permissions:
Expand All @@ -55,14 +57,18 @@ jobs:
run: uv build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/dedalus-sdk-python'
if: |-
github.repository == 'stainless-sdks/dedalus-sdk-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/dedalus-sdk-python'
if: |-
github.repository == 'stainless-sdks/dedalus-sdk-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/release-doctor.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.stdy.log
_dev

__pycache__
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.3.0"
".": "0.4.0"
}
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Changelog

## 0.4.0 (2026-04-17)

Full Changelog: [v0.3.0...v0.4.0](https://github.com/dedalus-labs/dedalus-sdk-python/compare/v0.3.0...v0.4.0)

### Features

* **internal:** implement indices array format for query and form serialization ([04ba964](https://github.com/dedalus-labs/dedalus-sdk-python/commit/04ba9644e8c73b3eff7b8ad01211d90e354a889d))


### Bug Fixes

* **client:** preserve hardcoded query params when merging with user params ([80f3981](https://github.com/dedalus-labs/dedalus-sdk-python/commit/80f3981cb6e10bd7a9dbe39412abbd6277b0ab64))
* **deps:** bump minimum typing-extensions version ([23ea212](https://github.com/dedalus-labs/dedalus-sdk-python/commit/23ea21291b2cf443c594661acfc6e19e95077162))
* ensure file data are only sent as 1 parameter ([721e574](https://github.com/dedalus-labs/dedalus-sdk-python/commit/721e5748d4843fe0f6dbf07c34766550d09ab05e))
* **pydantic:** do not pass `by_alias` unless set ([b098b05](https://github.com/dedalus-labs/dedalus-sdk-python/commit/b098b05e30ec6487a6467bd928ce3c725d3f2aa0))
* sanitize endpoint path params ([e385e21](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e385e215a38c3141ff675a58799511a306d2c879))


### Performance Improvements

* **client:** optimize file structure copying in multipart requests ([43970d6](https://github.com/dedalus-labs/dedalus-sdk-python/commit/43970d6a440ff547be0c90130b75b7483ad7711e))


### Chores

* **ci:** remove release-doctor workflow ([5903593](https://github.com/dedalus-labs/dedalus-sdk-python/commit/5903593748f7cf140310fb0fe057879323e12d67))
* **ci:** skip lint on metadata-only changes ([e11e58f](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e11e58faac2c22be4f6e642b7313d09286b4a651))
* **ci:** skip uploading artifacts on stainless-internal branches ([e3ed836](https://github.com/dedalus-labs/dedalus-sdk-python/commit/e3ed83614aa445a6af6d48fbab67edd96d651123))
* **internal:** tweak CI branches ([1fc1ee4](https://github.com/dedalus-labs/dedalus-sdk-python/commit/1fc1ee460877941fb648448a415b37f868093058))
* **internal:** update gitignore ([97672af](https://github.com/dedalus-labs/dedalus-sdk-python/commit/97672afab610a2fa4dcc7224dbad013b10553089))
* update placeholder string ([3a623d4](https://github.com/dedalus-labs/dedalus-sdk-python/commit/3a623d4779430378efe9ceb6540ba6fddbc70041))


### Documentation

* improve examples ([5207295](https://github.com/dedalus-labs/dedalus-sdk-python/commit/5207295286986023ba1afbf6219a88dab046b439))
* update examples ([62a7347](https://github.com/dedalus-labs/dedalus-sdk-python/commit/62a7347483733a1cdf57454a38af1f521f13ef4d))


### Refactors

* **types:** use `extra_items` from PEP 728 ([de6e4e4](https://github.com/dedalus-labs/dedalus-sdk-python/commit/de6e4e466ad9e9f40be8d8d4f7ea6208c076267e))

## 0.3.0 (2026-02-28)

Full Changelog: [v0.2.0...v0.3.0](https://github.com/dedalus-labs/dedalus-sdk-python/compare/v0.2.0...v0.3.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ client = Dedalus()
chat_completion = client.chat.completions.create(
model="openai/gpt-5",
audio={
"format": "wav",
"voice": "string",
"format": "mp3",
"voice": "alloy",
},
)
print(chat_completion.audio)
Expand Down
21 changes: 0 additions & 21 deletions bin/check-release-environment

This file was deleted.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "dedalus_labs"
version = "0.3.0"
version = "0.4.0"
description = "The official Python library for the Dedalus API"
dynamic = ["readme"]
license = "MIT"
Expand All @@ -11,7 +11,7 @@ authors = [
dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.10, <5",
"typing-extensions>=4.14, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
Expand Down
4 changes: 4 additions & 0 deletions src/dedalus_labs/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ def _build_request(
files = cast(HttpxRequestFiles, ForceMultipartDict())

prepared_url = self._prepare_url(options.url)
# preserve hard-coded query params from the url
if params and prepared_url.query:
params = {**dict(prepared_url.params.items()), **params}
prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0])
if "_" in prepared_url.host:
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
Expand Down
11 changes: 9 additions & 2 deletions src/dedalus_labs/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload
from datetime import date, datetime
from typing_extensions import Self, Literal
from typing_extensions import Self, Literal, TypedDict

import pydantic
from pydantic.fields import FieldInfo
Expand Down Expand Up @@ -131,6 +131,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
return model.model_dump_json(indent=indent)


class _ModelDumpKwargs(TypedDict, total=False):
by_alias: bool


def model_dump(
model: pydantic.BaseModel,
*,
Expand All @@ -142,14 +146,17 @@ def model_dump(
by_alias: bool | None = None,
) -> dict[str, Any]:
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
kwargs: _ModelDumpKwargs = {}
if by_alias is not None:
kwargs["by_alias"] = by_alias
return model.model_dump(
mode=mode,
exclude=exclude,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
# warnings are not supported in Pydantic v1
warnings=True if PYDANTIC_V1 else warnings,
by_alias=by_alias,
**kwargs,
)
return cast(
"dict[str, Any]",
Expand Down
56 changes: 53 additions & 3 deletions src/dedalus_labs/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import io
import os
import pathlib
from typing import overload
from typing_extensions import TypeGuard
from typing import Sequence, cast, overload
from typing_extensions import TypeVar, TypeGuard

import anyio

Expand All @@ -17,7 +17,9 @@
HttpxFileContent,
HttpxRequestFiles,
)
from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t

_T = TypeVar("_T")


def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
Expand Down Expand Up @@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
return await anyio.Path(file).read_bytes()

return file


def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
"""Copy only the containers along the given paths.

Used to guard against mutation by extract_files without copying the entire structure.
Only dicts and lists that lie on a path are copied; everything else
is returned by reference.

For example, given paths=[["foo", "files", "file"]] and the structure:
{
"foo": {
"bar": {"baz": {}},
"files": {"file": <content>}
}
}
The root dict, "foo", and "files" are copied (they lie on the path).
"bar" and "baz" are returned by reference (off the path).
"""
return _deepcopy_with_paths(item, paths, 0)


def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
if not paths:
return item
if is_mapping(item):
key_to_paths: dict[str, list[Sequence[str]]] = {}
for path in paths:
if index < len(path):
key_to_paths.setdefault(path[index], []).append(path)

# if no path continues through this mapping, it won't be mutated and copying it is redundant
if not key_to_paths:
return item

result = dict(item)
for key, subpaths in key_to_paths.items():
if key in result:
result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
return cast(_T, result)
if is_list(item):
array_paths = [path for path in paths if index < len(path) and path[index] == "<array>"]

# if no path expects a list here, nothing will be mutated inside it - return by reference
if not array_paths:
return cast(_T, item)
return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
return item
5 changes: 4 additions & 1 deletion src/dedalus_labs/_qs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def _stringify_item(
items.extend(self._stringify_item(key, item, opts))
return items
elif array_format == "indices":
raise NotImplementedError("The array indices format is not supported yet")
items = []
for i, item in enumerate(value):
items.extend(self._stringify_item(f"{key}[{i}]", item, opts))
return items
elif array_format == "brackets":
items = []
key = key + "[]"
Expand Down
2 changes: 1 addition & 1 deletion src/dedalus_labs/_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from ._path import path_template as path_template
from ._sync import asyncify as asyncify
from ._proxy import LazyProxy as LazyProxy
from ._utils import (
Expand All @@ -23,7 +24,6 @@
coerce_integer as coerce_integer,
file_from_path as file_from_path,
strip_not_given as strip_not_given,
deepcopy_minimal as deepcopy_minimal,
get_async_library as get_async_library,
maybe_coerce_float as maybe_coerce_float,
get_required_header as get_required_header,
Expand Down
Loading
Loading