Metadata-Version: 2.3
Name: prompt-as-method
Version: 0.3.1
Summary: Run prompts from files
License: MIT License
         
         Copyright (c) 2025 GESIS-Methods-Hub
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Keywords: ai,artificial intelligence,classification,generative model,large language model,llm,prompt
Author: Johannes Kiesel
Author-email: Johannes.Kiesel@gesis.org
Maintainer: Johannes Kiesel
Maintainer-email: Johannes.Kiesel@gesis.org
Requires-Python: >=3.10,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: chevron (>=0.14.0)
Requires-Dist: json-repair (>=0.46.0,<0.47.0)
Requires-Dist: jsonref (>=1.1.0,<2.0.0)
Requires-Dist: jsonschema (>=4.23.0)
Requires-Dist: jsonschema-fill-default (>=0.1.3.20250131,<0.2.0.0)
Requires-Dist: pydantic (>=2.10.6)
Requires-Dist: requests (>=2.32.3)
Project-URL: Issues, https://github.com/GESIS-Methods-Hub/prompt-as-method/issues
Project-URL: Source, https://github.com/GESIS-Methods-Hub/prompt-as-method
Description-Content-Type: text/markdown

# Prompt-as-Method

[![PyPI - Version](https://img.shields.io/pypi/v/prompt-as-method)](https://pypi.org/project/prompt-as-method/)
[![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FGESIS-Methods-Hub%2Fprompt-as-method%2Frefs%2Fheads%2Fmain%2Fpyproject.toml)](https://github.com/GESIS-Methods-Hub/prompt-as-method)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/GESIS-Methods-Hub/prompt-as-method/test.yml?label=tests)](https://github.com/GESIS-Methods-Hub/prompt-as-method/actions/workflows/test.yml)
[![Static Badge](https://img.shields.io/badge/licence-MIT-%2395c30d)](https://github.com/GESIS-Methods-Hub/prompt-as-method/blob/main/LICENSE)

Run prompts from files.

## Install

```shell
pip install prompt-as-method
```

## Quickstart

If you have an [Ollama](https://ollama.com/download) running on the default port on your local machine:

```shell
ollama pull llama3.1  # download model
python3 -m prompt_as_method \
    --prompt examples/sentiment/prompt.json \
    --data examples/sentiment/data.csv
```

This runs the prompt template [`examples/sentiment/prompt.json`](examples/sentiment/prompt.json) for each row of [`examples/sentiment/data.csv`](examples/sentiment/data.csv) with `{{{text}}}` replaced by the row's value for it.

## Contributing

See the [development notes](https://github.com/GESIS-Methods-Hub/prompt-as-method/blob/main/docs/development.md).

