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
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 toolslm-0.3.28.tar.gz.
File metadata
- Download URL: toolslm-0.3.28.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fe2e4c5ec36ae5cdc7bd37fe7004eb7f7656595ebef8997927235b9b2cd6bcd
|
|
| MD5 |
746227c647c8c15ae1c4abf479323193
|
|
| BLAKE2b-256 |
91b924613b5d30084a5c4529da7d9b49ec842345f8f8fba201625dab8e6aab2b
|
File details
Details for the file toolslm-0.3.28-py3-none-any.whl.
File metadata
- Download URL: toolslm-0.3.28-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76785f0965ee86ee8e08ac455304a91b1b184dd0d31a449929bd57e8de0f6dd6
|
|
| MD5 |
16cfdf3fd66cf63add551393dea8fc4c
|
|
| BLAKE2b-256 |
b63737a70acbcb27b45c1c5807cf209c160eb016edcbf02982c7a51eb0c6190e
|