https://github.com/answerdotai/toolslm
Tools to make language models a bit easier to use
https://github.com/answerdotai/toolslm
Last synced: 28 days ago
JSON representation
Tools to make language models a bit easier to use
- Host: GitHub
- URL: https://github.com/answerdotai/toolslm
- Owner: AnswerDotAI
- License: apache-2.0
- Created: 2024-05-02T17:13:51.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-23T01:59:24.000Z (about 1 month ago)
- Last Synced: 2026-02-23T09:27:05.027Z (about 1 month ago)
- Language: Jupyter Notebook
- Homepage: https://answerdotai.github.io/toolslm/
- Size: 773 KB
- Stars: 65
- Watchers: 4
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# toolslm
This is a work in progress…
## Install
``` sh
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`](https://AnswerDotAI.github.io/toolslm/xml.html#folder2ctx):
``` python
print(folder2ctx('samples', prefix=False, file_glob='*.py'))
```
samples/sample_core.py
import inspect
empty = inspect.Parameter.empty
models = 'claude-3-opus-20240229','claude-3-sonnet-20240229','claude-3-haiku-20240307'
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`](https://AnswerDotAI.github.io/toolslm/xml.html#json_to_xml)
function handles that conversion:
``` python
a = dict(surname='Howard', firstnames=['Jeremy','Peter'],
address=dict(state='Queensland',country='Australia'))
print(json_to_xml(a, 'person'))
```
Howard
Jeremy
Peter
Queensland
Australia