Skip to main content

A lightweight, no-strings-attached Chain-of-Thought framework for your LLM, ensuring reliable results for bulk input requests.

Project description

bulk-chain 1.0.0

twitter PyPI downloads

Third-party providers hosting↗️
👉demo👈

A no-strings-attached framework for your LLM that allows applying Chain-of-Thought-alike prompt schema towards a massive textual collections using custom third-party providers ↗️.

Main Features

  • No-strings: you're free to LLM dependencies and flexible venv customization.
  • Support schemas descriptions for Chain-of-Thought concept.
  • Provides iterator over infinite amount of input contexts

Installation

From PyPI:

pip install --no-deps bulk-chain

or latest version from here:

pip install git+https://github.com/nicolay-r/bulk-chain@master

Chain-of-Thought Schema

To declare Chain-of-Though (CoT) schema, this project exploits JSON format. This format adopts name field for declaring a name and schema is a list of CoT instructions for the Large Language Model.

Each step represents a dictionary with prompt and out keys that corresponds to the input prompt and output variable name respectively. All the variable names are expected to be mentioned in {}.

Below, is an example on how to declare your own schema:

{
"name": "schema-name",
"schema": [
    {"prompt": "Given the question '{text}', let's think step-by-step.", 
     "out": "steps"},
    {"prompt": "For the question '{text}' the reasoining steps are '{steps}'. what would be an answer?", 
     "out":  "answer"},
]
}

Usage

Preliminary steps:

  1. Define your schema (Example for Sentiment Analysis))
  2. Wrap or pick LLM model from the Third-party providers hosting↗️.

API

Please take a look at the related Wiki page

Embed your LLM

All you have to do is to implement BaseLM class, that includes:

  • __init__ -- for setting up batching mode support and (optional) model name;
  • ask(prompt) -- infer your model with the given prompt.

See examples with models at nlp-thirdgate 🌌.

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

bulk_chain-1.0.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

bulk_chain-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file bulk_chain-1.0.0.tar.gz.

File metadata

  • Download URL: bulk_chain-1.0.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for bulk_chain-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ef140dffd61705135266f8edd758740d7cec15a221066dd8403aeaa99accadf0
MD5 458d6d59f1c999b2f445ac09da9ec282
BLAKE2b-256 b4ec53719f1d784b697a1ebb04a41622ae1dd6072aba6ce1bc7a97178cf744c5

See more details on using hashes here.

File details

Details for the file bulk_chain-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bulk_chain-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for bulk_chain-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd41504772fa9d8f93f3f644b0caa20879a5020c59a256f3872d3d3cd4e2d77c
MD5 7f11201ab3c61db1ad9ad5fe123ec54b
BLAKE2b-256 228e641b81d076499f2c36d1e153d10fa2350accfb77fc7e8296684dbfa3c998

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