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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file viva_parse-0.0.3.tar.gz.

File metadata

  • Download URL: viva_parse-0.0.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for viva_parse-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5917799c5a0a66443918e7bd60b1ef96016b4e7ab1df6d2344f6d49bbe88e592
MD5 362d0a97faf228ef08463b0ee7f2210d
BLAKE2b-256 128bc40cd51d646e949cf288b942928c65be8ffb55311edd6e218587f0bcee3d

See more details on using hashes here.

File details

Details for the file viva_parse-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: viva_parse-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for viva_parse-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dbec2e1b481008680469d8f7b31b72b7d5f018833dcbb8da119f4b0ad832b954
MD5 0ae7f9267afa8042297fca16088d366b
BLAKE2b-256 5a631ec2064763c06f97e0fa12a5b8ec1eb00b022d0af8e291d45071dab964c7

See more details on using hashes here.

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