Skip to main content

Prompt Development and Evaluation tool

Project description

Prompeteer

By Yoaz Menda yoazmenda@gmail.com

pypi.org/prompeteer

Prompt evaluation and development environment

  • Define a prompt template and run it with different variables from an input.csv file
  • supports AzureOpenAi (GPT), AWS Bedrock (Anthropic Claude)
  • write output to an output.csv file (or just the console)

requirements

  • Azure CLI. (brew update && brew install azure-cli)
  • AWS CLI. (brew update && brew install awscli)

installation

pip install prompeteer

usage

Azure OpenAI - GPT

  1. Install Azure CLI and run az login

  2. choose an AzureOpenAI Resource to work with and specify it in the AZURE_OPENAI_RESOURCE_NAME environment variable.

  3. Create your prompt configuration YAML file:

# azure_openai_prompt.yaml
version: 1.0
name: my_prompt
provider: azure
schemaVersion: 1.0
variables:
  - name: topic
    required: true
  - name: year
    required: true
  - name: summary
    required: true
request:
  model: 'gpt-35-turbo' # corresponds to the AzureOpenAi deployment name
  temperature: 0.8
  topP: 1.0
  n: 1
  stream: false
  presencePenalty: 0.0
  frequencyPenalty: 0.0
  stop:
  user:
  messages:
    - role: system
      content: "You are a helpful assistant."
    - role: user
      content: "give a short summary about {{topic}} in the year {{year}} ahd here is a summary example"

AWS Bedrock - Claude

  1. Install the AWS CLI and login

  2. authenticate using (verify that the correct profile is on at ~/.aws/credentials)

  3. Create your prompt configuration YAML file:

# aws_bedrock_prompt.yaml
version: 1.0
name: formal
provider: aws
schemaVersion: 1.0
variables:
   - name: topic
     required: true
   - name: year
     required: true
   - name: summary
     required: true
request:
   model: 'anthropic.claude-3-haiku-20240307-v1:0'
   temperature: 0.8
   topP: 1.0
   topK: 2
   maxTokens: 250
   messages:
      - role: user
        content: "summarize about {{topic}} in the year {{year}} use this example summary: {{summary}}. do it in a very formal way"
      - role: assistant
        content: "You are a helpful assistant."
from prompeteer import prompeteer

prompeteer.run_prompt(prompt_config_file_path='azure_openai_prompt.yaml',
                      output_csv='./output.csv',
                      include_prompt=True,  # show request + response in the output
                      input_csv='./input.csv',
                      destination='file'  # write output to CSV file
                      )

prompeteer.run_prompt(prompt_config_file_path='aws_bedrock_prompt.yaml',
                      include_prompt=False,  # show only request in the output
                      input_csv='./input.csv',
                      row_numbers_to_process=[0, 1],  # use and run only rows 0 and 1 from the input.csv 
                      destination='console'  # write output to the console
                      )

input.csv example: ("|" seperated)

"topic"|"year"|"summary"

"basketball"|2002|"A famous quote: ""Just do it"".

"soccer"|1999|"Championship game was exciting"

development

python -m venv venv
source ./venv/bin/activate

install locally and run tests

pip install -e .
./test.sh

build and publish to pypi.org.

./publish.sh

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

prompeteer-0.3.6.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

prompeteer-0.3.6-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file prompeteer-0.3.6.tar.gz.

File metadata

  • Download URL: prompeteer-0.3.6.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for prompeteer-0.3.6.tar.gz
Algorithm Hash digest
SHA256 b5456735b391cb30e4ba749c60b5dafaac4df0eae03d080d988e9463f994544f
MD5 a8be0a2253bb5961ee50d856a01fa05e
BLAKE2b-256 30205c9af883166a8d3db1c3357ab8dfbc7e597cb540b996563e4c975eead83f

See more details on using hashes here.

File details

Details for the file prompeteer-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: prompeteer-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for prompeteer-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0edc438b8f986748ded238a6cfecd6f50d12df745dd50498f66d9c7c9a26f65c
MD5 e67e6d791252b82bc45a51ded982c48b
BLAKE2b-256 9bc9334829d2a2c42fef9006deabf6573d6ff59978d8e897beb719ae1d48e5ba

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