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
+16-14Lines changed: 16 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -114,7 +114,7 @@ list_famous_composers(20)
114
114
115
115
(Shameless ad: if classical music is your thing, I built a [GPT-automated website](https://github.com/Zulko/composer-timelines) on top of this function and a few others powered by ChatGPT)
116
116
117
-
Functions defined with the decorator can also have multiple arguments and keyword arguments:
117
+
A `gpt_function`-decorated method can also have multiple arguments and keyword arguments:
You can provide any simple output format directly (`-> int`, `-> float`, etc.). Lists should always declare the element type (for instance `list[str]`).
150
+
You can provide any simple output format directly in the function signature with `-> int`, `-> float`, etc. Lists should always declare the element type (for instance `list[str]`).
150
151
151
-
The OpenAI API doesn't seem to like types like `tuple` too much, and will complain if you have a type like `Dict`but don't specify the keys. If you really want to specify a `Dict` output with minimal boilerplate you can use the `TypedDict`:
152
+
The OpenAI API doesn't seem to like types like `tuple` too much, and will refuse a `Dict`type as it doesn't know what key names to use. If To specify a `Dict` output with minimal boilerplate you can use the `TypedDict`:
152
153
153
154
```python
154
-
from typing_extensions import TypedDict # or just typing, for Python>=3.12
155
+
from typing_extensions import TypedDict # or just "typing", for Python>=3.12
With Pydantic models you can have output schemas as nested and complex as you like (see [the docs](https://cookbook.openai.com/examples/structured_outputs_intro)), although it seems that the more difficult you'll make it for the GPT to understand how to fill the schema, the longer it's take.
187
+
With Pydantic models you can have output schemas as nested and complex as you like (see [the docs](https://cookbook.openai.com/examples/structured_outputs_intro)), although it seems that the more difficult you'll make it for the GPT to understand how to fill the schema, the longer it will take (not sure about costs).
0 commit comments