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
@@ -79,29 +81,29 @@ Typed requests and responses provide autocomplete and documentation within your
79
81
80
82
## Handling errors
81
83
82
-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `prompt-foundry-python-sdk.APIConnectionError` is raised.
84
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `prompt_foundry_python_sdk.APIConnectionError` is raised.
83
85
84
86
When the API returns a non-success status code (that is, 4xx or 5xx
85
-
response), a subclass of `prompt-foundry-python-sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
87
+
response), a subclass of `prompt_foundry_python_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
86
88
87
-
All errors inherit from `prompt-foundry-python-sdk.APIError`.
89
+
All errors inherit from `prompt_foundry_python_sdk.APIError`.
88
90
89
91
```python
90
-
importprompt-foundry-python-sdk
91
-
fromprompt-foundry-python-sdkimport PromptFoundry
92
+
importprompt_foundry_python_sdk
93
+
fromprompt_foundry_python_sdkimport PromptFoundry
92
94
93
95
client = PromptFoundry()
94
96
95
97
try:
96
98
client.prompts.get_parameters(
97
99
"1212121",
98
100
)
99
-
exceptprompt-foundry-python-sdk.APIConnectionError as e:
101
+
exceptprompt_foundry_python_sdk.APIConnectionError as e:
100
102
print("The server could not be reached")
101
-
print(e.__cause__) # an underlying Exception, likely raised within httpx.
102
-
exceptprompt-foundry-python-sdk.RateLimitError as e:
103
+
print(e.__cause__) # an underlying Exception, likely raised within httpx.
104
+
exceptprompt_foundry_python_sdk.RateLimitError as e:
103
105
print("A 429 status code was received; we should back off a bit.")
104
-
exceptprompt-foundry-python-sdk.APIStatusError as e:
106
+
exceptprompt_foundry_python_sdk.APIStatusError as e:
105
107
print("Another non-200-range status code was received")
106
108
print(e.status_code)
107
109
print(e.response)
@@ -129,7 +131,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
129
131
You can use the `max_retries` option to configure or disable retry settings:
@@ -213,9 +215,9 @@ prompt = response.parse() # get the object that `prompts.get_parameters()` woul
213
215
print(prompt.provider)
214
216
```
215
217
216
-
These methods return an [`APIResponse`](https://github.com/prompt-foundry/python-sdk/tree/main/src/prompt-foundry-python-sdk/_response.py) object.
218
+
These methods return an [`APIResponse`](https://github.com/prompt-foundry/python-sdk/tree/main/src/prompt_foundry_python_sdk/_response.py) object.
217
219
218
-
The async client returns an [`AsyncAPIResponse`](https://github.com/prompt-foundry/python-sdk/tree/main/src/prompt-foundry-python-sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
220
+
The async client returns an [`AsyncAPIResponse`](https://github.com/prompt-foundry/python-sdk/tree/main/src/prompt_foundry_python_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
219
221
220
222
#### `.with_streaming_response`
221
223
@@ -226,11 +228,11 @@ To stream the response body, use `.with_streaming_response` instead, which requi
226
228
```python
227
229
with client.prompts.with_streaming_response.get_parameters(
228
230
"1212121",
229
-
) as response:
230
-
print(response.headers.get('X-My-Header'))
231
+
) as response:
232
+
print(response.headers.get("X-My-Header"))
231
233
232
234
for line in response.iter_lines():
233
-
print(line)
235
+
print(line)
234
236
```
235
237
236
238
The context manager is required so that the response will reliably be closed.
@@ -279,12 +281,15 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
0 commit comments