Skip to content

Commit

Permalink
Merge pull request #783 from PrefectHQ/image-example
Browse files Browse the repository at this point in the history
Add image example
  • Loading branch information
jlowin authored Jan 17, 2024
2 parents 851abc6 + 0fda812 commit e7fa2ef
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions docs/welcome/what_is_marvin.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# What is Marvin?

![](/assets/images/heroes/it_hates_me_hero.png)
Expand Down Expand Up @@ -73,8 +74,8 @@ Marvin is open-source, free to use, and made with 💙 by the team at [Prefect](
features == ['camera', 'battery life']
```

=== "Standardize inputs"
Convert natural language to a structured form:
=== "Structure text and images"
Marvin can convert natural language to a structured form:

```python hl_lines="10"
import marvin
Expand All @@ -94,6 +95,31 @@ Marvin is open-source, free to use, and made with 💙 by the team at [Prefect](
assert result == Location(city="New York", state="NY")
```

---

Marvin is multimodal, with beta support for using images as inputs. As an example, let's compare this photo to a shopping list to generate a list of missing items:

![](https://images.unsplash.com/photo-1588964895597-cfccd6e2dbf9)

```python
import marvin

shopping_list = ["bagels", "cabbage", "eggs", "apples", "oranges"]
groceries = marvin.beta.Image(
"https://images.unsplash.com/photo-1588964895597-cfccd6e2dbf9",
)
missing_items = marvin.beta.cast(
groceries,
target=list[str],
instructions=f"Did I forget anything on my list: {shopping_list}?",
)
```

!!! success "Result"
```python
assert missing_items == ["eggs", "oranges"]
```

=== "Generate data"
Generate synthetic data from a schema and instructions:
Expand Down Expand Up @@ -125,6 +151,8 @@ Marvin is open-source, free to use, and made with 💙 by the team at [Prefect](
]
```



=== "Custom AI functions"

Marvin functions let you combine any inputs, instructions, and output types to create custom AI-powered behaviors.
Expand All @@ -149,3 +177,4 @@ Marvin is open-source, free to use, and made with 💙 by the team at [Prefect](

Note that `list_fruits` has no source code. Marvin's components turn your function into a prompt, ask AI for its most likely output, and parses its response.


0 comments on commit e7fa2ef

Please sign in to comment.