Skip to main content

The Python SDK for LatentSense Inc services. www.latentsense.com

Project description

LatentSense Python SDK

Overview

The LatentSense Python SDK provides a convenient client for interacting with the Latentsense Interactive API. It simplifies authentication, file uploads, and requests to various API endpoints for text analysis and manipulation.

Installation

pip install latentsense-sdk

Configuration

The client can be configured by passing parameters to its constructor or by using environment variables.

Constructor Arguments

You can initialize the client directly with your credentials:

from latentsense_sdk import LatentSenseClient

client = LatentSenseClient(
    project_id="your-project-id",
    api_key="your-api-key",
)

Environment Variables

If constructor arguments are not provided, the client will fall back to reading from environment variables:

  • LST_PROJECT_ID: Your LatentSense project ID.
  • LST_API_KEY: Your LatentSense API key.

For example, in your shell:

export LST_PROJECT_ID="your-project-id"
export LST_API_KEY="your-api-key"

Usage

See https://docs.latentsense.com

Here's a basic example of how to initialize the client and use it to redact Personally Identifiable Information (PII) from a document.

import os
from latentsense_sdk import LatentSenseClient

# The client is configured via environment variables.
# Ensure they are set before running, for example:
# os.environ["LST_PROJECT_ID"] = "your-project-id"
# os.environ["LST_API_KEY"] = "your-api-key"

client = LatentSenseClient()

# Example 1: Create RxMap
in_memory_file = ("report.txt", "This is a report about Jane Smith.")
rx_map_results = client.create_rx_map(files=[in_memory_file])

for result in rx_map_results:
    print(f"--- Results for {result.original_file_name} ---")
    print(f"Nodes in graph: {result.graph.nodes}")


# Example 2: Redact PII
in_memory_file = ("report.txt", "This is a report about Jane Smith.")
redacted_results = client.redact_pii(files=[in_memory_file])

for result in redacted_results:
    print(f"--- Results for {result.original_file_name} ---")
    print(f"Redacted text: {result.redacted_text}")

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

latentsense_sdk-1.0.9.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

latentsense_sdk-1.0.9-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file latentsense_sdk-1.0.9.tar.gz.

File metadata

  • Download URL: latentsense_sdk-1.0.9.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for latentsense_sdk-1.0.9.tar.gz
Algorithm Hash digest
SHA256 3d05b0f8799d6d090a1b06efa2ccdbf342ee897b8af6fe32595014e4723ef52d
MD5 1e63697ec36ecd16de7d9403c969e602
BLAKE2b-256 44d9cdfe351f4377b20f23f6e3b54d4331ecd6b9955c808807f70ca1c9b2d6d8

See more details on using hashes here.

File details

Details for the file latentsense_sdk-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for latentsense_sdk-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6c180852dcd289310953e945811d4b66b988ec0088f1e9ba3e97474d17056e13
MD5 4c24f69ef52c17ae624d5884788cd22c
BLAKE2b-256 fba7716ac19eeca9c7be706fb85422ff28772b51d666540ea873e7ddacc6b351

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