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_nameproperty. This will be the name of the directive used in your special block. - Specify
parserproperty, which is anargparse.ArgumentParserobject to define what CLI-like arguments are accepted after the directive name - Implement
runasync method. It must takes anargsargument holding all the values of the command arguments defined in your parser as well ascontentargument holding all texts in the block.
You can find an example in shell.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b41245e7841f1cbb74f48c73196bca2e80e555dcf227e903729b7bb643fd9b16
|
|
| MD5 |
84faf750e7ae11722fb3114994a06497
|
|
| BLAKE2b-256 |
07d317ef40a9ea317b67fe383e75f27b33213fb4bd2d1ce44737d639f4eb020a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29507982e03244b2b205b49cd5de6bb0ab41e85563cfbb15f316b0048f132e2e
|
|
| MD5 |
ca7cc566bd38833540dcc685c69ae641
|
|
| BLAKE2b-256 |
bea4440043389cd0ac871e740a62aef6db14c10cdaeecaa45fddc15c2ad27917
|