Skip to content

Commit eb996ba

Browse files
committed
Documentation for model.attachment_types, closes #705
1 parent 2b9a1bb commit eb996ba

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/python-api.md

+12
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ response = model.prompt(
7171
```
7272
Use `llm.Attachment(content=b"binary image content here")` to pass binary content directly.
7373

74+
You can check which attachment types (if any) a model supports using the `model.attachment_types` set:
75+
76+
```python
77+
model = llm.get_model("gpt-4o-mini")
78+
print(model.attachment_types)
79+
# {'image/gif', 'image/png', 'image/jpeg', 'image/webp'}
80+
81+
if "image/jpeg" in model.attachment_types:
82+
# Use a JPEG attachment here
83+
...
84+
```
85+
7486
### Model options
7587

7688
For models that support options (view those with `llm models --options`) you can pass options as keyword arguments to the `.prompt()` method:

0 commit comments

Comments
 (0)