Skip to content

Instantly share code, notes, and snippets.

@zzstoatzz
Created February 13, 2024 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzstoatzz/ae670c6b1f05537c1d4b03aaef581eba to your computer and use it in GitHub Desktop.
Save zzstoatzz/ae670c6b1f05537c1d4b03aaef581eba to your computer and use it in GitHub Desktop.
import marvin
@marvin.fn
def rank_answers(question: str, answers: list[str], context: str) -> list[str]:
"""Rank answers to a question based on context"""
if __name__ == "__main__":
ranked_answers = rank_answers(
question="What is the best programming language?",
answers=[
"Java",
"C++",
"Javascript",
"Haskell",
"Golang",
],
context="For web development"
)
print(ranked_answers) # ['Javascript', 'Golang', 'Java', 'C++', 'Haskell']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment