File tree Expand file tree Collapse file tree 3 files changed +51
-8
lines changed Expand file tree Collapse file tree 3 files changed +51
-8
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,16 @@ jobs:
123
123
enable-cache : true
124
124
125
125
- run : uv run --frozen coverage combine coverage
126
- # - run: uv run --frozen coverage xml
127
- # - uses: codecov/codecov-action@v4
128
- # with:
129
- # token: ${{ secrets.CODECOV_TOKEN }}
130
- # file: ./coverage.xml
126
+
127
+ - run : uv run --frozen coverage html --show-contexts --title "PydanticAI coverage for ${{ github.sha }}"
128
+
129
+ - name : Store coverage html
130
+ uses : actions/upload-artifact@v4
131
+ with :
132
+ name : coverage-html
133
+ path : htmlcov
134
+ include-hidden-files : true
135
+
131
136
- run : uv run --frozen coverage report --fail-under 95
132
137
133
138
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
Original file line number Diff line number Diff line change
1
+ name : Smokeshow
2
+
3
+ on :
4
+ workflow_run :
5
+ workflows : [CI]
6
+ types : [completed]
7
+
8
+ permissions :
9
+ statuses : write
10
+
11
+ jobs :
12
+ smokeshow :
13
+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
14
+ runs-on : ubuntu-latest
15
+
16
+ steps :
17
+ - uses : actions/setup-python@v5
18
+ with :
19
+ python-version : ' 3.12'
20
+
21
+ - run : pip install smokeshow
22
+
23
+ - uses : dawidd6/action-download-artifact@v6
24
+ with :
25
+ workflow : ci.yml
26
+ commit : ${{ github.event.workflow_run.head_sha }}
27
+
28
+ - run : smokeshow upload coverage-html
29
+ env :
30
+ SMOKESHOW_GITHUB_STATUS_DESCRIPTION : Coverage {coverage-percentage}
31
+ SMOKESHOW_GITHUB_COVERAGE_THRESHOLD : 95
32
+ SMOKESHOW_GITHUB_CONTEXT : coverage
33
+ SMOKESHOW_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34
+ SMOKESHOW_GITHUB_PR_HEAD_SHA : ${{ github.event.workflow_run.head_sha }}
35
+ SMOKESHOW_AUTH_KEY : ${{ secrets.SMOKESHOW_AUTH_KEY }}
Original file line number Diff line number Diff line change 13
13
from functools import cache
14
14
from typing import TYPE_CHECKING , Protocol , Union
15
15
16
- from httpx import AsyncClient as AsyncHTTPClient
16
+ import httpx
17
17
18
18
from ..messages import Message , ModelAnyResponse , ModelStructuredResponse
19
19
@@ -234,11 +234,14 @@ class AbstractToolDefinition(Protocol):
234
234
235
235
236
236
@cache
237
- def cached_async_http_client () -> AsyncHTTPClient :
237
+ def cached_async_http_client (timeout : int = 600 , connect : int = 5 ) -> httpx . AsyncClient :
238
238
"""Cached HTTPX async client so multiple agents and calls can share the same client.
239
239
240
240
There are good reasons why in production you should use a `httpx.AsyncClient` as an async context manager as
241
241
described in [encode/httpx#2026](https://github.com/encode/httpx/pull/2026), but when experimenting or showing
242
242
examples, it's very useful not to, this allows multiple Agents to use a single client.
243
+
244
+ The default timeouts match those of OpenAI,
245
+ see <https://github.com/openai/openai-python/blob/v1.54.4/src/openai/_constants.py#L9>.
243
246
"""
244
- return AsyncHTTPClient (timeout = 30 )
247
+ return httpx . AsyncClient (timeout = httpx . Timeout ( timeout = timeout , connect = connect ) )
You can’t perform that action at this time.
0 commit comments