{"id":22774273,"url":"https://github.com/nicolay-r/bulk-chain","last_synced_at":"2026-02-02T00:04:07.741Z","repository":{"id":234457681,"uuid":"783899447","full_name":"nicolay-r/bulk-chain","owner":"nicolay-r","description":"A no-string framework for reasoning over your tabular data rows with any provided LLM ","archived":false,"fork":false,"pushed_at":"2025-04-02T13:48:30.000Z","size":179,"stargazers_count":17,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T14:46:15.358Z","etag":null,"topics":["bulk","bulk-operation","chain-of-thought","chain-of-thought-reasoning","chatgpt","cot","gpt","inference","llm","pipeline","reasoning","spreadsheet","sqlite3"],"latest_commit_sha":null,"homepage":"https://x.com/nicolayr_/status/1847969224636961033","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicolay-r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-08T19:49:06.000Z","updated_at":"2025-04-02T13:48:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"92d0ba09-a37d-49ab-8552-fc7e345fb315","html_url":"https://github.com/nicolay-r/bulk-chain","commit_stats":null,"previous_names":["nicolay-r/quick_cot","nicolay-r/bulk-chain"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2Fbulk-chain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2Fbulk-chain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2Fbulk-chain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolay-r%2Fbulk-chain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolay-r","download_url":"https://codeload.github.com/nicolay-r/bulk-chain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249048033,"owners_count":21204303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bulk","bulk-operation","chain-of-thought","chain-of-thought-reasoning","chatgpt","cot","gpt","inference","llm","pipeline","reasoning","spreadsheet","sqlite3"],"created_at":"2024-12-11T18:13:29.459Z","updated_at":"2026-02-02T00:04:07.735Z","avatar_url":"https://github.com/nicolay-r.png","language":"Python","funding_links":[],"categories":["Frameworks"],"sub_categories":[],"readme":"# bulk-chain 1.2.1\n![](https://img.shields.io/badge/Python-3.9-brightgreen.svg)\n[![](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/nicolay-r/bulk-chain/blob/master/bulk_chain_tutorial.ipynb)\n[![twitter](https://img.shields.io/twitter/url/https/shields.io.svg?style=social)](https://x.com/nicolayr_/status/1847969224636961033)\n[![PyPI downloads](https://img.shields.io/pypi/dm/bulk-chain.svg)](https://pypistats.org/packages/bulk-chain)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"logo.png\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/nicolay-r/nlp-thirdgate?tab=readme-ov-file#llm\"\u003e\u003cb\u003eThird-party providers hosting\u003c/b\u003e↗️\u003c/a\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/nicolay-r/bulk-chain-shell\"\u003e👉\u003cb\u003edemo\u003c/b\u003e👈\u003c/a\u003e\n\u003c/p\u003e\n\nA 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)**.\n\n### Main Features\n* ✅ **No-strings**: you're free to LLM dependencies and flexible `venv` customization.\n* ✅ **Support schemas descriptions** for Chain-of-Thought concept.\n* ✅ **Provides iterator over infinite amount of input contexts**\n\n# Installation\n\nFrom PyPI: \n\n```bash\npip install --no-deps bulk-chain\n```\n\nor latest version from here:\n\n```bash\npip install git+https://github.com/nicolay-r/bulk-chain@master\n```\n\n## Chain-of-Thought Schema\n\nTo declare Chain-of-Though (CoT) schema we use `JSON` format. \nThe field `schema` is a list of CoT instructions for the Large Language Model.\nEach item of the list represent a dictionary with `prompt` and `out` keys that corresponds to the input prompt and output variable name respectively.\nAll the variable names should be mentioned in `{}`.\n\n**Example**:\n```python\n[\n  {\"prompt\": \"extract topic: {text}\", \"out\": \"topic\"},\n  {\"prompt\": \"extract subject: {text}\", \"out\": \"subject\"},\n]\n```\n\n# Usage\n\n## 🤖 Prepare \n\n1. [schema](#chain-of-thought-schema)\n    * [Example for Sentiment Analysis](test/schema/thor_cot_schema.json)\n2. **LLM model** from the [\u003cb\u003eThird-party providers hosting\u003c/b\u003e↗️](https://github.com/nicolay-r/nlp-thirdgate?tab=readme-ov-file#llm).\n3. Data (iter of dictionaries)\n\n## 🚀 Launch\n\n\u003e **API**: For more details see the [**related Wiki page**](https://github.com/nicolay-r/bulk-chain/wiki)\n\n```python\nfrom bulk_chain.core.utils import dynamic_init\nfrom bulk_chain.api import iter_content\n\ncontent_it = iter_content(\n    # 1. Your schema.              \n    schema=[\n      {\"prompt\": \"extract topic: {text}\", \"out\": \"topic\" },\n      {\"prompt\": \"extract subject: {text}\", \"out\": \"subject\"},\n    ],\n    # 2. Your third-party model implementation.\n    llm=dynamic_init(class_filepath=\"replicate_104.py\")(\n       api_token=\"\u003cAPI-KEY\u003e\",\n       model_name=\"meta/meta-llama-3-70b-instruct\"),\n    # 3. Toggle streaming if needed\n    stream=False,\n    # 4. Toggle Async API mode usage.\n    async_mode=True,\n    # 5. Batch size.\n    batch_size=10,\n    # 6. Your iterator of dictionaries\n    input_dicts_it=[\n        # Example of data ...\n        { \"text\": \"Rocks are hard\" },\n        { \"text\": \"Water is wet\" },\n        { \"text\": \"Fire is hot\" }\n    ],\n)\n    \nfor batch in content_it:\n   for entry in batch:\n      print(entry)\n```\n\nOutputs entries represent texts augmented with `topic` and `subject`:\n```jsonl\n{'text': 'Rocks are hard', 'topic': 'The topic is: Geology/Rocks', 'subject': 'The subject is: \"Rocks\"'}\n{'text': 'Water is wet', 'topic': 'The topic is: Properties of Water', 'subject': 'The subject is: Water'}\n{'text': 'Fire is hot', 'topic': 'The topic is: Temperature/Properties of Fire', 'subject': 'The subject is: \"Fire\"'}\n```\n\n# API\n\n| Method               | Mode       | Description                                                         |\n|----------------------|------------|---------------------------------------------------------------------|\n| `ask(prompt)`        | Sync       | Infers the model with a single prompt.                              |\n| `ask_stream(prompt)` | Sync       | Returns a generator that yields chunks of the inferred result.      |\n| `ask_async(prompt)`  | Async      | Asynchronously infers the model with a single prompt.               |\n| `ask_stream_async(prompt)` | Async | Asynchronously returns a generator of result chunks of the inferred result.          |\n\nSee examples with models [at nlp-thirdgate 🌌](https://github.com/nicolay-r/nlp-thirdgate?tab=readme-ov-file#llm).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolay-r%2Fbulk-chain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolay-r%2Fbulk-chain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolay-r%2Fbulk-chain/lists"}