Skip to main content

A tool for prompt experimentation and collaboration without additional cloud service.

Project description

PrompTrace

From building and tracking experiments to productionizing prompts.

Why PrompTrace

Prompt engineering is often done by software engineers with little to no background in ML or Data Science. PrompTrace is designed to simplify the process, enabling easy experiment setup, prompt evaluation, and production tracking.

Key Benefits:

✅ Easy to adopt – No ML or Data Science expertise required.

✅ Self-contained – No need for additional cloud services for tracking or collaboration.

✅ Seamless integration – Works within your existing web, mobile, or backend project.

Core Concepts

Experiment

Experiment is at the center of PrompTrace. An experiment means running a prompt for a dataset and evaluating the outcome against some defined metrics. It is provided as a json file.

Parts of an expriment are -

  • Model: Configuration to connect to an LLM endpoint.

  • Prompt Template: It is a path for a file which contains the prompt text. The prompt template may include placeholders, which are dynamically replaced with data from a dataset.

    Prompt template format

      <<system>>
      TEXT FOR SYSTEM PROMPT GOES HERE.
    
      <<user>>
      TEXT FOR USER PROMPT GOES HERE. FOR PLACEHOLDER, USE THIS SYNTAX <PLACEHOLDER>.
    

    Make sure <<system>> and <<user>> are written like this. For placeholders, use this syntax <placeholder>.

  • Dataset: It is a path for a json file which contains the evaluation dataset.

    Dataset template format

      [
          [
              {"title":"sample_title", "value":"sample_text"}, 
              ...
              ...
              {"title":"sample_title", "value":"sample_text"}
          ],
          [
              {"title":"sample_title", "value":"sample_text"}, 
              ...
              ...
              {"title":"sample_title", "value":"sample_text"}
          ]
      ]
    
  • Evaluation (optional): It is a list of evaluation metrics.

Tracer

Tracer stores the experiment output.

How to use

  • Install the promptrace library.

      pip install promptrace
    
  • Create a folder for prompt template and store the prompt template there.

  • Create a folder for dataset and store the dataset there.

Sample code

import json
from promptrace import PrompTrace

# Define the experiment configuration
experiment_config = {
    "model": {
        "type": "azure_openai",
        "api_key": "your_api_key",
        "api_version": "your_api_version",
        "endpoint": "your_endpoint",
        "deployment": "deployment_name"
    },
    "prompt_template": "prompt_template_path",
    "dataset": "dataset_path",
    "evaluation": [
        {"metric": "metric_name"}
        {"metric": "metric_name"}
    ]
}

# Define the tracer configuration
tracer_config = {
    "type": "tracer_type",
    "target": "target_folder"
}

# Create a PrompTrace instance and run the experiment
prompt_trace = PrompTrace(tracer=tracer_config)
prompt_trace.run(experiment_config)

Samples

[coming soon]

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

promptrace-0.1.3.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

promptrace-0.1.3-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file promptrace-0.1.3.tar.gz.

File metadata

  • Download URL: promptrace-0.1.3.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for promptrace-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0e277e8685b0bbe055d1a2b2ac21eeab232bfed4c29f1de8492dba2e0cc836af
MD5 0ac7caab0fe636acc16250218d899763
BLAKE2b-256 09177ef272db5223db079427dfc58d93fcb63dbfbdab28adef1352499d42a972

See more details on using hashes here.

File details

Details for the file promptrace-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: promptrace-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for promptrace-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fc7ee8e9b4c84e4da5aa94536a6f8daaf9d4855b890e855940c73422c5e90c88
MD5 5b9a0f0838346fee8f4e18952f22c96f
BLAKE2b-256 d2f2671cc58880cd672ff3af800b27566297160bf250890338e3f1ef0a9b5f2f

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