Skip to content

v0.6.0: Merge pull request #10 from narenaryan/feat/xml-serialize

Compare
Choose a tag to compare
@narenaryan narenaryan released this 19 May 03:00
· 10 commits to main since this release
70dc24c

YAML & XML serialization support

  • Now serialize PromptML prompt to XML & YAML with methods like to_xml() and to_yaml() on prompt parser

Deprecated

  • serialize_* methods
  • deserialize_* methods

Example usage:

from promptml.parser import PromptParserFromFile
p1 = PromptParserFromFile('prompt.pml')

# parse the prompt
p1.parse()

# serialize prompt to XML
print(p1.to_xml())

# serialize prompt to YAML
print(p1.to_yaml())

# serialize prompt to JSON
print(p1.to_json(indent=4))