Skip to content

Commit

Permalink
Documentation for model.attachment_types, closes #705
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jan 23, 2025
1 parent 2b9a1bb commit eb996ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/python-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ response = model.prompt(
```
Use `llm.Attachment(content=b"binary image content here")` to pass binary content directly.

You can check which attachment types (if any) a model supports using the `model.attachment_types` set:

```python
model = llm.get_model("gpt-4o-mini")
print(model.attachment_types)
# {'image/gif', 'image/png', 'image/jpeg', 'image/webp'}

if "image/jpeg" in model.attachment_types:
# Use a JPEG attachment here
...
```

### Model options

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

0 comments on commit eb996ba

Please sign in to comment.