Skip to content

Commit e7c850a

Browse files
release: 0.6.0 (#69)
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Lingxi @ Contextual <lingxi@contextual.ai>
1 parent 1f6c6c3 commit e7c850a

File tree

89 files changed

+3361
-856
lines changed

Some content is hidden

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

89 files changed

+3361
-856
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
33

44
USER vscode
55

6-
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
6+
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
77
ENV PATH=/home/vscode/.rye/shims:$PATH
88

99
RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc

.github/workflows/ci.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
- main
6-
pull_request:
7-
branches:
8-
- main
9-
- next
4+
branches-ignore:
5+
- 'generated'
6+
- 'codegen/**'
7+
- 'integrated/**'
8+
- 'stl-preview-head/**'
9+
- 'stl-preview-base/**'
1010

1111
jobs:
1212
lint:
13+
timeout-minutes: 10
1314
name: lint
14-
runs-on: ubuntu-latest
15-
15+
runs-on: ${{ github.repository == 'stainless-sdks/sunrise-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
1616
steps:
1717
- uses: actions/checkout@v4
1818

@@ -21,7 +21,7 @@ jobs:
2121
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: '0.35.0'
24+
RYE_VERSION: '0.44.0'
2525
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Install dependencies
@@ -31,9 +31,9 @@ jobs:
3131
run: ./scripts/lint
3232

3333
test:
34+
timeout-minutes: 10
3435
name: test
35-
runs-on: ubuntu-latest
36-
36+
runs-on: ${{ github.repository == 'stainless-sdks/sunrise-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
3737
steps:
3838
- uses: actions/checkout@v4
3939

@@ -42,7 +42,7 @@ jobs:
4242
curl -sSf https://rye.astral.sh/get | bash
4343
echo "$HOME/.rye/shims" >> $GITHUB_PATH
4444
env:
45-
RYE_VERSION: '0.35.0'
45+
RYE_VERSION: '0.44.0'
4646
RYE_INSTALL_OPTION: '--yes'
4747

4848
- name: Bootstrap

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: '0.35.0'
24+
RYE_VERSION: '0.44.0'
2525
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Publish to PyPI

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.5.1"
2+
".": "0.6.0"
33
}

.stats.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
configured_endpoints: 46
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-194878b194cd507d7c5418ff38cc0fc53441ef618f991990d334b4b75775cd8f.yml
1+
configured_endpoints: 52
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-17bdb8a33fb4fcade827bba868bd65cd30c64b1d09b4a6d83c3e37a8439ed37f.yml
3+
openapi_spec_hash: bc325b52f3b20d8c56e0be5de88f2dc3
4+
config_hash: 1ecef0ff4fd125bbc00eec65e3dd4798

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
# Changelog
22

3+
## 0.6.0 (2025-05-08)
4+
5+
Full Changelog: [v0.5.1...v0.6.0](https://github.com/ContextualAI/contextual-client-python/compare/v0.5.1...v0.6.0)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([2024a46](https://github.com/ContextualAI/contextual-client-python/commit/2024a46629ceca81d6c146b2e4d92ed4afb72e4b))
10+
* **api:** update via SDK Studio ([dba986f](https://github.com/ContextualAI/contextual-client-python/commit/dba986f3194a37160064270836d15a88ed0f8ee4))
11+
* **api:** update via SDK Studio ([a707edc](https://github.com/ContextualAI/contextual-client-python/commit/a707edc06c74353788bfa182d07682f7352a7a02))
12+
* **api:** update via SDK Studio ([#68](https://github.com/ContextualAI/contextual-client-python/issues/68)) ([7b8f948](https://github.com/ContextualAI/contextual-client-python/commit/7b8f9488ff9ba324210a23694065830a25985edc))
13+
* **api:** update via SDK Studio ([#70](https://github.com/ContextualAI/contextual-client-python/issues/70)) ([25477c7](https://github.com/ContextualAI/contextual-client-python/commit/25477c7d93934f2b5b72f5b24857f023c17349cf))
14+
* **api:** update via SDK Studio ([#73](https://github.com/ContextualAI/contextual-client-python/issues/73)) ([e07435e](https://github.com/ContextualAI/contextual-client-python/commit/e07435e7ab08a53cd13f4f8d91f2baca1ec2c28d))
15+
16+
17+
### Bug Fixes
18+
19+
* **ci:** ensure pip is always available ([#79](https://github.com/ContextualAI/contextual-client-python/issues/79)) ([ec1e2ce](https://github.com/ContextualAI/contextual-client-python/commit/ec1e2ce6de25021983b0a48b90069f24e3ee8def))
20+
* **ci:** remove publishing patch ([#80](https://github.com/ContextualAI/contextual-client-python/issues/80)) ([9e32578](https://github.com/ContextualAI/contextual-client-python/commit/9e32578922eb4dbad057231999add02c8aca3eb1))
21+
* **perf:** optimize some hot paths ([b88026d](https://github.com/ContextualAI/contextual-client-python/commit/b88026d6bfee7100a5663a95dd9800ed0059b353))
22+
* **perf:** skip traversing types for NotGiven values ([5bd2eab](https://github.com/ContextualAI/contextual-client-python/commit/5bd2eabd88852941a46d70823cb6163db08558eb))
23+
* **pydantic v1:** more robust ModelField.annotation check ([ce1ecab](https://github.com/ContextualAI/contextual-client-python/commit/ce1ecab62f47913665a51e3116232f65de95a3f3))
24+
* testing value for tune endpoints. ([7be555f](https://github.com/ContextualAI/contextual-client-python/commit/7be555fe0f39430923a9473420a88fc8c065a299))
25+
* **types:** handle more discriminated union shapes ([#78](https://github.com/ContextualAI/contextual-client-python/issues/78)) ([473adf4](https://github.com/ContextualAI/contextual-client-python/commit/473adf4d731241a2c34271d39a37d0ac2bc99d4e))
26+
27+
28+
### Chores
29+
30+
* broadly detect json family of content-type headers ([f4f3951](https://github.com/ContextualAI/contextual-client-python/commit/f4f39513b3f9a1c1cb5f323d2c0da2b0d04eff06))
31+
* **ci:** add timeout thresholds for CI jobs ([542b4ad](https://github.com/ContextualAI/contextual-client-python/commit/542b4adaefef61d93d6d7ec971c50d3d87490c17))
32+
* **ci:** only use depot for staging repos ([973153b](https://github.com/ContextualAI/contextual-client-python/commit/973153b08c9780b0d27ee107f71045c5921ee4f5))
33+
* **client:** minor internal fixes ([379b18e](https://github.com/ContextualAI/contextual-client-python/commit/379b18e3382f4cb3cbf2f4fb768a0d23885ec562))
34+
* fix typos ([#81](https://github.com/ContextualAI/contextual-client-python/issues/81)) ([9ba43be](https://github.com/ContextualAI/contextual-client-python/commit/9ba43bed2b39d60d599b90e624a2a40e57584749))
35+
* **internal:** base client updates ([1c44fea](https://github.com/ContextualAI/contextual-client-python/commit/1c44fea55a67de0d11f00fd3b63f64302f5eee51))
36+
* **internal:** bump pyright version ([6878eae](https://github.com/ContextualAI/contextual-client-python/commit/6878eae3717d1076836f59dafcab08a44ec573c8))
37+
* **internal:** bump rye to 0.44.0 ([#77](https://github.com/ContextualAI/contextual-client-python/issues/77)) ([520ba3a](https://github.com/ContextualAI/contextual-client-python/commit/520ba3a8e069a19543238009a241579ede90c2fe))
38+
* **internal:** codegen related update ([ddb9f6c](https://github.com/ContextualAI/contextual-client-python/commit/ddb9f6c3be981908de24cb485b4787a2fa969b80))
39+
* **internal:** codegen related update ([#74](https://github.com/ContextualAI/contextual-client-python/issues/74)) ([6e8bc46](https://github.com/ContextualAI/contextual-client-python/commit/6e8bc46fab20d9babe7b047298b55b0565ba4a8b))
40+
* **internal:** expand CI branch coverage ([fce3ddf](https://github.com/ContextualAI/contextual-client-python/commit/fce3ddf98a13402dc63da54b1042e625247e1e72))
41+
* **internal:** fix list file params ([561214d](https://github.com/ContextualAI/contextual-client-python/commit/561214d491c29833c6babc1ad1f5d6cc4367f794))
42+
* **internal:** import reformatting ([a9e8ae2](https://github.com/ContextualAI/contextual-client-python/commit/a9e8ae26c8f15d4bc385890eb0954d41475f5fba))
43+
* **internal:** minor formatting changes ([d036bee](https://github.com/ContextualAI/contextual-client-python/commit/d036bee6b1e9e9bf16d775f1f48732d5cf0bd206))
44+
* **internal:** reduce CI branch coverage ([b10d32e](https://github.com/ContextualAI/contextual-client-python/commit/b10d32ecd725652eba23d9e14714f82af0ead691))
45+
* **internal:** refactor retries to not use recursion ([7689427](https://github.com/ContextualAI/contextual-client-python/commit/7689427fe4667c1efcf66ba7ee6ace7e2dbd05f3))
46+
* **internal:** remove extra empty newlines ([#75](https://github.com/ContextualAI/contextual-client-python/issues/75)) ([8117197](https://github.com/ContextualAI/contextual-client-python/commit/81171975661f4a03f22820a36773bdff14b79e20))
47+
* **internal:** remove trailing character ([#82](https://github.com/ContextualAI/contextual-client-python/issues/82)) ([72018c8](https://github.com/ContextualAI/contextual-client-python/commit/72018c8784cf5d9974fca682b2b9998e2c4d341c))
48+
* **internal:** slight transform perf improvement ([#83](https://github.com/ContextualAI/contextual-client-python/issues/83)) ([29e9d80](https://github.com/ContextualAI/contextual-client-python/commit/29e9d80b25a84deb927098fd9c7bc0341a8e165f))
49+
* **internal:** update models test ([c3fcd9c](https://github.com/ContextualAI/contextual-client-python/commit/c3fcd9c8c1ef3de1b9681a8298ac508b758bf98c))
50+
* **internal:** update pyright settings ([9a560f4](https://github.com/ContextualAI/contextual-client-python/commit/9a560f4f6234c724a0426356e1c154ddfbccfa71))
51+
* slight wording improvement in README ([#84](https://github.com/ContextualAI/contextual-client-python/issues/84)) ([d5d7f2a](https://github.com/ContextualAI/contextual-client-python/commit/d5d7f2a5ece5735e83e431c9f231b94eb7d41773))
52+
* use lazy imports for resources ([e41fd1c](https://github.com/ContextualAI/contextual-client-python/commit/e41fd1c3869c16d18ba7f9151a1b3f1a463f0fd6))
53+
354
## 0.5.1 (2025-03-11)
455

556
Full Changelog: [v0.5.0...v0.5.1](https://github.com/ContextualAI/contextual-client-python/compare/v0.5.0...v0.5.1)

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,51 @@ for agent in first_page.agents:
138138
# Remove `await` for non-async usage.
139139
```
140140

141+
## Nested params
142+
143+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
144+
145+
```python
146+
from contextual import ContextualAI
147+
148+
client = ContextualAI()
149+
150+
create_agent_output = client.agents.create(
151+
name="xxx",
152+
agent_configs={
153+
"filter_and_rerank_config": {
154+
"rerank_instructions": "rerank_instructions",
155+
"reranker_score_filter_threshold": 0,
156+
"top_k_reranked_chunks": 0,
157+
},
158+
"generate_response_config": {
159+
"avoid_commentary": True,
160+
"calculate_groundedness": True,
161+
"frequency_penalty": 0,
162+
"max_new_tokens": 0,
163+
"seed": 0,
164+
"temperature": 0,
165+
"top_p": 0,
166+
},
167+
"global_config": {
168+
"enable_filter": True,
169+
"enable_multi_turn": True,
170+
"enable_rerank": True,
171+
"should_check_retrieval_need": True,
172+
},
173+
"retrieval_config": {
174+
"lexical_alpha": 0,
175+
"semantic_alpha": 0,
176+
"top_k_retrieved_chunks": 0,
177+
},
178+
},
179+
)
180+
print(create_agent_output.agent_configs)
181+
```
182+
141183
## File uploads
142184

143-
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)`.
185+
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)`.
144186

145187
```python
146188
from pathlib import Path

api.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ from contextual.types import (
99
DatastoreMetadata,
1010
ListDatastoresResponse,
1111
DatastoreDeleteResponse,
12+
DatastoreResetResponse,
1213
)
1314
```
1415

@@ -18,6 +19,7 @@ Methods:
1819
- <code title="get /datastores">client.datastores.<a href="./src/contextual/resources/datastores/datastores.py">list</a>(\*\*<a href="src/contextual/types/datastore_list_params.py">params</a>) -> <a href="./src/contextual/types/datastore.py">SyncDatastoresPage[Datastore]</a></code>
1920
- <code title="delete /datastores/{datastore_id}">client.datastores.<a href="./src/contextual/resources/datastores/datastores.py">delete</a>(datastore_id) -> <a href="./src/contextual/types/datastore_delete_response.py">object</a></code>
2021
- <code title="get /datastores/{datastore_id}/metadata">client.datastores.<a href="./src/contextual/resources/datastores/datastores.py">metadata</a>(datastore_id) -> <a href="./src/contextual/types/datastore_metadata.py">DatastoreMetadata</a></code>
22+
- <code title="put /datastores/{datastore_id}/reset">client.datastores.<a href="./src/contextual/resources/datastores/datastores.py">reset</a>(datastore_id) -> <a href="./src/contextual/types/datastore_reset_response.py">object</a></code>
2123

2224
## Documents
2325

@@ -48,11 +50,18 @@ Types:
4850
```python
4951
from contextual.types import (
5052
Agent,
53+
AgentConfigs,
5154
AgentMetadata,
5255
CreateAgentOutput,
56+
FilterAndRerankConfig,
57+
GenerateResponseConfig,
58+
GlobalConfig,
5359
ListAgentsResponse,
60+
RetrievalConfig,
5461
AgentUpdateResponse,
5562
AgentDeleteResponse,
63+
AgentMetadataResponse,
64+
AgentResetResponse,
5665
)
5766
```
5867

@@ -62,7 +71,8 @@ Methods:
6271
- <code title="put /agents/{agent_id}">client.agents.<a href="./src/contextual/resources/agents/agents.py">update</a>(agent_id, \*\*<a href="src/contextual/types/agent_update_params.py">params</a>) -> <a href="./src/contextual/types/agent_update_response.py">object</a></code>
6372
- <code title="get /agents">client.agents.<a href="./src/contextual/resources/agents/agents.py">list</a>(\*\*<a href="src/contextual/types/agent_list_params.py">params</a>) -> <a href="./src/contextual/types/agent.py">SyncPage[Agent]</a></code>
6473
- <code title="delete /agents/{agent_id}">client.agents.<a href="./src/contextual/resources/agents/agents.py">delete</a>(agent_id) -> <a href="./src/contextual/types/agent_delete_response.py">object</a></code>
65-
- <code title="get /agents/{agent_id}/metadata">client.agents.<a href="./src/contextual/resources/agents/agents.py">metadata</a>(agent_id) -> <a href="./src/contextual/types/agent_metadata.py">AgentMetadata</a></code>
74+
- <code title="get /agents/{agent_id}/metadata">client.agents.<a href="./src/contextual/resources/agents/agents.py">metadata</a>(agent_id) -> <a href="./src/contextual/types/agent_metadata_response.py">AgentMetadataResponse</a></code>
75+
- <code title="put /agents/{agent_id}/reset">client.agents.<a href="./src/contextual/resources/agents/agents.py">reset</a>(agent_id) -> <a href="./src/contextual/types/agent_reset_response.py">object</a></code>
6676

6777
## Query
6878

@@ -250,3 +260,23 @@ from contextual.types import GenerateCreateResponse
250260
Methods:
251261

252262
- <code title="post /generate">client.generate.<a href="./src/contextual/resources/generate.py">create</a>(\*\*<a href="src/contextual/types/generate_create_params.py">params</a>) -> <a href="./src/contextual/types/generate_create_response.py">GenerateCreateResponse</a></code>
263+
264+
# Parse
265+
266+
Types:
267+
268+
```python
269+
from contextual.types import (
270+
ParseCreateResponse,
271+
ParseJobResultsResponse,
272+
ParseJobStatusResponse,
273+
ParseJobsResponse,
274+
)
275+
```
276+
277+
Methods:
278+
279+
- <code title="post /parse">client.parse.<a href="./src/contextual/resources/parse.py">create</a>(\*\*<a href="src/contextual/types/parse_create_params.py">params</a>) -> <a href="./src/contextual/types/parse_create_response.py">ParseCreateResponse</a></code>
280+
- <code title="get /parse/jobs/{job_id}/results">client.parse.<a href="./src/contextual/resources/parse.py">job_results</a>(job_id, \*\*<a href="src/contextual/types/parse_job_results_params.py">params</a>) -> <a href="./src/contextual/types/parse_job_results_response.py">ParseJobResultsResponse</a></code>
281+
- <code title="get /parse/jobs/{job_id}/status">client.parse.<a href="./src/contextual/resources/parse.py">job_status</a>(job_id) -> <a href="./src/contextual/types/parse_job_status_response.py">ParseJobStatusResponse</a></code>
282+
- <code title="get /parse/jobs">client.parse.<a href="./src/contextual/resources/parse.py">jobs</a>(\*\*<a href="src/contextual/types/parse_jobs_params.py">params</a>) -> <a href="./src/contextual/types/parse_jobs_response.py">ParseJobsResponse</a></code>

bin/publish-pypi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@
33
set -eux
44
mkdir -p dist
55
rye build --clean
6-
# Patching importlib-metadata version until upstream library version is updated
7-
# https://github.com/pypa/twine/issues/977#issuecomment-2189800841
8-
"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
96
rye publish --yes --token=$PYPI_TOKEN

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "contextual-client"
3-
version = "0.5.1"
3+
version = "0.6.0"
44
description = "The official Python library for the Contextual AI API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -38,12 +38,11 @@ Homepage = "https://github.com/ContextualAI/contextual-client-python"
3838
Repository = "https://github.com/ContextualAI/contextual-client-python"
3939

4040

41-
4241
[tool.rye]
4342
managed = true
4443
# version pins are in requirements-dev.lock
4544
dev-dependencies = [
46-
"pyright>=1.1.359",
45+
"pyright==1.1.399",
4746
"mypy",
4847
"respx",
4948
"pytest",
@@ -87,7 +86,7 @@ typecheck = { chain = [
8786
"typecheck:mypy" = "mypy ."
8887

8988
[build-system]
90-
requires = ["hatchling", "hatch-fancy-pypi-readme"]
89+
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
9190
build-backend = "hatchling.build"
9291

9392
[tool.hatch.build]
@@ -148,11 +147,11 @@ exclude = [
148147
]
149148

150149
reportImplicitOverride = true
150+
reportOverlappingOverload = false
151151

152152
reportImportCycles = false
153153
reportPrivateUsage = false
154154

155-
156155
[tool.ruff]
157156
line-length = 120
158157
output-format = "grouped"

0 commit comments

Comments
 (0)