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
Release history Release notifications | RSS feed
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.1.tar.gz
(12.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptscan_sdk-0.1.1.tar.gz.
File metadata
- Download URL: promptscan_sdk-0.1.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.21.0 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1fd901ea75f71fcd209195dec826945ee0df08e525078afe86d6ca08b13a2ed
|
|
| MD5 |
6dd20262f278ca619f81065bb6390431
|
|
| BLAKE2b-256 |
68fa27707e6f3eb8ce7d7408c58a0e3f83d9d14953a1a666dc546856502c526d
|
File details
Details for the file promptscan_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: promptscan_sdk-0.1.1-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.12.7 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e8998b12b2e2dbebed8fc27e85e693f97a69591f11c622e35df13bf09d4aef4
|
|
| MD5 |
eea503b3b774459aff648f2daa95cfd7
|
|
| BLAKE2b-256 |
db9ba68d587f844335ae0e1b8a2f90c815caac23b2463c5daf6b4da00d1eecc9
|