Skip to content

Commit 424187b

Browse files
docs: revise readme docs about nested params (#120)
1 parent a7e84d5 commit 424187b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,30 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
7979

8080
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`.
8181

82+
## Nested params
83+
84+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
85+
86+
```python
87+
from lumaai import LumaAI
88+
89+
client = LumaAI()
90+
91+
generation = client.generations.create(
92+
keyframes={
93+
"frame0": {
94+
"type": "image",
95+
"url": "https://example.com/image.jpg",
96+
},
97+
"frame1": {
98+
"id": "123e4567-e89b-12d3-a456-426614174000",
99+
"type": "generation",
100+
},
101+
},
102+
)
103+
print(generation.keyframes)
104+
```
105+
82106
## Handling errors
83107

84108
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `lumaai.APIConnectionError` is raised.

0 commit comments

Comments
 (0)