Skip to content

Commit f6d3249

Browse files
authored
Merge pull request #2 from hanzoai/release-please--branches--main--changes--next
release: 0.1.0-alpha.1
2 parents 393475c + e3f3f82 commit f6d3249

File tree

351 files changed

+2513
-2359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

351 files changed

+2513
-2359
lines changed

.github/workflows/publish-pypi.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3+
# You can run this workflow by navigating to https://github.com/hanzoai/python-sdk/actions/workflows/publish-pypi.yml
4+
name: Publish PyPI
5+
on:
6+
workflow_dispatch:
7+
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
name: publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rye
20+
run: |
21+
curl -sSf https://rye.astral.sh/get | bash
22+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
23+
env:
24+
RYE_VERSION: '0.44.0'
25+
RYE_INSTALL_OPTION: '--yes'
26+
27+
- name: Publish to PyPI
28+
run: |
29+
bash ./bin/publish-pypi
30+
env:
31+
PYPI_TOKEN: ${{ secrets.HANZO_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.github/workflows/release-doctor.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release Doctor
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
jobs:
9+
release_doctor:
10+
name: release doctor
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'hanzoai/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Check release environment
18+
run: |
19+
bash ./bin/check-release-environment
20+
env:
21+
PYPI_TOKEN: ${{ secrets.HANZO_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0-alpha.1"
3+
}

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
## 0.1.0-alpha.1 (2025-03-15)
4+
5+
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/hanzoai/python-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([#4](https://github.com/hanzoai/python-sdk/issues/4)) ([e5137ed](https://github.com/hanzoai/python-sdk/commit/e5137ed411811a52ff9b7cc0e44a678ef3f3065e))
10+
11+
12+
### Chores
13+
14+
* go live ([#1](https://github.com/hanzoai/python-sdk/issues/1)) ([c1f495e](https://github.com/hanzoai/python-sdk/commit/c1f495ea0e560ada8c76c571b42928bf8e1b5ee5))
15+
* update SDK settings ([#3](https://github.com/hanzoai/python-sdk/issues/3)) ([beb5358](https://github.com/hanzoai/python-sdk/commit/beb53583fcdb15983f09a73be166dbbca30fb93f))

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ pip install -r requirements-dev.lock
3737

3838
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
3939
result in merge conflicts between manual patches and changes from the generator. The generator will never
40-
modify the contents of the `src/Hanzo_AI/lib/` and `examples/` directories.
40+
modify the contents of the `src/hanzoai/lib/` and `examples/` directories.
4141

4242
## Adding and running examples
4343

@@ -63,7 +63,7 @@ If you’d like to use the repository from source, you can either install from g
6363
To install via git:
6464

6565
```sh
66-
$ pip install git+ssh://git@github.com/stainless-sdks/Hanzo-AI-python.git
66+
$ pip install git+ssh://git@github.com/hanzoai/python-sdk.git
6767
```
6868

6969
Alternatively, you can build from source and install the wheel file:
@@ -121,7 +121,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
121121

122122
### Publish with a GitHub workflow
123123

124-
You can release to package managers by using [the `Publish PyPI` GitHub action](https://github.com/stainless-sdks/Hanzo-AI-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
124+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://github.com/hanzoai/python-sdk/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
125125

126126
### Publish manually
127127

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 Hanzo AI
189+
Copyright 2025 Hanzo
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

+46-49
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,55 @@
1-
# Hanzo AI Python API library
1+
# Hanzo Python API library
22

3-
[![PyPI version](https://img.shields.io/pypi/v/Hanzo_AI.svg)](https://pypi.org/project/Hanzo_AI/)
3+
[![PyPI version](https://img.shields.io/pypi/v/hanzoai.svg)](https://pypi.org/project/hanzoai/)
44

5-
The Hanzo AI Python library provides convenient access to the Hanzo AI REST API from any Python 3.8+
5+
The Hanzo Python library provides convenient access to the Hanzo REST API from any Python 3.8+
66
application. The library includes type definitions for all request params and response fields,
77
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
88

99
It is generated with [Stainless](https://www.stainless.com/).
1010

1111
## Documentation
1212

13-
The REST API documentation can be found on [docs.hanzo-ai.com](https://docs.Hanzo-AI.com). The full API of this library can be found in [api.md](api.md).
13+
The REST API documentation can be found on [docs.hanzo.ai](https://docs.hanzo.ai). The full API of this library can be found in [api.md](api.md).
1414

1515
## Installation
1616

1717
```sh
18-
# install from this staging repo
19-
pip install git+ssh://git@github.com/stainless-sdks/Hanzo-AI-python.git
18+
# install from PyPI
19+
pip install --pre hanzoai
2020
```
2121

22-
> [!NOTE]
23-
> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install --pre Hanzo_AI`
24-
2522
## Usage
2623

2724
The full API of this library can be found in [api.md](api.md).
2825

2926
```python
3027
import os
31-
from Hanzo_AI import HanzoAI
28+
from hanzoai import Hanzo
3229

33-
client = HanzoAI(
34-
api_key=os.environ.get("HANZO_AI_API_KEY"), # This is the default and can be omitted
30+
client = Hanzo(
31+
api_key=os.environ.get("HANZO_API_KEY"), # This is the default and can be omitted
3532
)
3633

3734
response = client.get_home()
3835
```
3936

4037
While you can provide an `api_key` keyword argument,
4138
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
42-
to add `HANZO_AI_API_KEY="My API Key"` to your `.env` file
39+
to add `HANZO_API_KEY="My API Key"` to your `.env` file
4340
so that your API Key is not stored in source control.
4441

4542
## Async usage
4643

47-
Simply import `AsyncHanzoAI` instead of `HanzoAI` and use `await` with each API call:
44+
Simply import `AsyncHanzo` instead of `Hanzo` and use `await` with each API call:
4845

4946
```python
5047
import os
5148
import asyncio
52-
from Hanzo_AI import AsyncHanzoAI
49+
from hanzoai import AsyncHanzo
5350

54-
client = AsyncHanzoAI(
55-
api_key=os.environ.get("HANZO_AI_API_KEY"), # This is the default and can be omitted
51+
client = AsyncHanzo(
52+
api_key=os.environ.get("HANZO_API_KEY"), # This is the default and can be omitted
5653
)
5754

5855

@@ -79,9 +76,9 @@ Typed requests and responses provide autocomplete and documentation within your
7976
Nested parameters are dictionaries, typed using `TypedDict`, for example:
8077

8178
```python
82-
from Hanzo_AI import HanzoAI
79+
from hanzoai import Hanzo
8380

84-
client = HanzoAI()
81+
client = Hanzo()
8582

8683
model = client.model.create(
8784
litellm_params={
@@ -129,9 +126,9 @@ Request parameters that correspond to file uploads can be passed as `bytes`, a [
129126

130127
```python
131128
from pathlib import Path
132-
from Hanzo_AI import HanzoAI
129+
from hanzoai import Hanzo
133130

134-
client = HanzoAI()
131+
client = Hanzo()
135132

136133
client.audio.transcriptions.create(
137134
file=Path("/path/to/file"),
@@ -142,27 +139,27 @@ The async client uses the exact same interface. If you pass a [`PathLike`](https
142139

143140
## Handling errors
144141

145-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `Hanzo_AI.APIConnectionError` is raised.
142+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `hanzoai.APIConnectionError` is raised.
146143

147144
When the API returns a non-success status code (that is, 4xx or 5xx
148-
response), a subclass of `Hanzo_AI.APIStatusError` is raised, containing `status_code` and `response` properties.
145+
response), a subclass of `hanzoai.APIStatusError` is raised, containing `status_code` and `response` properties.
149146

150-
All errors inherit from `Hanzo_AI.APIError`.
147+
All errors inherit from `hanzoai.APIError`.
151148

152149
```python
153-
import Hanzo_AI
154-
from Hanzo_AI import HanzoAI
150+
import hanzoai
151+
from hanzoai import Hanzo
155152

156-
client = HanzoAI()
153+
client = Hanzo()
157154

158155
try:
159156
client.get_home()
160-
except Hanzo_AI.APIConnectionError as e:
157+
except hanzoai.APIConnectionError as e:
161158
print("The server could not be reached")
162159
print(e.__cause__) # an underlying Exception, likely raised within httpx.
163-
except Hanzo_AI.RateLimitError as e:
160+
except hanzoai.RateLimitError as e:
164161
print("A 429 status code was received; we should back off a bit.")
165-
except Hanzo_AI.APIStatusError as e:
162+
except hanzoai.APIStatusError as e:
166163
print("Another non-200-range status code was received")
167164
print(e.status_code)
168165
print(e.response)
@@ -190,10 +187,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
190187
You can use the `max_retries` option to configure or disable retry settings:
191188

192189
```python
193-
from Hanzo_AI import HanzoAI
190+
from hanzoai import Hanzo
194191

195192
# Configure the default for all requests:
196-
client = HanzoAI(
193+
client = Hanzo(
197194
# default is 2
198195
max_retries=0,
199196
)
@@ -208,16 +205,16 @@ By default requests time out after 1 minute. You can configure this with a `time
208205
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
209206

210207
```python
211-
from Hanzo_AI import HanzoAI
208+
from hanzoai import Hanzo
212209

213210
# Configure the default for all requests:
214-
client = HanzoAI(
211+
client = Hanzo(
215212
# 20 seconds (default is 1 minute)
216213
timeout=20.0,
217214
)
218215

219216
# More granular control:
220-
client = HanzoAI(
217+
client = Hanzo(
221218
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
222219
)
223220

@@ -235,10 +232,10 @@ Note that requests that time out are [retried twice by default](#retries).
235232

236233
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
237234

238-
You can enable logging by setting the environment variable `HANZO_AI_LOG` to `info`.
235+
You can enable logging by setting the environment variable `HANZO_LOG` to `info`.
239236

240237
```shell
241-
$ export HANZO_AI_LOG=info
238+
$ export HANZO_LOG=info
242239
```
243240

244241
Or to `debug` for more verbose logging.
@@ -260,19 +257,19 @@ if response.my_field is None:
260257
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
261258

262259
```py
263-
from Hanzo_AI import HanzoAI
260+
from hanzoai import Hanzo
264261

265-
client = HanzoAI()
262+
client = Hanzo()
266263
response = client.with_raw_response.get_home()
267264
print(response.headers.get('X-My-Header'))
268265

269266
client = response.parse() # get the object that `get_home()` would have returned
270267
print(client)
271268
```
272269

273-
These methods return an [`APIResponse`](https://github.com/stainless-sdks/Hanzo-AI-python/tree/main/src/Hanzo_AI/_response.py) object.
270+
These methods return an [`APIResponse`](https://github.com/hanzoai/python-sdk/tree/main/src/hanzoai/_response.py) object.
274271

275-
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/Hanzo-AI-python/tree/main/src/Hanzo_AI/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
272+
The async client returns an [`AsyncAPIResponse`](https://github.com/hanzoai/python-sdk/tree/main/src/hanzoai/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
276273

277274
#### `.with_streaming_response`
278275

@@ -334,10 +331,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
334331

335332
```python
336333
import httpx
337-
from Hanzo_AI import HanzoAI, DefaultHttpxClient
334+
from hanzoai import Hanzo, DefaultHttpxClient
338335

339-
client = HanzoAI(
340-
# Or use the `HANZO_AI_BASE_URL` env var
336+
client = Hanzo(
337+
# Or use the `HANZO_BASE_URL` env var
341338
base_url="http://my.test.server.example.com:8083",
342339
http_client=DefaultHttpxClient(
343340
proxy="http://my.test.proxy.example.com",
@@ -357,9 +354,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
357354
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
358355

359356
```py
360-
from Hanzo_AI import HanzoAI
357+
from hanzoai import Hanzo
361358

362-
with HanzoAI() as client:
359+
with Hanzo() as client:
363360
# make requests here
364361
...
365362

@@ -376,7 +373,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
376373

377374
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
378375

379-
We are keen for your feedback; please open an [issue](https://github.com/stainless-sdks/Hanzo-AI-python/issues) with questions, bugs, or suggestions.
376+
We are keen for your feedback; please open an [issue](https://github.com/hanzoai/python-sdk/issues) with questions, bugs, or suggestions.
380377

381378
### Determining the installed version
382379

@@ -385,8 +382,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
385382
You can determine the version that is being used at runtime with:
386383

387384
```py
388-
import Hanzo_AI
389-
print(Hanzo_AI.__version__)
385+
import hanzoai
386+
print(hanzoai.__version__)
390387
```
391388

392389
## Requirements

SECURITY.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

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

21-
### Hanzo AI Terms and Policies
21+
### Hanzo Terms and Policies
2222

23-
Please contact dev-feedback@Hanzo-AI.com for any questions or concerns regarding security of our services.
23+
Please contact dev-feedback@hanzo.ai for any questions or concerns regarding security of our services.
2424

2525
---
2626

0 commit comments

Comments
 (0)