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

Uploaded Source

Built Distribution

wander-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file wander-0.1.1.tar.gz.

File metadata

  • Download URL: wander-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for wander-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b41245e7841f1cbb74f48c73196bca2e80e555dcf227e903729b7bb643fd9b16
MD5 84faf750e7ae11722fb3114994a06497
BLAKE2b-256 07d317ef40a9ea317b67fe383e75f27b33213fb4bd2d1ce44737d639f4eb020a

See more details on using hashes here.

File details

Details for the file wander-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wander-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for wander-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29507982e03244b2b205b49cd5de6bb0ab41e85563cfbb15f316b0048f132e2e
MD5 ca7cc566bd38833540dcc685c69ae641
BLAKE2b-256 bea4440043389cd0ac871e740a62aef6db14c10cdaeecaa45fddc15c2ad27917

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