Skip to content

Commit d496425

Browse files
release: 0.1.0-alpha.1 (#13)
Co-authored-by: Lingxi @ Contextual <lingxi@contextual.ai> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 4bd4599 commit d496425

133 files changed

Lines changed: 6656 additions & 4969 deletions

File tree

Some content is hidden

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

.github/workflows/publish-pypi.yml

Lines changed: 31 additions & 0 deletions
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://www.github.com/ContextualAI/contextual-client-python/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.35.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.CONTEXTUAL_AI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
Lines changed: 21 additions & 0 deletions
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 == 'ContextualAI/contextual-client-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+
PYPI_TOKEN: ${{ secrets.CONTEXTUAL_AI_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.1.0-alpha.1"
3+
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 32
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-cd093ffe774597dbf8ec7b8b98cf60dda877d59af9b2d42826c80e8b1a92f904.yml
1+
configured_endpoints: 39
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-478f305e228bf07625e8d1166c8a8d2a38c532d27012ce7ed906d0a3728f26f9.yml

CHANGELOG.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Changelog
2+
3+
## 0.1.0-alpha.1 (2025-01-15)
4+
5+
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/ContextualAI/contextual-client-python/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([b26af54](https://github.com/ContextualAI/contextual-client-python/commit/b26af545d014d2ebbb0b95786325776a76cf4c37))
10+
* **api:** update via SDK Studio ([993c748](https://github.com/ContextualAI/contextual-client-python/commit/993c74879dc993e1c28f044fd7246bbd09d79a66))
11+
* **api:** update via SDK Studio ([ed4eda6](https://github.com/ContextualAI/contextual-client-python/commit/ed4eda61c3aa6535e6252a69c3a324d5ae996ef7))
12+
* **api:** update via SDK Studio ([89997a9](https://github.com/ContextualAI/contextual-client-python/commit/89997a98ea2019a768dde3d93f101871311185e0))
13+
* **api:** update via SDK Studio ([c4f9a7a](https://github.com/ContextualAI/contextual-client-python/commit/c4f9a7ad111def98c39764d1c4af7c37f4704912))
14+
* **api:** update via SDK Studio ([8ee9b9b](https://github.com/ContextualAI/contextual-client-python/commit/8ee9b9b7fa9ecb74097893b59b670675c399489d))
15+
* **api:** update via SDK Studio ([a116bc0](https://github.com/ContextualAI/contextual-client-python/commit/a116bc03080ff09e0269c995c8e67dc49a8c563f))
16+
* **api:** update via SDK Studio ([ef744ef](https://github.com/ContextualAI/contextual-client-python/commit/ef744ef0f11559c6df063fd68268be0ed646606b))
17+
* **api:** update via SDK Studio ([04d45a7](https://github.com/ContextualAI/contextual-client-python/commit/04d45a7d0d6dddd8b826592146e696264975db37))
18+
* **api:** update via SDK Studio ([5e4dab5](https://github.com/ContextualAI/contextual-client-python/commit/5e4dab55c8763098e750fe58f8501b1e21b08d11))
19+
* **api:** update via SDK Studio ([18443a5](https://github.com/ContextualAI/contextual-client-python/commit/18443a52b8fe05eba8098295cd39f99d36de2d0e))
20+
* **api:** update via SDK Studio ([17ba526](https://github.com/ContextualAI/contextual-client-python/commit/17ba5269a45738e5d7e0a833b887f32465266531))
21+
* **api:** update via SDK Studio ([581ec7e](https://github.com/ContextualAI/contextual-client-python/commit/581ec7e0f55ad14aa72de15bae22d298b25df17d))
22+
* **api:** update via SDK Studio ([9862571](https://github.com/ContextualAI/contextual-client-python/commit/986257157c57188953637bd4b43150a0492babcc))
23+
* **api:** update via SDK Studio ([dedbd4a](https://github.com/ContextualAI/contextual-client-python/commit/dedbd4ad104e03310190ad0776ba959758365c87))
24+
* **api:** update via SDK Studio ([a8bd7a6](https://github.com/ContextualAI/contextual-client-python/commit/a8bd7a6c3b40f03c6732fc5984dd82dd762a371b))
25+
* **api:** update via SDK Studio ([eb46df2](https://github.com/ContextualAI/contextual-client-python/commit/eb46df2656bb40a05d5443f148529b2945cba2e6))
26+
* **api:** update via SDK Studio ([d72e3cf](https://github.com/ContextualAI/contextual-client-python/commit/d72e3cfee20d002616d1f17412e919495b051e79))
27+
* **api:** update via SDK Studio ([3d1cde0](https://github.com/ContextualAI/contextual-client-python/commit/3d1cde029bf1c7de64d82a18ce4a87097c0065c0))
28+
* **api:** update via SDK Studio ([6cb72bf](https://github.com/ContextualAI/contextual-client-python/commit/6cb72bf6f0b8e4f14c15e4a8c6eac91dffce3358))
29+
* **api:** update via SDK Studio ([73639c4](https://github.com/ContextualAI/contextual-client-python/commit/73639c4a11978159b2a1fbf7b5d849a6358852dc))
30+
* **api:** update via SDK Studio ([3c4ff11](https://github.com/ContextualAI/contextual-client-python/commit/3c4ff11698404e2e391a8194b58a147b5b2a373a))
31+
* use customized prism-cli from npm. ([86d8b36](https://github.com/ContextualAI/contextual-client-python/commit/86d8b36c7d99031057b5d16ad77d0fa3f54b0861))
32+
33+
34+
### Bug Fixes
35+
36+
* **client:** only call .close() when needed ([e9f24af](https://github.com/ContextualAI/contextual-client-python/commit/e9f24af4d134d7919fde20dde45c928e8dc14680))
37+
* correctly handle deserialising `cls` fields ([9b002bf](https://github.com/ContextualAI/contextual-client-python/commit/9b002bf0ec2bc6ea8fd79bef8eafddfa07f1fe3a))
38+
39+
40+
### Chores
41+
42+
* add missing isclass check ([d373c16](https://github.com/ContextualAI/contextual-client-python/commit/d373c16e7e1d6964e603511a344c538afbd1b5c4))
43+
* add universal flag to lock files. ([c745c46](https://github.com/ContextualAI/contextual-client-python/commit/c745c46eb528a52fc3c174ce91ca93177db533f8))
44+
* code cleanup. ([b2d17e0](https://github.com/ContextualAI/contextual-client-python/commit/b2d17e02b6a0631da4bd067a7bba24f23871fa9f))
45+
* ignore `.DS_Store`. ([4d88206](https://github.com/ContextualAI/contextual-client-python/commit/4d882066acf442591667f2b7bdc2412abff4a504))
46+
* **internal:** add support for TypeAliasType ([8954c97](https://github.com/ContextualAI/contextual-client-python/commit/8954c972f145f840a75fda49e0fd842d2dcce024))
47+
* **internal:** bump httpx dependency ([a1caab0](https://github.com/ContextualAI/contextual-client-python/commit/a1caab00b5bad0092c0d762395f5ddbf534957ea))
48+
* **internal:** bump pydantic dependency ([f7caf20](https://github.com/ContextualAI/contextual-client-python/commit/f7caf20d9ce678e26a23f926e87d67b740f1a8f7))
49+
* **internal:** bump pyright ([e78ad59](https://github.com/ContextualAI/contextual-client-python/commit/e78ad59a3d6cb212d3ff41d03469745c2fcaa3ad))
50+
* **internal:** codegen related update ([6208f37](https://github.com/ContextualAI/contextual-client-python/commit/6208f37ebeda115283e07d7b497291bb105ae822))
51+
* **internal:** codegen related update ([2c55602](https://github.com/ContextualAI/contextual-client-python/commit/2c556026684cc39ea763c67a26f3860529246f88))
52+
* **internal:** codegen related update ([c90698a](https://github.com/ContextualAI/contextual-client-python/commit/c90698a2e6c51f1524c6f34cf599164309141eec))
53+
* **internal:** codegen related update ([215c573](https://github.com/ContextualAI/contextual-client-python/commit/215c573ac64e31481c41f2635e908197b32da724))
54+
* **internal:** codegen related update ([e943905](https://github.com/ContextualAI/contextual-client-python/commit/e9439056db5b3753011ecd1a2c944588e8405fbd))
55+
* **internal:** fix some typos ([beafdbd](https://github.com/ContextualAI/contextual-client-python/commit/beafdbdd47fd466c76130dc1f72e7829edd76f39))
56+
* remove custom code ([6ad0c2c](https://github.com/ContextualAI/contextual-client-python/commit/6ad0c2c8cbc8cbfa00fd961ac7053ce7232ed8df))
57+
* update README. ([6b324de](https://github.com/ContextualAI/contextual-client-python/commit/6b324de7f2818bd3b6aa1d9e20ab47d3d74e25ea))
58+
59+
60+
### Documentation
61+
62+
* fix typos ([ff04307](https://github.com/ContextualAI/contextual-client-python/commit/ff04307fb89c7da8ef313ee19e20ed19cad01f0c))
63+
* **readme:** example snippet for client context manager ([fd9d286](https://github.com/ContextualAI/contextual-client-python/commit/fd9d2869b622ea1633b4ffd013d0ce2d090d03c8))
64+
* **readme:** fix http client proxies example ([cca1f66](https://github.com/ContextualAI/contextual-client-python/commit/cca1f6666835843fbb560124667371f938d4e499))

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/sunrise-python.git
66+
$ pip install git+ssh://git@github.com/ContextualAI/contextual-client-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/sunrise-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/ContextualAI/contextual-client-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: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ The REST API documentation can be found on [docs.contextual.ai](https://docs.con
1313
## Installation
1414

1515
```sh
16-
# install from this staging repo
17-
pip install git+ssh://git@github.com/stainless-sdks/sunrise-python.git
16+
# install from PyPI
17+
pip install --pre contextual-client
1818
```
1919

20-
> [!NOTE]
21-
> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre contextual-client`
22-
2320
## Usage
2421

2522
The full API of this library can be found in [api.md](api.md).
@@ -32,10 +29,10 @@ client = ContextualAI(
3229
api_key=os.environ.get("CONTEXTUAL_API_KEY"), # This is the default and can be omitted
3330
)
3431

35-
create_application_output = client.applications.create(
32+
create_agent_output = client.agents.create(
3633
name="xxx",
3734
)
38-
print(create_application_output.application_id)
35+
print(create_agent_output.id)
3936
```
4037

4138
While you can provide an `api_key` keyword argument,
@@ -58,10 +55,10 @@ client = AsyncContextualAI(
5855

5956

6057
async def main() -> None:
61-
create_application_output = await client.applications.create(
58+
create_agent_output = await client.agents.create(
6259
name="xxx",
6360
)
64-
print(create_application_output.application_id)
61+
print(create_agent_output.id)
6562

6663

6764
asyncio.run(main())
@@ -89,12 +86,12 @@ from contextual import ContextualAI
8986

9087
client = ContextualAI()
9188

92-
all_applications = []
89+
all_agents = []
9390
# Automatically fetches more pages as needed.
94-
for application in client.applications.list():
95-
# Do something with application here
96-
all_applications.append(application)
97-
print(all_applications)
91+
for agent in client.agents.list():
92+
# Do something with agent here
93+
all_agents.append(agent)
94+
print(all_agents)
9895
```
9996

10097
Or, asynchronously:
@@ -107,11 +104,11 @@ client = AsyncContextualAI()
107104

108105

109106
async def main() -> None:
110-
all_applications = []
107+
all_agents = []
111108
# Iterate through items across all pages, issuing requests as needed.
112-
async for application in client.applications.list():
113-
all_applications.append(application)
114-
print(all_applications)
109+
async for agent in client.agents.list():
110+
all_agents.append(agent)
111+
print(all_agents)
115112

116113

117114
asyncio.run(main())
@@ -120,23 +117,23 @@ asyncio.run(main())
120117
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
121118

122119
```python
123-
first_page = await client.applications.list()
120+
first_page = await client.agents.list()
124121
if first_page.has_next_page():
125122
print(f"will fetch next page using these details: {first_page.next_page_info()}")
126123
next_page = await first_page.get_next_page()
127-
print(f"number of items we just fetched: {len(next_page.applications)}")
124+
print(f"number of items we just fetched: {len(next_page.data)}")
128125

129126
# Remove `await` for non-async usage.
130127
```
131128

132129
Or just work directly with the returned data:
133130

134131
```python
135-
first_page = await client.applications.list()
132+
first_page = await client.agents.list()
136133

137134
print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."
138-
for application in first_page.applications:
139-
print(application.id)
135+
for agent in first_page.data:
136+
print(agent.id)
140137

141138
# Remove `await` for non-async usage.
142139
```
@@ -157,7 +154,7 @@ from contextual import ContextualAI
157154
client = ContextualAI()
158155

159156
try:
160-
client.applications.create(
157+
client.agents.create(
161158
name="xxx",
162159
)
163160
except contextual.APIConnectionError as e:
@@ -202,7 +199,7 @@ client = ContextualAI(
202199
)
203200

204201
# Or, configure per-request:
205-
client.with_options(max_retries=5).applications.create(
202+
client.with_options(max_retries=5).agents.create(
206203
name="xxx",
207204
)
208205
```
@@ -227,7 +224,7 @@ client = ContextualAI(
227224
)
228225

229226
# Override per-request:
230-
client.with_options(timeout=5.0).applications.create(
227+
client.with_options(timeout=5.0).agents.create(
231228
name="xxx",
232229
)
233230
```
@@ -270,18 +267,18 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
270267
from contextual import ContextualAI
271268

272269
client = ContextualAI()
273-
response = client.applications.with_raw_response.create(
270+
response = client.agents.with_raw_response.create(
274271
name="xxx",
275272
)
276273
print(response.headers.get('X-My-Header'))
277274

278-
application = response.parse() # get the object that `applications.create()` would have returned
279-
print(application.application_id)
275+
agent = response.parse() # get the object that `agents.create()` would have returned
276+
print(agent.id)
280277
```
281278

282-
These methods return an [`APIResponse`](https://github.com/stainless-sdks/sunrise-python/tree/main/src/contextual/_response.py) object.
279+
These methods return an [`APIResponse`](https://github.com/ContextualAI/contextual-client-python/tree/main/src/contextual/_response.py) object.
283280

284-
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/sunrise-python/tree/main/src/contextual/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
281+
The async client returns an [`AsyncAPIResponse`](https://github.com/ContextualAI/contextual-client-python/tree/main/src/contextual/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
285282

286283
#### `.with_streaming_response`
287284

@@ -290,7 +287,7 @@ The above interface eagerly reads the full response body when you make the reque
290287
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.
291288

292289
```python
293-
with client.applications.with_streaming_response.create(
290+
with client.agents.with_streaming_response.create(
294291
name="xxx",
295292
) as response:
296293
print(response.headers.get("X-My-Header"))
@@ -387,7 +384,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
387384

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

390-
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/sunrise-python/issues) with questions, bugs, or suggestions.
387+
We are keen for your feedback; please open an [issue](https://www.github.com/ContextualAI/contextual-client-python/issues) with questions, bugs, or suggestions.
391388

392389
### Determining the installed version
393390

0 commit comments

Comments
 (0)