Skip to content

Commit 2863c6c

Browse files
feat(api): update via SDK Studio
1 parent 268752f commit 2863c6c

30 files changed

+1206
-538
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create releases
2+
on:
3+
schedule:
4+
- cron: '0 5 * * *' # every day at 5am UTC
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
name: release
12+
if: github.ref == 'refs/heads/main' && github.repository == 'isaacus-dev/isaacus-python'
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: stainless-api/trigger-release-please@v1
19+
id: release
20+
with:
21+
repo: ${{ github.event.repository.full_name }}
22+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
23+
24+
- name: Install Rye
25+
if: ${{ steps.release.outputs.releases_created }}
26+
run: |
27+
curl -sSf https://rye.astral.sh/get | bash
28+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
29+
env:
30+
RYE_VERSION: '0.35.0'
31+
RYE_INSTALL_OPTION: '--yes'
32+
33+
- name: Publish to PyPI
34+
if: ${{ steps.release.outputs.releases_created }}
35+
run: |
36+
bash ./bin/publish-pypi
37+
env:
38+
PYPI_TOKEN: ${{ secrets.ISAACUS_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.github/workflows/publish-pypi.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# workflow for re-running publishing to PyPI in case it fails for some reason
2+
# you can run this workflow by navigating to https://www.github.com/isaacus-dev/isaacus-python/actions/workflows/publish-pypi.yml
3+
name: Publish PyPI
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
publish:
9+
name: publish
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Rye
16+
run: |
17+
curl -sSf https://rye.astral.sh/get | bash
18+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
19+
env:
20+
RYE_VERSION: '0.35.0'
21+
RYE_INSTALL_OPTION: '--yes'
22+
23+
- name: Publish to PyPI
24+
run: |
25+
bash ./bin/publish-pypi
26+
env:
27+
PYPI_TOKEN: ${{ secrets.ISAACUS_PYPI_TOKEN || secrets.PYPI_TOKEN }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 == 'isaacus-dev/isaacus-python' && (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+
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
22+
PYPI_TOKEN: ${{ secrets.ISAACUS_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.1-alpha.0"
3+
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-d4d022b52b746c73bfcd08786a09a387060d83f28f09c2d663598ad41d7e8fc5.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-874c20d494cb37fc2f1c78b089cf16065bd2910c0fcb4dcc89cc55b73a3d6fc4.yml

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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/isaacus-python.git
66+
$ pip install git+ssh://git@github.com/isaacus-dev/isaacus-python.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://www.github.com/stainless-sdks/isaacus-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://www.github.com/isaacus-dev/isaacus-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
125125

126126
### Publish manually
127127

README.md

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ The REST API documentation can be found on [docs.isaacus.com](https://docs.isaac
1515
## Installation
1616

1717
```sh
18-
# install from this staging repo
19-
pip install git+ssh://git@github.com/stainless-sdks/isaacus-python.git
18+
# install from the production repo
19+
pip install git+ssh://git@github.com/isaacus-dev/isaacus-python.git
2020
```
2121

2222
> [!NOTE]
@@ -27,36 +27,47 @@ pip install git+ssh://git@github.com/stainless-sdks/isaacus-python.git
2727
The full API of this library can be found in [api.md](api.md).
2828

2929
```python
30+
import os
3031
from isaacus import Isaacus
3132

32-
client = Isaacus()
33+
client = Isaacus(
34+
bearer_token=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted
35+
)
3336

34-
classify_universal = client.classify_universal.create(
35-
model="model",
36-
query="query",
37-
text="text",
37+
universal_classification = client.classifications.universal.create(
38+
model="kanon-uniclassifier",
39+
query="This is a confidentiality clause.",
40+
text="The Supplier agrees not to disclose to any person, other than the Customer, any Confidential Information relating to the Contract or the Goods and/or Services, without prior written approval from the Customer.",
3841
)
39-
print(classify_universal.chunks)
42+
print(universal_classification.chunks)
4043
```
4144

45+
While you can provide a `bearer_token` keyword argument,
46+
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
47+
to add `ISAACUS_API_KEY="My Bearer Token"` to your `.env` file
48+
so that your Bearer Token is not stored in source control.
49+
4250
## Async usage
4351

4452
Simply import `AsyncIsaacus` instead of `Isaacus` and use `await` with each API call:
4553

4654
```python
55+
import os
4756
import asyncio
4857
from isaacus import AsyncIsaacus
4958

50-
client = AsyncIsaacus()
59+
client = AsyncIsaacus(
60+
bearer_token=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted
61+
)
5162

5263

5364
async def main() -> None:
54-
classify_universal = await client.classify_universal.create(
55-
model="model",
56-
query="query",
57-
text="text",
65+
universal_classification = await client.classifications.universal.create(
66+
model="kanon-uniclassifier",
67+
query="This is a confidentiality clause.",
68+
text="The Supplier agrees not to disclose to any person, other than the Customer, any Confidential Information relating to the Contract or the Goods and/or Services, without prior written approval from the Customer.",
5869
)
59-
print(classify_universal.chunks)
70+
print(universal_classification.chunks)
6071

6172

6273
asyncio.run(main())
@@ -89,10 +100,10 @@ from isaacus import Isaacus
89100
client = Isaacus()
90101

91102
try:
92-
client.classify_universal.create(
93-
model="model",
94-
query="query",
95-
text="text",
103+
client.classifications.universal.create(
104+
model="kanon-uniclassifier",
105+
query="This is a confidentiality clause.",
106+
text="The Supplier agrees not to disclose to any person, other than the Customer, any Confidential Information relating to the Contract or the Goods and/or Services, without prior written approval from the Customer.",
96107
)
97108
except isaacus.APIConnectionError as e:
98109
print("The server could not be reached")
@@ -136,10 +147,10 @@ client = Isaacus(
136147
)
137148

138149
# Or, configure per-request:
139-
client.with_options(max_retries=5).classify_universal.create(
140-
model="model",
141-
query="query",
142-
text="text",
150+
client.with_options(max_retries=5).classifications.universal.create(
151+
model="kanon-uniclassifier",
152+
query="This is a confidentiality clause.",
153+
text="The Supplier agrees not to disclose to any person, other than the Customer, any Confidential Information relating to the Contract or the Goods and/or Services, without prior written approval from the Customer.",
143154
)
144155
```
145156

@@ -163,10 +174,10 @@ client = Isaacus(
163174
)
164175

165176
# Override per-request:
166-
client.with_options(timeout=5.0).classify_universal.create(
167-
model="model",
168-
query="query",
169-
text="text",
177+
client.with_options(timeout=5.0).classifications.universal.create(
178+
model="kanon-uniclassifier",
179+
query="This is a confidentiality clause.",
180+
text="The Supplier agrees not to disclose to any person, other than the Customer, any Confidential Information relating to the Contract or the Goods and/or Services, without prior written approval from the Customer.",
170181
)
171182
```
172183

@@ -208,20 +219,20 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
208219
from isaacus import Isaacus
209220

210221
client = Isaacus()
211-
response = client.classify_universal.with_raw_response.create(
212-
model="model",
213-
query="query",
214-
text="text",
222+
response = client.classifications.universal.with_raw_response.create(
223+
model="kanon-uniclassifier",
224+
query="This is a confidentiality clause.",
225+
text="The Supplier agrees not to disclose to any person, other than the Customer, any Confidential Information relating to the Contract or the Goods and/or Services, without prior written approval from the Customer.",
215226
)
216227
print(response.headers.get('X-My-Header'))
217228

218-
classify_universal = response.parse() # get the object that `classify_universal.create()` would have returned
219-
print(classify_universal.chunks)
229+
universal = response.parse() # get the object that `classifications.universal.create()` would have returned
230+
print(universal.chunks)
220231
```
221232

222-
These methods return an [`APIResponse`](https://github.com/stainless-sdks/isaacus-python/tree/main/src/isaacus/_response.py) object.
233+
These methods return an [`APIResponse`](https://github.com/isaacus-dev/isaacus-python/tree/main/src/isaacus/_response.py) object.
223234

224-
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/isaacus-python/tree/main/src/isaacus/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
235+
The async client returns an [`AsyncAPIResponse`](https://github.com/isaacus-dev/isaacus-python/tree/main/src/isaacus/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
225236

226237
#### `.with_streaming_response`
227238

@@ -230,10 +241,10 @@ The above interface eagerly reads the full response body when you make the reque
230241
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
231242

232243
```python
233-
with client.classify_universal.with_streaming_response.create(
234-
model="model",
235-
query="query",
236-
text="text",
244+
with client.classifications.universal.with_streaming_response.create(
245+
model="kanon-uniclassifier",
246+
query="This is a confidentiality clause.",
247+
text="The Supplier agrees not to disclose to any person, other than the Customer, any Confidential Information relating to the Contract or the Goods and/or Services, without prior written approval from the Customer.",
237248
) as response:
238249
print(response.headers.get("X-My-Header"))
239250

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

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

332-
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/isaacus-python/issues) with questions, bugs, or suggestions.
343+
We are keen for your feedback; please open an [issue](https://www.github.com/isaacus-dev/isaacus-python/issues) with questions, bugs, or suggestions.
333344

334345
### Determining the installed version
335346

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ or products provided by Isaacus please follow the respective company's security
2020

2121
### Isaacus Terms and Policies
2222

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

2525
---
2626

api.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# ClassifyUniversal
1+
# Classifications
2+
3+
## Universal
24

35
Types:
46

57
```python
6-
from isaacus.types import ClassifyUniversalCreateResponse
8+
from isaacus.types.classifications import UniversalClassification
79
```
810

911
Methods:
1012

11-
- <code title="post /classify/universal">client.classify_universal.<a href="./src/isaacus/resources/classify_universal.py">create</a>(\*\*<a href="src/isaacus/types/classify_universal_create_params.py">params</a>) -> <a href="./src/isaacus/types/classify_universal_create_response.py">ClassifyUniversalCreateResponse</a></code>
13+
- <code title="post /classifications/universal">client.classifications.universal.<a href="./src/isaacus/resources/classifications/universal.py">create</a>(\*\*<a href="src/isaacus/types/classifications/universal_create_params.py">params</a>) -> <a href="./src/isaacus/types/classifications/universal_classification.py">UniversalClassification</a></code>

bin/check-release-environment

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
errors=()
4+
5+
if [ -z "${STAINLESS_API_KEY}" ]; then
6+
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
7+
fi
8+
9+
if [ -z "${PYPI_TOKEN}" ]; then
10+
errors+=("The ISAACUS_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
11+
fi
12+
13+
lenErrors=${#errors[@]}
14+
15+
if [[ lenErrors -gt 0 ]]; then
16+
echo -e "Found the following errors in the release environment:\n"
17+
18+
for error in "${errors[@]}"; do
19+
echo -e "- $error\n"
20+
done
21+
22+
exit 1
23+
fi
24+
25+
echo "The environment is ready to push releases!"

0 commit comments

Comments
 (0)