poml
poml copied to clipboard
JSON formats in the output schema
Hi team 👋, I’m running into a problem when trying to define an output schema in JSON format inside a POML file and use it with LangchainPomlTemplate.
POML FILE
<poml>
<system-msg>Extract the event information.</system-msg>
<human-msg>Alice and Bob are going to a science fair on Friday.</human-msg>
<output-schema>
z.object({
name: z.string(),
date: z.string(),
participants: z.array(z.string()),
});
</output-schema>
</poml>
Python code
from poml.integration.langchain import LangchainPomlTemplate
prompt = LangchainPomlTemplate.from_file("prompt_new.poml")
What happened
When I run this, I get the following error:
Input to LangchainPomlTemplate is missing variables {'\n name'}.
Expected: ['\n name']
Received: ['user_input', 'history']
Note: if you intended {\n name} to be part of the string and not a variable, please escape it with double curly braces like: '{{\n name}}'.
What I Expected
The schema in
Question
Is there a recommended way to define a schema inside
I doubt that output schema is supported in langchainpomltemplate. Would have to test it myself.
Currently, you can define the output schema in langchain's approach and make that irrelevant to the poml file.