Skip to main content

A simple tracker for OpenAI API calls for Pype App

Project description

pypeprompts

PyPI version Python Versions Downloads

A Python SDK for tracking and sending analytics data to Pype App.

Important Notice

This package is designed to send data to Pype App, a SaaS application. By using this package, you agree to the terms of service of Pype App. Please ensure you have the necessary rights and permissions to send this data.

Installation

You can install pypeprompts using pip:

pip install --upgrade pypeprompts

Or if you prefer using Poetry:

poetry add pypeprompts

Requirements

  • Python 3.8.1 or higher

Obtaining Your Project Token

To use pypeprompts, you'll need a project token. This token is used to authenticate your requests and associate the analytics data with your account. You can obtain your project token by following these steps:

  1. Visit pypeai.com and log in to your account.
  2. Create a project.
  3. Click on Publish to generate the token.

If you encounter any issues or need assistance obtaining your project token, please contact dhruv@pypeai.com

Usage

Here's a quick example of how to use pypeprompts:

from pypeprompts import PromptAnalyticsTracker

# Initialize the tracker with your project token from pypeai.com
tracker = PromptAnalyticsTracker(project_token="your_project_token")

# Track an event and get the promptId
prompt_id = tracker.track("workflow_name", {
    "prompt": "Your input prompt",
    "output": "Generated output",
    "processingTime": 1.5,
    "tags": ["tag1", "tag2"],
    "attributes": {"key": "value"}
})
print(f"Prompt ID: {prompt_id}")

# Async tracking
import asyncio

async def async_track():
    prompt_id = await tracker.track_async("async_workflow", {
        "prompt": "Async input prompt",
        "output": "Async generated output",
        "processingTime": 0.8,
        "tags": ["async", "example"],
        "attributes": {"async_key": "async_value"}
    })
    print(f"Async Prompt ID: {prompt_id}")

asyncio.run(async_track())

Features

  • Simple API for tracking and sending analytics data to Pype App
  • Synchronous and asynchronous tracking methods
  • Returns a unique promptId for each tracked event
  • Customizable logging
  • Error handling and reporting

Configuration

You can configure the PromptAnalyticsTracker with the following parameters:

  • project_token (required): Your project token for authentication (obtained from pypeai.com)
  • enabled (optional): Set to False to disable tracking (default: True)

Error Handling

The package uses a custom PromptAnalyticsError for error handling. Make sure to catch this exception in your code for proper error management.

Logging

pypeprompts uses Python's built-in logging module. Logs are written to both a file (prompt_analytics.log) and the console. You can adjust the log level as needed.

Data Privacy and Security

This package sends data to Pype App. Please ensure you comply with all applicable data protection laws and regulations when using this package. Do not send sensitive or personal information unless you have the necessary permissions and security measures in place.

License

This project is proprietary software. All rights reserved. You are granted a limited license to use this software in conjunction with Pype App services, subject to the terms of service of Pype App.

Support

If you encounter any problems or have any questions, please open an issue on the GitHub repository or contact the author at dhruv@pypeai.com.

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

pypeprompts-0.0.6.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

pypeprompts-0.0.6-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pypeprompts-0.0.6.tar.gz.

File metadata

  • Download URL: pypeprompts-0.0.6.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Darwin/19.6.0

File hashes

Hashes for pypeprompts-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4061b39f66177eb412cda9211204c25fe19a37efd7c5d645dad76c5b6f4cbcd0
MD5 e9ec96bd7293baaccd4cfb48ca9d74ad
BLAKE2b-256 5d80c89f5d51a5af5d51e4aab72612fd6881ae107d6b89a3cb848900254128b2

See more details on using hashes here.

File details

Details for the file pypeprompts-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pypeprompts-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Darwin/19.6.0

File hashes

Hashes for pypeprompts-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b654d1bac3e5db676e1c6573b17939ba01e8e5230441d2bade1157755d2fb4f0
MD5 3cc0bd64738dee379223dae8de430a93
BLAKE2b-256 621621784a88f59229c60c15cf9396817983ca28b8619baf76cc932b79ccf913

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