Skip to main content

No project description provided

Project description

Pangram Labs Python Package

Installation

pip install pangram-sdk

Add your API key

Add your API key as an environment variable, or pass it directly to the Pangram constructor.

export PANGRAM_API_KEY=<your API key>
from pangram import Pangram
# If the environment variable PANGRAM_API_KEY is set:
pangram_client = Pangram()

# Otherwise, pass the API key directly:
my_api_key = ''  # Fill this in with your API key.
pangram_client = Pangram(api_key=my_api_key)

Make a request

Main prediction method (AI-assistance detection and segment-level analysis):

from pangram import Pangram
pangram_client = Pangram()

result = pangram_client.predict(text)
stage = result['stage']  # "STAGE_SUCCESS" after predict() completes.

# Analysis with AI-assistance detection.
fraction_ai = result['fraction_ai']
fraction_ai_assisted = result['fraction_ai_assisted']
fraction_human = result['fraction_human']
num_ai_segments = result['num_ai_segments']

# Access individual window classifications
for window in result['windows']:
    label = window['label']  # e.g., "AI-Generated", "Moderately AI-Assisted"
    ai_assistance_score = window['ai_assistance_score']
    confidence = window['confidence']  # "High", "Medium", "Low"

predict() submits to Pangram's async inference API and waits for the result before returning. Use predict(text, public_dashboard_link=True) or predict_with_dashboard_link(text) to include a dashboard_link in the completed result.

Building Documentation

Install docs dependencies and build:

poetry install --with docs
cd docs && make html

Questions? Email support@pangram.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

pangram_sdk-0.2.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

pangram_sdk-0.2.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pangram_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: pangram_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pangram_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6fa8b5529cf9f1d52709ddff1e63d0019c213f45aa56f88ed4f4d560d93e3e42
MD5 0cbb2afd0149a3ba4d1e26f88b31848d
BLAKE2b-256 8207ef74b64b888f69670368693b35a0ffcb4621a5d3920c7afe8f9162add26d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pangram_sdk-0.2.0.tar.gz:

Publisher: publish-to-pypi.yml on pangramlabs/pangram-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pangram_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pangram_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pangram_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62081b198bd26595dce7e760bc24fd7d4fbf2f595eb986ee7be9edb1e263d31e
MD5 56740c1eceadae3a290d5dd443da2de9
BLAKE2b-256 70f6661e374c3a1741911609b080f29bd6f6154e3e747680c07361cb5ce390c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pangram_sdk-0.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on pangramlabs/pangram-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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