Created
March 31, 2023 18:27
-
-
Save jlowin/2ba25c3c67c83e259e1bfa19fdac0102 to your computer and use it in GitHub Desktop.
Scoring emails with Marvin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from marvin import ai_fn | |
import pydantic | |
class EmailDetails(pydantic.BaseModel): | |
is_positive: bool = pydantic.Field( | |
description="Whether the email has a positive tone" | |
) | |
action_items: list[str] = pydantic.Field( | |
"Follow-up questions, rewritten as single sentences that are understandable" | |
" without the rest of the email body" | |
) | |
@ai_fn | |
def process_email(email_body: str) -> EmailDetails: | |
""" | |
Scores email sentiment and gets any questions that need answering. | |
""" | |
process_email( | |
email_body="Love Marvin! What are you building next? Can I help?" | |
) | |
process_email( | |
email_body="Enough with the Hitchhiker's shtick. Can you tone it down? It's really annoying." | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment