Skip to main content

A python package to parse and dump conversations in VIVA style.

Project description

viva-parse

Parse and dump VIVA conversations from json format to raw text and vice versa.

Install:

pip install viva-parse

or from source:

pip install git+https://github.com/svenschultze/viva-parse

Parse:

import viva_parse

conversation = "<|prompter|> I want to book a room for monday at 3am<|endoftext|><|assistant|><|book_room|><[date]> monday<[time]> 3am<!return!> success!<|endofaction|> Success! I have booked a room for you.<|endoftext|>"
parsed = viva_parse.parse(conversation)

Dump

import viva_parse

conversation_json = [
    {
        'role': 'prompter', 
        'message': 'I want to book a room for monday at 3am'
    }, {
        'role': 'assistant', 
        'message': 'Success! I have booked a room for you.', 
        'actions': [
            {
                'name': 'book_room', 
                'params': {
                    'date': 'monday', 
                    'time': '3am'
                }, 
                'return': 'success!'
            }
        ]
    }
]

dumped = viva_parse.dump(conversation_json)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viva_parse-0.0.3.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

viva_parse-0.0.3-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page