Metadata-Version: 2.4
Name: toolslm
Version: 0.2.0
Summary: Tools to make language models a bit easier to use
Home-page: https://github.com/AnswerDotAI/toolslm
Author: Jeremy Howard
Author-email: j@fast.ai
License: Apache Software License 2.0
Keywords: nbdev jupyter notebook python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastcore>=1.5.47
Requires-Dist: httpx
Provides-Extra: dev
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# toolslm


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

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'))
```

    <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`](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'))
```

    <person>
      <surname>Howard</surname>
      <firstnames>
        <item>Jeremy</item>
        <item>Peter</item>
      </firstnames>
      <address>
        <state>Queensland</state>
        <country>Australia</country>
      </address>
    </person>
