Tools to make language models a bit easier to use
Project description
toolslm
This is a work in progress…
Install
pip install toolslm
How to use
Context creation
toolslm has some helpers to make it easier to generate XML context from
files, for instance
folder2ctx
:
print(folder2ctx('samples', prefix=False, file_glob='*.py'))
<documents><document index="1"><src>
samples/sample_core.py
</src><document-content>
import inspect
empty = inspect.Parameter.empty
models = 'claude-3-opus-20240229','claude-3-sonnet-20240229','claude-3-haiku-20240307'
</document-content></document></documents>
JSON doesn’t map as nicely to XML as the ft
data structure from
fastcore.xml
, but for simple XML trees it can be convenient. The
json_to_xml
function handles that conversion:
a = dict(surname='Howard', firstnames=['Jeremy','Peter'],
address=dict(state='Queensland',country='Australia'))
print(json_to_xml(a, 'person'))
<person>
<surname>Howard</surname>
<firstnames>
<item>Jeremy</item>
<item>Peter</item>
</firstnames>
<address>
<state>Queensland</state>
<country>Australia</country>
</address>
</person>
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
toolslm-0.2.3.tar.gz
(17.2 kB
view details)
Built Distribution
toolslm-0.2.3-py3-none-any.whl
(16.7 kB
view details)
File details
Details for the file toolslm-0.2.3.tar.gz
.
File metadata
- Download URL: toolslm-0.2.3.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
00862a252f3f58de6580f01ee54523d17b10469f5312716a5e9dce1d4a1b54a9
|
|
MD5 |
82ee5dd6a76c62dbf77c49c9054c99ab
|
|
BLAKE2b-256 |
dff6824a8a31e88693051861bab5e3c38d7b1edc9295a48671338b667401eada
|
File details
Details for the file toolslm-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: toolslm-0.2.3-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e2627c56ad1cde6d09218d9b0f6902c0ddf9c1c3d7fb031bbf2e1fd121e2e231
|
|
MD5 |
60a80ab7a9001d39432878b2474db1be
|
|
BLAKE2b-256 |
8b2e5b7abbe3369cc6674c982e9ee9c0a9633ae4e2e8b76d6c3b61845cdc722a
|