Skip to content

Commit

Permalink
Add image example
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Nov 13, 2024
1 parent 8925ac9 commit 2767e54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/griptape-framework/drivers/prompt-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ Or use them independently:
--8<-- "docs/griptape-framework/drivers/src/prompt_drivers_2.py"
```

You can pass images to the Driver if the model supports it:

```python
--8<-- "docs/griptape-framework/drivers/src/prompt_driver_images.py"
```

## Prompt Drivers

Griptape offers the following Prompt Drivers for interacting with LLMs.
Expand Down
10 changes: 10 additions & 0 deletions docs/griptape-framework/drivers/src/prompt_drivers_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from griptape.artifacts import ListArtifact, TextArtifact
from griptape.drivers import OpenAiChatPromptDriver
from griptape.loaders import ImageLoader

driver = OpenAiChatPromptDriver(model="gpt-4o", max_tokens=256)

image_artifact = ImageLoader().load("./tests/resources/mountain.jpg")
text_artifact = TextArtifact("Describe the weather in the image")

driver.run(ListArtifact([text_artifact, image_artifact]))

0 comments on commit 2767e54

Please sign in to comment.