Skip to main content

No project description provided

Project description

PromptScan Python SDK

The PromptScan Python SDK provides a simple way to integrate PromptScan's monitoring and analytics capabilities into your LLM application.

Installation

pip install promptscan-sdk

Quick Start

import promptscan_sdk
from promptscan_sdk.client import GenerationInput, GenerationMessageInput, UsageInput
from datetime import datetime, UTC

# Initialize the SDK
promptscan_sdk.configure(api_key="your-project-api-key")

# Collect generation data
promptscan_sdk.collect(
    GenerationInput(
        session_id="unique-session-id",
        id="generation-id",
        model="gpt-4",
        messages=[
            GenerationMessageInput(role="system", content="You are a helpful assistant.")
        ],
        usage=UsageInput(
            prompt_tokens=100,
            completion_tokens=50,
            total_tokens=150
        ),
        created=datetime.now(tz=UTC),
        duration=0.5,
        time_to_first_token=0.15
    )
)

# Close the SDK on application exit, since it uses background threads for non-blocking flushing of the generations that should be stopped and generation buffer flushed.
promptscan_sdk.close()

Multiple api-key support

You can log generations for different projects by using multiple project api-keys.

collect(generation_a_input, api_key="your-project-A-api-key")
collect(generation_b_input, api_key="your-project-B-api-key")

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

promptscan_sdk-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

promptscan_sdk-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file promptscan_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: promptscan_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.21.0 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for promptscan_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8b4c853d7912fff728f6faf3644bd79dd54032d66c50f676752652f8c728084
MD5 8441f499233f6ffdb2edbc09edb2f93e
BLAKE2b-256 945e436451fbf3d66d6b325daeaf49ba6ab89402cc105965268fa41f8fa96a21

See more details on using hashes here.

File details

Details for the file promptscan_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: promptscan_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.21.0 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for promptscan_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c206509a025f367d1ae014a526371e89a76d6968e5bd46f88a2b7366ae6dced
MD5 a2367adb400ba259890f10cabea68744
BLAKE2b-256 95c7a33ccc8735979058ecb5e39d924b0cc070db53304ac7700471af5e857c73

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