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
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gradientai.APIConnectionError` is raised.
131
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `do_gradientai.APIConnectionError` is raised.
132
132
133
133
When the API returns a non-success status code (that is, 4xx or 5xx
134
-
response), a subclass of `gradientai.APIStatusError` is raised, containing `status_code` and `response` properties.
134
+
response), a subclass of `do_gradientai.APIStatusError` is raised, containing `status_code` and `response` properties.
135
135
136
-
All errors inherit from `gradientai.APIError`.
136
+
All errors inherit from `do_gradientai.APIError`.
137
137
138
138
```python
139
-
importgradientai
140
-
fromgradientaiimport GradientAI
139
+
importdo_gradientai
140
+
fromdo_gradientaiimport GradientAI
141
141
142
142
client = GradientAI()
143
143
144
144
try:
145
145
client.agents.versions.list(
146
146
uuid="REPLACE_ME",
147
147
)
148
-
exceptgradientai.APIConnectionError as e:
148
+
exceptdo_gradientai.APIConnectionError as e:
149
149
print("The server could not be reached")
150
150
print(e.__cause__) # an underlying Exception, likely raised within httpx.
151
-
exceptgradientai.RateLimitError as e:
151
+
exceptdo_gradientai.RateLimitError as e:
152
152
print("A 429 status code was received; we should back off a bit.")
153
-
exceptgradientai.APIStatusError as e:
153
+
exceptdo_gradientai.APIStatusError as e:
154
154
print("Another non-200-range status code was received")
155
155
print(e.status_code)
156
156
print(e.response)
@@ -178,7 +178,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
178
178
You can use the `max_retries` option to configure or disable retry settings:
179
179
180
180
```python
181
-
fromgradientaiimport GradientAI
181
+
fromdo_gradientaiimport GradientAI
182
182
183
183
# Configure the default for all requests:
184
184
client = GradientAI(
@@ -198,7 +198,7 @@ By default requests time out after 1 minute. You can configure this with a `time
198
198
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
199
199
200
200
```python
201
-
fromgradientaiimport GradientAI
201
+
fromdo_gradientaiimport GradientAI
202
202
203
203
# Configure the default for all requests:
204
204
client = GradientAI(
@@ -252,7 +252,7 @@ if response.my_field is None:
252
252
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
@@ -264,9 +264,9 @@ version = response.parse() # get the object that `agents.versions.list()` would
264
264
print(version.agent_versions)
265
265
```
266
266
267
-
These methods return an [`APIResponse`](https://github.com/digitalocean/gradientai-python/tree/main/src/gradientai/_response.py) object.
267
+
These methods return an [`APIResponse`](https://github.com/digitalocean/gradientai-python/tree/main/src/do_gradientai/_response.py) object.
268
268
269
-
The async client returns an [`AsyncAPIResponse`](https://github.com/digitalocean/gradientai-python/tree/main/src/gradientai/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
269
+
The async client returns an [`AsyncAPIResponse`](https://github.com/digitalocean/gradientai-python/tree/main/src/do_gradientai/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
270
270
271
271
#### `.with_streaming_response`
272
272
@@ -330,7 +330,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
354
354
355
355
```py
356
-
fromgradientaiimport GradientAI
356
+
fromdo_gradientaiimport GradientAI
357
357
358
358
with GradientAI() as client:
359
359
# make requests here
@@ -381,8 +381,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
381
381
You can determine the version that is being used at runtime with:
0 commit comments