Dspy.Example (dspy v0.1.0)
View SourceTraining examples for DSPy programs.
Examples represent input-output pairs used for few-shot learning, optimization, and evaluation. They support flexible attribute access and can contain arbitrary fields.
Summary
Functions
Delete an attribute from the example.
Get an attribute from the example.
Get all attribute keys.
Merge two examples, with the second taking precedence.
Create a new Example with the given attributes.
Put an attribute in the example.
Convert example to a map.
Types
Functions
Delete an attribute from the example.
Get an attribute from the example.
Get all attribute keys.
Merge two examples, with the second taking precedence.
Create a new Example with the given attributes.
Examples
iex> ex = Dspy.Example.new(%{question: "What is 2+2?", answer: "4"})
iex> ex.question
"What is 2+2?"
iex> ex = Dspy.Example.new(question: "What is 2+2?", answer: "4")
iex> ex.answer
"4"
Put an attribute in the example.
Convert example to a map.