Metadata-Version: 2.2
Name: contextkit
Version: 0.0.1
Summary: Reusable contexts for LLMs
Home-page: https://github.com/AnswerDotAI/contextkit
Author: Isaac Flath
Author-email: isaac.flath@gmail.com
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.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-fasthtml
Requires-Dist: httpx
Requires-Dist: toolslm
Requires-Dist: fastcore
Requires-Dist: llms-txt
Requires-Dist: PyPDF2
Requires-Dist: youtube_transcript_api
Requires-Dist: pytube
Requires-Dist: playwrightnb
Provides-Extra: dev
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ContextKit


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

## Usage

### Installation

Install latest from the GitHub \[repository\]\[repo\]:

- Clone the repo
- `pip install -e .`

### Using

To get context from an LLM, use one of the helper functions to pull it.

If a function pulls a single context snippit it will return the text, if
it return multiple it will return a dictionary.

``` python
import ContextKit.read as rd
```

#### Read_X Functions

Each `read_x` function is designed to work with a single argument, which
is the location of the resource. This typically means a URL or a file
path.

``` python
rd.read_url('https://www.answer.ai/')[:200]
```

    'Answer.AI\n\n  * __\n  * __\n\n# Answer.AI - Practical AI R&D\n\n##### Categories\n\nAll (24)\n\nBlog (2)\n\n## Other Formats\n\n  *  __CommonMark\n\nAnswer.AI is a new kind of AI R&D lab which creates practical end-u'

Other arguments are always optional, but can be useful at times. For
example, the `heavy` argument in
[`read_url`](https://AnswerDotAI.github.io/ContextKit/read.html#read_url)
allows you to do a heavy scrape with a contactless browser using
`playwrightnb`.

``` python
rd.read_url('https://www.answer.ai/',heavy=True)[:200]
```

    'Answer.AI\n\n  * __\n  * __\n\n# Answer.AI - Practical AI R&D\n\n##### Categories\n\nAll (24)\n\nBlog (2)\n\n## Other Formats\n\n  *  __CommonMark\n\nAnswer.AI is a new kind of AI R&D lab which creates practical end-u'

Many have been creates so far, such as

``` python
[o for o in dir(rd) if o.startswith('read_')]
```

    ['read_dir',
     'read_file',
     'read_gdoc',
     'read_gh_file',
     'read_gh_repo',
     'read_gist',
     'read_git_path',
     'read_google_sheet',
     'read_html',
     'read_pdf',
     'read_url',
     'read_yt_transcript']

#### Pre-built Contexts

``` python
import ContextKit.contexts as ct
```

Prebuild contexts will always return a dictionary. This allows you to
choose what to use in model context

``` python
claudette_ctx = ct.ctx_claudette()
claudette_ctx.keys()
```

    dict_keys(['async_docs', 'core_docs', 'toolloop_docs'])

``` python
{k:f"{v[:50]} ..." for k,v in claudette_ctx.items()}
```

    {'async_docs': '# The async version  ## Setup ## Async SDK ``` pyt ...',
     'core_docs': '# Claudette’s source  This is the ‘literate’ sourc ...',
     'toolloop_docs': "# Tool loop  ``` python import os # os.environ['AN ..."}
