Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f35d86d
chore(internal): slight transform perf improvement (#24)
stainless-app[bot] Apr 9, 2025
b42f098
chore: slight wording improvement in README (#25)
stainless-app[bot] Apr 9, 2025
b89fea4
codegen metadata
stainless-app[bot] Apr 10, 2025
fd3cd26
chore(internal): expand CI branch coverage
stainless-app[bot] Apr 10, 2025
56b4e45
chore(internal): reduce CI branch coverage
stainless-app[bot] Apr 10, 2025
5eade63
fix(perf): skip traversing types for NotGiven values
stainless-app[bot] Apr 12, 2025
6da686a
fix(perf): optimize some hot paths
stainless-app[bot] Apr 12, 2025
bbb302d
chore(internal): update pyright settings
stainless-app[bot] Apr 15, 2025
8b19fe5
chore(client): minor internal fixes
stainless-app[bot] Apr 15, 2025
c7706f0
chore(internal): bump pyright version
stainless-app[bot] Apr 17, 2025
d417414
chore(internal): base client updates
stainless-app[bot] Apr 17, 2025
77dbb5e
chore(internal): update models test
stainless-app[bot] Apr 19, 2025
a283e86
chore(ci): add timeout thresholds for CI jobs
stainless-app[bot] Apr 23, 2025
3a69aa9
chore(internal): import reformatting
stainless-app[bot] Apr 23, 2025
e2d6428
chore(internal): fix list file params
stainless-app[bot] Apr 23, 2025
25ce097
chore(internal): refactor retries to not use recursion
stainless-app[bot] Apr 23, 2025
c060430
fix(pydantic v1): more robust ModelField.annotation check
stainless-app[bot] Apr 23, 2025
c4357ac
chore(internal): minor formatting changes
stainless-app[bot] Apr 24, 2025
697ab40
chore(internal): codegen related update
stainless-app[bot] Apr 24, 2025
15b3705
chore(ci): only use depot for staging repos
stainless-app[bot] Apr 24, 2025
11bc5fd
chore: broadly detect json family of content-type headers
stainless-app[bot] Apr 24, 2025
ef6b7d3
chore(internal): avoid errors for isinstance checks on proxies
stainless-app[bot] May 9, 2025
dd95dad
fix(package): support direct resource imports
stainless-app[bot] May 10, 2025
51807ff
chore(ci): upload sdks to package manager
stainless-app[bot] May 15, 2025
d92f111
chore(ci): fix installation instructions
stainless-app[bot] May 16, 2025
f95243c
chore(docs): grammar improvements
stainless-app[bot] May 22, 2025
e28c7f6
fix(docs/api): remove references to nonexistent types
stainless-app[bot] May 28, 2025
00fb01e
chore(docs): remove reference to rye shell
stainless-app[bot] Jun 3, 2025
389eb26
chore(docs): remove unnecessary param examples
stainless-app[bot] Jun 3, 2025
043f901
feat(client): add follow_redirects request option
stainless-app[bot] Jun 3, 2025
63610f1
feat(api): api update
stainless-app[bot] Jul 17, 2025
2d6ad21
chore: configure new SDK language
stainless-app[bot] Sep 6, 2025
5874623
codegen metadata
stainless-app[bot] Sep 6, 2025
a05f652
feat(api): api update
stainless-app[bot] Sep 17, 2025
7d7c3ce
chore(internal): codegen related update
stainless-app[bot] Oct 8, 2025
eca6f32
chore(internal): codegen related update
stainless-app[bot] Oct 11, 2025
b742fa1
chore(internal): codegen related update
stainless-app[bot] Oct 18, 2025
ccb23d0
chore(internal): codegen related update
stainless-app[bot] Oct 30, 2025
809bfb2
chore(internal): codegen related update
stainless-app[bot] Oct 31, 2025
69e3e3a
chore(internal): codegen related update
stainless-app[bot] Nov 4, 2025
f32f676
release: 2.1.0
stainless-app[bot] Nov 4, 2025
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
64 changes: 55 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: CI
on:
push:
branches:
- main
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches:
- main
- next
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-latest

runs-on: ${{ github.repository == 'stainless-sdks/hanzo-ai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand All @@ -30,10 +35,51 @@ jobs:
- name: Run lints
run: ./scripts/lint

build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/hanzo-ai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
run: rye sync --all-features

- name: Run build
run: rye build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/hanzo-ai-python'
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/hanzo-ai-python'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh

test:
timeout-minutes: 10
name: test
runs-on: ubuntu-latest

runs-on: ${{ github.repository == 'stainless-sdks/hanzo-ai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.prism.log
.vscode
_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 @@
{
".": "2.0.2"
".": "2.1.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 188
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hanzo-industries-inc%2FHanzo-AI-ec4be99f95dc46e9442eb60f233b2bff271d6f5bf57d7c61a52bc4804f55bbd1.yml
openapi_spec_hash: 87bc62c36bb6028ffd1f3e54a2809099
config_hash: 830747463ff4d018b5633ce511e88558
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hanzo-industries-inc%2Fhanzo-ai-10a8fe872c67396add3ebc3a10252df5bcd6d0f4e9a255d923875a806b2f1609.yml
openapi_spec_hash: 495ad4b04c4dd929e9566b6a099ff931
config_hash: e927bafd76a1eace11894efc3517d245
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.analysis.importFormat": "relative",
}
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
# Changelog

## 2.1.0 (2025-11-04)

Full Changelog: [v2.0.2...v2.1.0](https://github.com/hanzoai/python-sdk/compare/v2.0.2...v2.1.0)

### Features

* **api:** api update ([a05f652](https://github.com/hanzoai/python-sdk/commit/a05f6527170be1bd2d2c87bcd7f64057f77e8640))
* **api:** api update ([63610f1](https://github.com/hanzoai/python-sdk/commit/63610f15db91dbad94e87e51ebbea6ac8c85b278))
* **client:** add follow_redirects request option ([043f901](https://github.com/hanzoai/python-sdk/commit/043f9013103047d31680d29ada3dff35e3bf3f64))


### Bug Fixes

* **docs/api:** remove references to nonexistent types ([e28c7f6](https://github.com/hanzoai/python-sdk/commit/e28c7f6386b5c42a111a85f1cd4a588747fa8d83))
* **package:** support direct resource imports ([dd95dad](https://github.com/hanzoai/python-sdk/commit/dd95dadc573369de39916f8bf4bd0e36fbe3feaf))
* **perf:** optimize some hot paths ([6da686a](https://github.com/hanzoai/python-sdk/commit/6da686a68775c8d364e16790752773392ed21329))
* **perf:** skip traversing types for NotGiven values ([5eade63](https://github.com/hanzoai/python-sdk/commit/5eade63f698e112a8c2a07fb7f3466bff33fdc39))
* **pydantic v1:** more robust ModelField.annotation check ([c060430](https://github.com/hanzoai/python-sdk/commit/c0604303395ca27f73f16ea4bc4d05841acba51d))


### Chores

* broadly detect json family of content-type headers ([11bc5fd](https://github.com/hanzoai/python-sdk/commit/11bc5fd48e6536cbec838b676c64ce7a175f6b09))
* **ci:** add timeout thresholds for CI jobs ([a283e86](https://github.com/hanzoai/python-sdk/commit/a283e8611476e227244e75d30c0340aa6afd67a1))
* **ci:** fix installation instructions ([d92f111](https://github.com/hanzoai/python-sdk/commit/d92f1116f14aaaa9bb2c8a5b186b37dc5781a7d7))
* **ci:** only use depot for staging repos ([15b3705](https://github.com/hanzoai/python-sdk/commit/15b3705165b138b4827f9fa18fa9b7b8966ab5bb))
* **ci:** upload sdks to package manager ([51807ff](https://github.com/hanzoai/python-sdk/commit/51807ff9c91fbf15152c4d8850eec0e9a300e685))
* **client:** minor internal fixes ([8b19fe5](https://github.com/hanzoai/python-sdk/commit/8b19fe5acf34e3f9d7da0b6b8739cc893fe784ed))
* configure new SDK language ([2d6ad21](https://github.com/hanzoai/python-sdk/commit/2d6ad21c1518cb21658d308357a4017ff3e97973))
* **docs:** grammar improvements ([f95243c](https://github.com/hanzoai/python-sdk/commit/f95243ce876224facdb415f49a893c9c4b891b48))
* **docs:** remove reference to rye shell ([00fb01e](https://github.com/hanzoai/python-sdk/commit/00fb01e3fec2b8c4e70158ed6bdb796acc0d33bb))
* **docs:** remove unnecessary param examples ([389eb26](https://github.com/hanzoai/python-sdk/commit/389eb26846c6920186f1751e6dba087d9b09ab0f))
* **internal:** avoid errors for isinstance checks on proxies ([ef6b7d3](https://github.com/hanzoai/python-sdk/commit/ef6b7d319cee29263bac020390d6b3ec513648a4))
* **internal:** base client updates ([d417414](https://github.com/hanzoai/python-sdk/commit/d417414c3430003fed22f62c10de07c0088588a2))
* **internal:** bump pyright version ([c7706f0](https://github.com/hanzoai/python-sdk/commit/c7706f0871c28d186e5f249d24eb3a2a93b23cb2))
* **internal:** codegen related update ([69e3e3a](https://github.com/hanzoai/python-sdk/commit/69e3e3a8d2abc0902ee637dbd4dab136992f5409))
* **internal:** codegen related update ([809bfb2](https://github.com/hanzoai/python-sdk/commit/809bfb24f0872713c561ad0946d1581c48f53411))
* **internal:** codegen related update ([ccb23d0](https://github.com/hanzoai/python-sdk/commit/ccb23d013dd8c8582d49f959ed8a3342ae2b3f3f))
* **internal:** codegen related update ([b742fa1](https://github.com/hanzoai/python-sdk/commit/b742fa12ecd53d7f94a4ef142868ee211494d39b))
* **internal:** codegen related update ([eca6f32](https://github.com/hanzoai/python-sdk/commit/eca6f3283793c38d6e070c53d5aff33977e0a279))
* **internal:** codegen related update ([7d7c3ce](https://github.com/hanzoai/python-sdk/commit/7d7c3cee07ff188e208df8fc14df73d9bbc5827e))
* **internal:** codegen related update ([697ab40](https://github.com/hanzoai/python-sdk/commit/697ab40b8cd1bedf4cf7398a35408ca364e33d52))
* **internal:** expand CI branch coverage ([fd3cd26](https://github.com/hanzoai/python-sdk/commit/fd3cd268f6d853b66702f5e05934b0b7deb29abf))
* **internal:** fix list file params ([e2d6428](https://github.com/hanzoai/python-sdk/commit/e2d64282e2feaa9e239f434e2644d1a5e5271ede))
* **internal:** import reformatting ([3a69aa9](https://github.com/hanzoai/python-sdk/commit/3a69aa9c55cc2bd2289335ce353c9da067a1b4f6))
* **internal:** minor formatting changes ([c4357ac](https://github.com/hanzoai/python-sdk/commit/c4357ac7f204b602cb29c4d4beb9bd1ca99773fc))
* **internal:** reduce CI branch coverage ([56b4e45](https://github.com/hanzoai/python-sdk/commit/56b4e459a37ed1510622d2ff2127d789ddaa9893))
* **internal:** refactor retries to not use recursion ([25ce097](https://github.com/hanzoai/python-sdk/commit/25ce0973aaa11be64968f6236ec101ce524dc855))
* **internal:** slight transform perf improvement ([#24](https://github.com/hanzoai/python-sdk/issues/24)) ([f35d86d](https://github.com/hanzoai/python-sdk/commit/f35d86ddeba896b99c00874cbd3bfba0086741cd))
* **internal:** update models test ([77dbb5e](https://github.com/hanzoai/python-sdk/commit/77dbb5e3520be7aabad5a8e1259ab060d8d3dfca))
* **internal:** update pyright settings ([bbb302d](https://github.com/hanzoai/python-sdk/commit/bbb302d80ca7a6cf3b5bf2a58fdaac4f3a6e7e2e))
* slight wording improvement in README ([#25](https://github.com/hanzoai/python-sdk/issues/25)) ([b42f098](https://github.com/hanzoai/python-sdk/commit/b42f098ec1005979a4ee2cb1bd2bb394c16ae2a3))

## 2.0.2 (2025-04-04)

Full Changelog: [v2.0.1...v2.0.2](https://github.com/hanzoai/python-sdk/compare/v2.0.1...v2.0.2)
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ $ rye sync --all-features
You can then run scripts using `rye run python script.py` or by activating the virtual environment:

```sh
$ rye shell
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
$ source .venv/bin/activate

# now you can omit the `rye run` prefix
Expand Down
71 changes: 35 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Hanzo Python API library

[![PyPI version](https://img.shields.io/pypi/v/hanzoai.svg)](https://pypi.org/project/hanzoai/)
<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/hanzoai.svg?label=pypi%20(stable))](https://pypi.org/project/hanzoai/)

The Hanzo Python library provides convenient access to the Hanzo REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down Expand Up @@ -64,6 +65,36 @@ asyncio.run(main())

Functionality between the synchronous and asynchronous clients is otherwise identical.

### With aiohttp

By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.

You can enable this by installing `aiohttp`:

```sh
# install from PyPI
pip install hanzoai[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import asyncio
from hanzoai import DefaultAioHttpClient
from hanzoai import AsyncHanzo


async def main() -> None:
async with AsyncHanzo(
api_key="My API Key",
http_client=DefaultAioHttpClient(),
) as client:
response = await client.get_home()


asyncio.run(main())
```

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
Expand All @@ -83,39 +114,7 @@ from hanzoai import Hanzo
client = Hanzo()

model = client.model.create(
llm_params={
"model": "model",
"api_base": "api_base",
"api_key": "api_key",
"api_version": "api_version",
"aws_access_key_id": "aws_access_key_id",
"aws_region_name": "aws_region_name",
"aws_secret_access_key": "aws_secret_access_key",
"budget_duration": "budget_duration",
"configurable_clientside_auth_params": ["string"],
"custom_llm_provider": "custom_llm_provider",
"input_cost_per_second": 0,
"input_cost_per_token": 0,
"llm_trace_id": "llm_trace_id",
"max_budget": 0,
"max_file_size_mb": 0,
"max_retries": 0,
"merge_reasoning_content_in_choices": True,
"model_info": {},
"organization": "organization",
"output_cost_per_second": 0,
"output_cost_per_token": 0,
"region_name": "region_name",
"rpm": 0,
"stream_timeout": 0,
"timeout": 0,
"tpm": 0,
"use_in_pass_through": True,
"vertex_credentials": "string",
"vertex_location": "vertex_location",
"vertex_project": "vertex_project",
"watsonx_region_name": "watsonx_region_name",
},
llm_params={"model": "model"},
model_info={"id": "id"},
model_name="model_name",
)
Expand All @@ -124,7 +123,7 @@ print(model.llm_params)

## File uploads

Request parameters that correspond to file uploads can be passed as `bytes`, a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.

```python
from pathlib import Path
Expand Down Expand Up @@ -204,7 +203,7 @@ client.with_options(max_retries=5).get_home()
### Timeouts

By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from hanzoai import Hanzo
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Hanzo please follow the respective company's security reporting guidelines.
or products provided by Hanzo, please follow the respective company's security reporting guidelines.

### Hanzo Terms and Policies

Please contact dev@hanzo.ai for any questions or concerns regarding security of our services.
Please contact dev@hanzo.ai for any questions or concerns regarding the security of our services.

---

Expand Down
Loading
Loading