poml
poml copied to clipboard
Conversation component, numeric content: "Speaker is specified but no exact corresponding output can be found in"
Hey :-)
We stumbled over a very weird behavior - it took a while to pinpoint why our LLM calls would do different things sometimes; in cases where the user only "answered" with a numeric value, e.g. age or a specific year, the Conversation component does strange things.
It seems that POML issues a warning to the console but otherwise "successfully" completes the call - so the actual error message only shows up when you execute it directly in cmd but it won't get to my logging provider.
As you can see in the second output - we are mitigating the whole thing with constructing a Q&A format...
This is the code that I am using for showcasing, similar to the actual implementation:
from poml import poml
markup = """<poml>
<conversation messages="{{ user_feedback_conversation }}" />
</poml>"""
print("\n")
print("\033[31m- First output (not working): \033[0m")
user_feedback_conversation = []
user_feedback_conversation.append({"speaker": "ai", "content": f"What is your age?"})
user_feedback_conversation.append({"speaker": "human", "content": f"99"})
output = poml(markup, context={"user_feedback_conversation": user_feedback_conversation})
print(output)
print("\n")
print("\033[32m- Second output (mitigated, alpha-numeric answer): \033[0m")
user_feedback_conversation = []
user_feedback_conversation.append({"speaker": "ai", "content": f"Q: What is your age?"})
user_feedback_conversation.append({"speaker": "human", "content": f"A: 99"}) # if the answer is numeric, POML ignores the whole entry, so we add "A: " prefix
output = poml(markup, context={"user_feedback_conversation": user_feedback_conversation})
print(output)
print("\n")
Thanks in advance!