Skip to content

release: 0.8.0 #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1f04b9e
chore(ci): upload sdks to package manager
stainless-app[bot] May 15, 2025
f191464
chore(ci): fix installation instructions
stainless-app[bot] May 16, 2025
01370fb
chore(docs): grammar improvements
stainless-app[bot] May 22, 2025
9fd7133
fix(docs/api): remove references to nonexistent types
stainless-app[bot] May 28, 2025
68f70a8
chore(docs): remove reference to rye shell
stainless-app[bot] Jun 3, 2025
f603dcd
chore(docs): remove unnecessary param examples
stainless-app[bot] Jun 3, 2025
35e7c78
feat(client): add follow_redirects request option
stainless-app[bot] Jun 3, 2025
f75c912
chore(tests): run tests in parallel
stainless-app[bot] Jun 13, 2025
518cbab
fix(client): correctly parse binary response | stream
stainless-app[bot] Jun 13, 2025
0c4973f
chore(tests): add tests for httpx client instantiation & proxies
stainless-app[bot] Jun 17, 2025
b324ed3
chore(internal): update conftest.py
stainless-app[bot] Jun 17, 2025
84fbba4
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
b747f45
chore(readme): update badges
stainless-app[bot] Jun 18, 2025
d7920f1
fix(tests): fix: tests which call HTTP endpoints directly with the ex…
stainless-app[bot] Jun 18, 2025
3517a3d
docs(client): fix httpx.Timeout documentation reference
stainless-app[bot] Jun 19, 2025
d54f53c
feat(client): add support for aiohttp
stainless-app[bot] Jun 21, 2025
dd32830
chore(tests): skip some failing tests on the latest python versions
stainless-app[bot] Jun 24, 2025
ce0af3b
fix(ci): release-doctor — report correct token name
stainless-app[bot] Jun 27, 2025
b9520a0
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jun 28, 2025
0e1ab57
fix(ci): correct conditional
stainless-app[bot] Jun 30, 2025
f72dfb7
chore(ci): change upload type
stainless-app[bot] Jul 2, 2025
0310d7c
chore(internal): codegen related update
stainless-app[bot] Jul 8, 2025
f0aca79
chore(internal): bump pinned h11 dep
stainless-app[bot] Jul 9, 2025
f37217f
chore(package): mark python 3.13 as supported
stainless-app[bot] Jul 9, 2025
130f4c1
fix(parsing): correctly handle nested discriminated unions
stainless-app[bot] Jul 10, 2025
5857ef3
chore(readme): fix version rendering on pypi
stainless-app[bot] Jul 11, 2025
1ba6bcc
fix(client): don't send Content-Type header on GET requests
stainless-app[bot] Jul 12, 2025
a123363
release: 0.8.0
stainless-app[bot] Jul 12, 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
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/sunrise-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,49 @@ jobs:
- name: Run lints
run: ./scripts/lint

build:
if: github.repository == 'stainless-sdks/sunrise-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: depot-ubuntu-24.04
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
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
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: ${{ github.repository == 'stainless-sdks/sunrise-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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.7.0"
".": "0.8.0"
}
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# Changelog

## 0.8.0 (2025-07-12)

Full Changelog: [v0.7.0...v0.8.0](https://github.com/ContextualAI/contextual-client-python/compare/v0.7.0...v0.8.0)

### Features

* **client:** add follow_redirects request option ([35e7c78](https://github.com/ContextualAI/contextual-client-python/commit/35e7c78c7d1801a0afe4d73bbff3e7c695f5f19f))
* **client:** add support for aiohttp ([d54f53c](https://github.com/ContextualAI/contextual-client-python/commit/d54f53cfa0878acbad344622f7aae1b2e939ae1c))


### Bug Fixes

* **ci:** correct conditional ([0e1ab57](https://github.com/ContextualAI/contextual-client-python/commit/0e1ab57132d5a038aac790b463166200ae436fc3))
* **ci:** release-doctor — report correct token name ([ce0af3b](https://github.com/ContextualAI/contextual-client-python/commit/ce0af3be8b2f90af2bc4e38979a801df1e98e989))
* **client:** correctly parse binary response | stream ([518cbab](https://github.com/ContextualAI/contextual-client-python/commit/518cbabda3ce7f53721c0fc916ae89706899a4ec))
* **docs/api:** remove references to nonexistent types ([9fd7133](https://github.com/ContextualAI/contextual-client-python/commit/9fd7133c6748ba1b1676a674da35d57f02f01a86))
* **parsing:** correctly handle nested discriminated unions ([130f4c1](https://github.com/ContextualAI/contextual-client-python/commit/130f4c17f8fbf89a42fa1709d6e4b4a8b36c4036))
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([d7920f1](https://github.com/ContextualAI/contextual-client-python/commit/d7920f111d6175e6714482918e34992fb51739d9))


### Chores

* **ci:** change upload type ([f72dfb7](https://github.com/ContextualAI/contextual-client-python/commit/f72dfb77ff1fcae80efa5b286800ed77af6d0889))
* **ci:** enable for pull requests ([84fbba4](https://github.com/ContextualAI/contextual-client-python/commit/84fbba4c22dbbf8517841c7961a37dba246126dc))
* **ci:** fix installation instructions ([f191464](https://github.com/ContextualAI/contextual-client-python/commit/f191464e75f48395e76d6007712ae8548268b45f))
* **ci:** only run for pushes and fork pull requests ([b9520a0](https://github.com/ContextualAI/contextual-client-python/commit/b9520a0ad9c16d3ad0386ce70a15df4191751364))
* **ci:** upload sdks to package manager ([1f04b9e](https://github.com/ContextualAI/contextual-client-python/commit/1f04b9ecca3a4a3d2235c5cfa21bd9b36a358754))
* **docs:** grammar improvements ([01370fb](https://github.com/ContextualAI/contextual-client-python/commit/01370fb62278f1def879352910c2520102c89993))
* **docs:** remove reference to rye shell ([68f70a8](https://github.com/ContextualAI/contextual-client-python/commit/68f70a88e5b45773140c4b4a02c0506f3d078ad9))
* **docs:** remove unnecessary param examples ([f603dcd](https://github.com/ContextualAI/contextual-client-python/commit/f603dcdd966c77ce3e8b8dba8e878eb273ef1688))
* **internal:** bump pinned h11 dep ([f0aca79](https://github.com/ContextualAI/contextual-client-python/commit/f0aca79b109176c6a83b31434ccdbc30e58f059d))
* **internal:** codegen related update ([0310d7c](https://github.com/ContextualAI/contextual-client-python/commit/0310d7ce2bca6a80cd3b0d53a1103b4dc1fa8c32))
* **internal:** update conftest.py ([b324ed3](https://github.com/ContextualAI/contextual-client-python/commit/b324ed373c9c174a44eb52dc6d2384e82c0af4b8))
* **package:** mark python 3.13 as supported ([f37217f](https://github.com/ContextualAI/contextual-client-python/commit/f37217ff20d84d47c9adaf89c14151075e329972))
* **readme:** fix version rendering on pypi ([5857ef3](https://github.com/ContextualAI/contextual-client-python/commit/5857ef3c8252e39ab66b1dea3e035580d0f2f006))
* **readme:** update badges ([b747f45](https://github.com/ContextualAI/contextual-client-python/commit/b747f452ab31df0805dd07a516fe63c460353c57))
* **tests:** add tests for httpx client instantiation & proxies ([0c4973f](https://github.com/ContextualAI/contextual-client-python/commit/0c4973fed123a77a16b189439b3f4976fcc91770))
* **tests:** run tests in parallel ([f75c912](https://github.com/ContextualAI/contextual-client-python/commit/f75c912ff643028317dde5fb0dfd08470b26ac29))
* **tests:** skip some failing tests on the latest python versions ([dd32830](https://github.com/ContextualAI/contextual-client-python/commit/dd32830a8266dbf736c85285ec611854659511e7))


### Documentation

* **client:** fix httpx.Timeout documentation reference ([3517a3d](https://github.com/ContextualAI/contextual-client-python/commit/3517a3d02c7447c027bc82baf3a83333eb3c9b55))

## 0.7.0 (2025-05-13)

Full Changelog: [v0.6.0...v0.7.0](https://github.com/ContextualAI/contextual-client-python/compare/v0.6.0...v0.7.0)
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
67 changes: 38 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Contextual AI Python API library

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

The Contextual AI Python library provides convenient access to the Contextual AI REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down Expand Up @@ -66,6 +67,40 @@ 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 contextual-client[aiohttp]
```

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

```python
import os
import asyncio
from contextual import DefaultAioHttpClient
from contextual import AsyncContextualAI


async def main() -> None:
async with AsyncContextualAI(
api_key=os.environ.get("CONTEXTUAL_API_KEY"), # This is the default and can be omitted
http_client=DefaultAioHttpClient(),
) as client:
create_agent_output = await client.agents.create(
name="Example",
)
print(create_agent_output.id)


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 Down Expand Up @@ -149,33 +184,7 @@ client = ContextualAI()

create_agent_output = client.agents.create(
name="xxx",
agent_configs={
"filter_and_rerank_config": {
"rerank_instructions": "rerank_instructions",
"reranker_score_filter_threshold": 0,
"top_k_reranked_chunks": 0,
},
"generate_response_config": {
"avoid_commentary": True,
"calculate_groundedness": True,
"frequency_penalty": 0,
"max_new_tokens": 0,
"seed": 0,
"temperature": 0,
"top_p": 0,
},
"global_config": {
"enable_filter": True,
"enable_multi_turn": True,
"enable_rerank": True,
"should_check_retrieval_need": True,
},
"retrieval_config": {
"lexical_alpha": 0,
"semantic_alpha": 0,
"top_k_retrieved_chunks": 0,
},
},
agent_configs={},
)
print(create_agent_output.agent_configs)
```
Expand Down Expand Up @@ -267,7 +276,7 @@ client.with_options(max_retries=5).agents.create(
### 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 contextual import ContextualAI
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 Contextual AI please follow the respective company's security reporting guidelines.
or products provided by Contextual AI, please follow the respective company's security reporting guidelines.

### Contextual AI Terms and Policies

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

---

Expand Down
Loading