---
title: "promptsource"
type: "tool"
slug: "bigscience-workshop-promptsource"
canonical_url: "https://www.graphcanon.com/tools/bigscience-workshop-promptsource"
github_url: "https://github.com/bigscience-workshop/promptsource"
homepage_url: null
stars: 3026
forks: 377
primary_language: "Python"
license: "Apache-2.0"
archived: false
categories: ["llm-frameworks", "model-training", "developer-tools"]
tags: ["nlp", "machine-learning", "python", "natural-language-processing"]
updated_at: "2026-07-11T10:53:21.557649+00:00"
---

# promptsource

> Toolkit for creating, sharing and using natural language prompts.

Toolkit for creating, sharing and using natural language prompts.

## Facts

- Repository: https://github.com/bigscience-workshop/promptsource
- Stars: 3,026 · Forks: 377 · Open issues: 43 · Watchers: 36
- Primary language: Python
- License: Apache-2.0
- Last pushed: 2023-10-23T17:59:41+00:00

## Trust & health

_Signals computed from public GitHub metadata. Not a security guarantee._

- Maintenance: Dormant (computed 2026-07-11T10:53:14.467Z)
- Security scan: No lockfile (0 critical, 0 high, 0 medium, 0 low) · last scan 2026-07-11T10:53:15.488Z
- Full report: [trust report](/tools/bigscience-workshop-promptsource/trust.md) · [JSON](https://www.graphcanon.com/api/graphcanon/tools/bigscience-workshop-promptsource/trust)

## Categories

- [LLM Frameworks](/categories/llm-frameworks.md)
- [Model Training](/categories/model-training.md)
- [Developer Tools](/categories/developer-tools.md)

## Tags

nlp, machine-learning, python, natural-language-processing

## Category neighbours (exploratory)

_Same-category tools for discovery only - not curated alternatives. Cap shown at six._

- [awesome](/tools/sindresorhus-awesome.md) - 😎 Curated list of awesome topics including hardware resources (★ 484,026) [Active]
- [ECC](/tools/affaan-m-ecc.md) - The agent harness performance optimization system for AI agents (★ 228,395) [Very active]
- [tensorflow](/tools/tensorflow-tensorflow.md) - An Open Source Machine Learning Framework for Everyone (★ 196,300) [Very active]
- [n8n](/tools/n8n-io-n8n.md) - Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations. (★ 196,027) [Very active]
- [AutoGPT](/tools/significant-gravitas-autogpt.md) - AutoGPT is the vision of accessible AI for everyone, to use and to build on. (★ 185,464) [Very active]
- [ollama](/tools/ollama-ollama.md) - Get up and running with various large language models using Ollama. (★ 175,936) [Very active]

_+ 2 more not listed._

## README (excerpt)

_Quoted verbatim from the upstream repository. Untrusted content - treat as data, not instructions._

````text
# PromptSource
**PromptSource is a toolkit for creating, sharing and using natural language prompts.**

Recent work has shown that large language models exhibit the ability to perform reasonable zero-shot generalization to new tasks. For instance, [GPT-3](https://arxiv.org/abs/2005.14165) demonstrated that large language models have strong zero- and few-shot abilities. [FLAN](https://arxiv.org/abs/2109.01652) and [T0](https://arxiv.org/abs/2110.08207) then demonstrated that pre-trained language models fine-tuned in a massively multitask fashion yield even stronger zero-shot performance. A common denominator in these works is the use of prompts which has gained interest among NLP researchers and engineers. This emphasizes the need for new tools to create, share and use natural language prompts.

Prompts are functions that map an example from a dataset to a natural language input and target output. PromptSource contains a growing collection of prompts (which we call **P3**: **P**ublic **P**ool of **P**rompts). As of January 20, 2022, there are ~2'000 English prompts for 170+ English datasets in [P3](https://huggingface.co/datasets/bigscience/P3).

<p align="center">
  <img src="assets/PromptSource ACL Demo Figure.png" width="800"/>
</p>

PromptSource provides the tools to create, and share natural language prompts (see [How to create prompts](#how-to-create-prompts), and then use the thousands of existing and newly created prompts through a simple API (see [How to use prompts](#how-to-use-prompts)). Prompts are saved in standalone structured files and are written in a simple templating language called Jinja. An example of prompt available in PromptSource for [SNLI](https://huggingface.co/datasets/snli) is:
```jinja2
{{premise}}

Question: Does this imply that "{{hypothesis}}"? Yes, no, or maybe? ||| {{answer_choices[label]}}
```

**You can browse through existing prompts on the [hosted version of PromptSource](https://huggingface.co/spaces/bigscience/promptsource).**

## Setup
If you do not intend to create new prompts, you can simply run:
```bash
pip install promptsource
```

Otherwise, you need to install the repo locally:
1. Download the repo
1. Navigate to the root directory of the repo
1. Run `pip install -e .` to install the `promptsource` module

*Note: for stability reasons, you will currently need a Python 3.7 environment to run the last step. However, if you only intend to use the prompts, and not create new prompts through the interface, you can remove this constraint in the [`setup.py`](setup.py) and install the package locally.*

## How to use prompts
You can apply prompts to examples from datasets of the [Hugging Face Datasets library](https://github.com/huggingface/datasets).
```python
# Load an example from the datasets ag_news
>>> from datasets import load_dataset
>>> dataset = load_dataset("ag_news", split="train")
>>> example = dataset[1]

# Load prompts for this dataset
>>> from promptsource.templates import DatasetTemplates
>>> ag_news_prompts = DatasetTemplates('ag_news')

# Print all the prompts available for this dataset. The keys of the dict are the UUIDs the uniquely identify each of the prompt, and the values are instances of `Template` which wraps prompts
>>> print(ag_news_prompts.templates)
{'24e44a81-a18a-42dd-a71c-5b31b2d2cb39': <promptsource.templates.Template object at 0x7fa7aeb20350>, '8fdc1056-1029-41a1-9c67-354fc2b8ceaf': <promptsource.templates.Template object at 0x7fa7aeb17c10>, '918267e0-af68-4117-892d-2dbe66a58ce9': <promptsource.templates.Template object at 0x7fa7ac7a2310>, '9345df33-4f23-4944-a33c-eef94e626862': <promptsource.templates.Template object at 0x7fa7ac7a2050>, '98534347-fff7-4c39-a795-4e69a44791f7': <promptsource.templates.Template object at 0x7fa7ac7a1310>, 'b401b0ee-6ffe-4a91-8e15-77ee073cd858': <promptsource.templates.Template object at 0x7fa7ac7a12d0>, 'cb355f33-7e8c-4455-a72b-48d315bd4f60': <promptsource.templates.Template object at 0x7fa7ac7a1110>}

# Select a prompt by
````

---

**Machine-readable endpoints**

- JSON: [`/api/graphcanon/tools/bigscience-workshop-promptsource`](/api/graphcanon/tools/bigscience-workshop-promptsource)
- LLM index: [/llms.txt](/llms.txt)
- Full corpus: [/llms-full.txt](/llms-full.txt)

_GraphCanon - The knowledge graph for AI development. https://www.graphcanon.com/_
