KnowledgeGraph.answer_question()

Answer a pending enrichment question.

Usage

Source

KnowledgeGraph.answer_question(
    question_id,
    *,
    choice=None,
    freeform=None,
)

At least one of choice or freeform must be provided.

Parameters

question_id: str

ID of the question to answer.

choice: int | None = None

Index of the selected option.

freeform: str | None = None
Freeform text answer.

Returns

EnrichmentQuestion | None
The updated question, or None if not found or not pending.

Raises

ValueError
If neither choice nor freeform is provided, or choice is out of range.

Examples

questions = kg.pending_questions()
kg.answer_question(questions[0].id, choice=0)
kg.answer_question(questions[1].id, freeform="It's the API migration")