hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

jev_projection.mojo (684B)


      1 from std.collections import List
      2 
      3 from hyf_assist.evaluator import TypedAnswer
      4 
      5 
      6 def answer_by_id(
      7     answers: List[TypedAnswer], question_id: String
      8 ) raises -> TypedAnswer:
      9     for answer in answers:
     10         if answer.question_id == question_id:
     11             return answer.copy()
     12     raise Error("missing provider answer: " + question_id)
     13 
     14 
     15 def project_choice(
     16     answers: List[TypedAnswer], question_id: String
     17 ) raises -> String:
     18     var answer = answer_by_id(answers, question_id)
     19     if answer.kind != "choice":
     20         raise Error("expected a choice answer for " + question_id)
     21     return answer.choice
     22 
     23 
     24 def provider_cannot_supply_trusted_identity() -> Bool:
     25     return True