File tree 1 file changed +21
-0
lines changed
docs/docs/learn/programming
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,27 @@ Prediction(
136
136
)
137
137
```
138
138
139
+ ### Example E: Multi-modal image classification
140
+
141
+ ``` python
142
+ class DogPictureSignature (dspy .Signature ):
143
+ """ Output the dog breed of the dog in the image."""
144
+ image_1: dspy.Image = dspy.InputField(desc = " An image of a dog" )
145
+ answer: str = dspy.OutputField(desc = " The dog breed of the dog in the image" )
146
+
147
+ image_url = " https://picsum.photos/id/237/200/300"
148
+ classify = dspy.Predict(DogPictureSignature)
149
+ classify(image_1 = dspy.Image.from_url(image_url))
150
+ ```
151
+
152
+ ** Possible Output:**
153
+
154
+ ``` text
155
+ Prediction(
156
+ answer='Labrador Retriever'
157
+ )
158
+ ```
159
+
139
160
## Using signatures to build modules & compiling them
140
161
141
162
While signatures are convenient for prototyping with structured inputs/outputs, that's not the only reason to use them!
You can’t perform that action at this time.
0 commit comments