You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,27 @@ while paginated:
91
91
paginated =False
92
92
```
93
93
94
+
#### Async Usage
95
+
96
+
For async, import from `pydo.aio` instead of `pydo`. The surface is identical
97
+
— same constructor, same operation groups — just `await` the calls. Use
98
+
`async with` so the underlying transport closes cleanly.
99
+
100
+
```python
101
+
import asyncio, os
102
+
from pydo.aio import Client
103
+
104
+
asyncdefmain():
105
+
asyncwith Client(api_key=os.environ["DIGITALOCEAN_TOKEN"]) as client:
106
+
resp =await client.chat.completions.create(
107
+
model="llama3.3-70b-instruct",
108
+
messages=[{"role": "user", "content": "Hello!"}],
109
+
)
110
+
print(resp)
111
+
112
+
asyncio.run(main())
113
+
```
114
+
94
115
#### Retries and Backoff
95
116
96
117
By default the client uses the same retry policy as the [Azure SDK for Python](https://learn.microsoft.com/en-us/python/api/azure-core/azure.core.pipeline.policies.retrypolicy?view=azure-python)
0 commit comments