mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
docs - viewing if model supports vision
This commit is contained in:
parent
511546d2fe
commit
3bbd267bd0
2 changed files with 46 additions and 0 deletions
45
docs/my-website/docs/completion/vision.md
Normal file
45
docs/my-website/docs/completion/vision.md
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Using Vision Models
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
Example passing images to a model
|
||||||
|
|
||||||
|
```python
|
||||||
|
import os
|
||||||
|
from litellm import completion
|
||||||
|
|
||||||
|
os.environ["OPENAI_API_KEY"] = "your-api-key"
|
||||||
|
|
||||||
|
# openai call
|
||||||
|
response = completion(
|
||||||
|
model = "gpt-4-vision-preview",
|
||||||
|
messages=[
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "What’s in this image?"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "image_url",
|
||||||
|
"image_url": {
|
||||||
|
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Checking if a model supports `vision`
|
||||||
|
|
||||||
|
Use `litellm.supports_vision(model="")` -> returns `True` if model supports `vision` and `False` if not
|
||||||
|
|
||||||
|
```python
|
||||||
|
assert litellm.supports_vision(model="gpt-4-vision-preview") == True
|
||||||
|
assert litellm.supports_vision(model="gemini-1.0-pro-visionn") == True
|
||||||
|
assert litellm.supports_vision(model="gpt-3.5-turbo") == False
|
||||||
|
```
|
||||||
|
|
|
@ -86,6 +86,7 @@ const sidebars = {
|
||||||
"completion/stream",
|
"completion/stream",
|
||||||
"completion/message_trimming",
|
"completion/message_trimming",
|
||||||
"completion/function_call",
|
"completion/function_call",
|
||||||
|
"completion/vision",
|
||||||
"completion/model_alias",
|
"completion/model_alias",
|
||||||
"completion/batching",
|
"completion/batching",
|
||||||
"completion/mock_requests",
|
"completion/mock_requests",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue