Generate Goldens From Contexts
If you already have prepared contexts, you can skip document processing. Simply provide these contexts to deepeval's Synthesizer, and it will generate goldens directly without processing documents.
Generate Your Goldens
To generate synthetic single or multi-turn goldens from documents, simply provide a list of contexts:
from deepeval.synthesizer import Synthesizer
synthesizer = Synthesizer()
goldens = synthesizer.generate_goldens_from_contexts(
# Provide a list of context for synthetic data generation
contexts=[
["The Earth revolves around the Sun.", "Planets are celestial bodies."],
["Water freezes at 0 degrees Celsius.", "The chemical formula for water is H2O."],
]
)There are ONE mandatory and THREE optional parameters when using the generate_goldens_from_contexts method:
contexts: a list of context, where each context is itself a list of strings, ideally sharing a common theme or subject area.- [Optional]
include_expected_output: a boolean which when set toTrue, will additionally generate anexpected_outputfor each syntheticGolden. Defaulted toTrue. - [Optional]
max_goldens_per_context: the maximum number of goldens to be generated per context. Defaulted to 2. - [Optional]
source_files: a list of strings specifying the source of the contexts. Length ofsource_filesMUST be the same as the length ofcontexts.
from deepeval.synthesizer import Synthesizer
synthesizer = Synthesizer()
conversational_goldens = synthesizer.generate_conversational_goldens_from_contexts(
# Provide a list of context for synthetic data generation
contexts=[
["The Earth revolves around the Sun.", "Planets are celestial bodies."],
["Water freezes at 0 degrees Celsius.", "The chemical formula for water is H2O."],
]
)There are ONE mandatory and THREE optional parameters when using the generate_conversational_goldens_from_contexts method:
contexts: a list of context, where each context is itself a list of strings, ideally sharing a common theme or subject area.- [Optional]
include_expected_outcome: a boolean which when set toTrue, will additionally generate anexpected_outcomefor each syntheticConversationalGolden. Defaulted toTrue. - [Optional]
max_goldens_per_context: the maximum number of goldens to be generated per context. Defaulted to 2. - [Optional]
source_files: a list of strings specifying the source of the contexts. Length ofsource_filesMUST be the same as the length ofcontexts.
Remember, single-turn generations produces single-turn Goldens, while multi-turn generations produces multi-turn ConversationalGoldens. To learn more about goldens, click here.