Skip to main content

Reusable contexts for LLMs

Project description

contextkit

Usage

Installation

pip install contextkit

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.

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.

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 (33)\n\nai (20)\n\ncoding (5)\n\ncompany (2)\n\ncourses (1)\n\neducation (1)\n\ninterview (1)\n\nopen-source (14)\n\npolicy (4)\n\nproduct'

Other arguments are always optional, but can be useful at times. For example, the heavy argument in read_url allows you to do a heavy scrape with a contactless browser using playwrightnb.

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 (33)\n\nai (20)\n\ncoding (5)\n\ncompany (2)\n\ncourses (1)\n\neducation (1)\n\ninterview (1)\n\nopen-source (14)\n\npolicy (4)\n\nproduct'

Many have been creates so far, such as

[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']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contextkit-0.0.9.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contextkit-0.0.9-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file contextkit-0.0.9.tar.gz.

File metadata

  • Download URL: contextkit-0.0.9.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for contextkit-0.0.9.tar.gz
Algorithm Hash digest
SHA256 4833891ec6d234f2cc12ed55084d0d3c0b5a16a9e9805a0a2d938847de61e3c0
MD5 f8b11f3c5b1b2cac7e520445c48b3823
BLAKE2b-256 99b04f71d9d8309558ddef5a8f7351118b4ba7fe2504450568457231273e1756

See more details on using hashes here.

File details

Details for the file contextkit-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: contextkit-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for contextkit-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 5ffec315ee7478534472453d2bf018bd26450ad75db0d2c93c7bf0785b7c4a96
MD5 162f39f2fc4a2666e1b1d965db6c6c1c
BLAKE2b-256 88accc4cca77436df8bb07baeec9a16173812b68216c49a7e931dae2627ed24d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page