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
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,48 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
118
118
119
119
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
120
120
121
+
## Nested params
122
+
123
+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
146
+
147
+
```python
148
+
from pathlib import Path
149
+
from llama_stack_client import LlamaStackClient
150
+
151
+
client = LlamaStackClient()
152
+
153
+
client.files.create(
154
+
expires_after_anchor="expires_after_anchor",
155
+
expires_after_seconds=0,
156
+
file=Path("/path/to/file"),
157
+
purpose="assistants",
158
+
)
159
+
```
160
+
161
+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
162
+
121
163
## Handling errors
122
164
123
165
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `llama_stack_client.APIConnectionError` is raised.
0 commit comments