TemplateIntermediateScore 88
Creating an `Example`
Prompt example extracted from DSPy Examples.
GPT-5ClaudeGemini
Prompt
Your prompt
Creating an `Example`
When you use DSPy, you will do a lot of evaluation and optimization runs. Your individual datapoints will be of type `Example`:
```python
qa_pair = dspy.Example(question="This is a question?", answer="This is an answer.")
print(qa_pair)
print(qa_pair.question)
print(qa_pair.answer)
```
**Output:**
```text
Example({'question': 'This is a question?', 'answer': 'This is an answer.'}) (input_keys=None)
This is a question?
This is an answer.
```
Examples can have any field keys and any value types, though usually values are strings.
```text
object = Example(field1=value1, field2=value2, field3=value3, ...)
```