https://github.com/nicolay-r/bulk-chain
A no-string framework for reasoning over your tabular data rows with any provided LLM
https://github.com/nicolay-r/bulk-chain
bulk bulk-operation chain-of-thought chain-of-thought-reasoning chatgpt cot gpt inference llm pipeline reasoning spreadsheet sqlite3
Last synced: 2 months ago
JSON representation
A no-string framework for reasoning over your tabular data rows with any provided LLM
- Host: GitHub
- URL: https://github.com/nicolay-r/bulk-chain
- Owner: nicolay-r
- License: mit
- Created: 2024-04-08T19:49:06.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-02T13:48:30.000Z (3 months ago)
- Last Synced: 2025-04-02T14:46:15.358Z (3 months ago)
- Topics: bulk, bulk-operation, chain-of-thought, chain-of-thought-reasoning, chatgpt, cot, gpt, inference, llm, pipeline, reasoning, spreadsheet, sqlite3
- Language: Python
- Homepage: https://x.com/nicolayr_/status/1847969224636961033
- Size: 175 KB
- Stars: 17
- Watchers: 2
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sentiment-attitude-extraction - [github
- awesome-sentiment-attitude-extraction - [github
README
# bulk-chain 1.0.0

[](https://colab.research.google.com/github/nicolay-r/bulk-chain/blob/master/bulk_chain_tutorial.ipynb)
[](https://x.com/nicolayr_/status/1847969224636961033)
[](https://pypistats.org/packages/bulk-chain)
![]()
Third-party providers hosting↗️
👉demo👈A no-strings-attached **framework** for your LLM that allows applying Chain-of-Thought-alike [prompt `schema`](#chain-of-thought-schema) towards a massive textual collections using custom **[third-party providers ↗️](https://github.com/nicolay-r/nlp-thirdgate?tab=readme-ov-file#llm)**.
### 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:
```bash
pip install --no-deps bulk-chain
```or latest version from here:
```bash
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:
```python
{
"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](#chain-of-thought-schema) ([Example for Sentiment Analysis](/ext/schema/thor_cot_schema.json)))
2. Wrap or pick **LLM model** from the [Third-party providers hosting↗️](https://github.com/nicolay-r/nlp-thirdgate?tab=readme-ov-file#llm).## API
Please take a look at the [**related Wiki page**](https://github.com/nicolay-r/bulk-chain/wiki)
# 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 🌌](https://github.com/nicolay-r/nlp-thirdgate?tab=readme-ov-file#llm).