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
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
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 latentsense_sdk-1.0.8.tar.gz.
File metadata
- Download URL: latentsense_sdk-1.0.8.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f65ec048d45ab68ac0647b2f3e4be3076ccb2a04a2ff3cf3b75d5191c8d61b9
|
|
| MD5 |
b79cef89081c8eca505735264f3b7a50
|
|
| BLAKE2b-256 |
f6d8b8e9676a64159374cf6c23a70340b63edbcbaf86c3b1d207622d008030d7
|
File details
Details for the file latentsense_sdk-1.0.8-py3-none-any.whl.
File metadata
- Download URL: latentsense_sdk-1.0.8-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c9073bda2516928785274ab01a0357085b1357b918f52e3327fe9ddbfd50221
|
|
| MD5 |
91aa5f4dc2b8193e3f41129ff9cdd887
|
|
| BLAKE2b-256 |
36eef01b987e2b356c9716d575c037175c1e54c3546761690f55a0eadaa8377d
|