Skip to main content

No project description provided

Project description

Wander

wander is a simple Python library that makes it easier to incorporate external data into LLM prompt.

Installation

You can install wander with pip

pip install wander

You need to have Python version 3.10 or above to use this library.

Usage

Assuming you have an markdown text with a special block !shell.

text = """\
Today is:
```!shell
date
```\
"""

Using wander to render it.

from wander import Renderer
from wander.plugins import ShellPlugin

renderer = Renderer(plugins=[ShellPlugin()])
renderer.render(text)

Output:

Today is:
Wed May 17 16:48:09 +08 2023

Writing your own plugin

To write your own plugin, simply inherit the Plugin class and do the following:

  • Specify plugin_name property. This will be the name of the directive used in your special block.
  • Specify parser property, which is an argparse.ArgumentParser object to define what CLI-like arguments are accepted after the directive name
  • Implement run async method. It must takes an args argument holding all the values of the command arguments defined in your parser as well as content argument holding all texts in the block.

You can find an example in shell.py.

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

wander-0.1.1.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

wander-0.1.1-py3-none-any.whl (5.7 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