Skip to main content

Teraflop AI Python API library

Installation

# install from PyPI
pip install teraflopai

Usage

export TERAFLOPAI_API_KEY="your_api_key_here"

Search Engine API

from teraflopai import TeraflopAI

url = "https://api.caselaw.teraflopai.com/v1/search/free"

client = TeraflopAI(url=url)

results = client.search("City of Houma")

print(results["results"])

Embeddings API

from teraflopai import TeraflopAI

url = "https://api.teraflopai.com/v1/embeddings/free"

client = TeraflopAI(url=url)

results = client.embeddings(
    query="City of Houma", 
    model="concept-embedding-legal-nano"
)

print(results["data"][0]["embedding"])

Segmentation API

from teraflopai import TeraflopAI

url = "https://api.segmentation.teraflopai.com/v1/segmentation/free"

client = TeraflopAI(url=url)

text = """
UNITED STATES of America, Appellee, v. Daniel Dee VEON, Appellant.
No. 72-1889.
United States Court of Appeals, Ninth Circuit.
Feb. 12, 1973.

Claude 0. Allen, Oakland, Cal., for appellant.
James L. Browning, Jr., U. S. Atty., F. Steele Langford and Jerry K. Cimmet, Asst. U. S. Attys., San Francisco, Cal., for appellee.
Before TRASK, GOODWIN and WALLACE, Circuit Judges.
PER CURIAM:

Daniel Dee Veon appeals from convictions of violations of 21 U.S.C. § 841 (a) (1) (possession of marijuana with intent to distribute); two counts of 21 U.S.C. § 843(b) (use of telephone to commit or to facilitate commission of felonies under Title 21); 21 U.S.C. § 846 (conspiracy to distribute and to possess with intent to distribute marijuana).

Defendant contends the district court erred: (1) in restricting the reeross-examination of a government witness; (2) in receiving into evidence a tape recording and a written transcript of the tape; and (3) in submitting the case to the jury, upon evidence which he asserts was insufficient to support the verdict.

Customs agents observed a load of 400 kilograms of marijuana being brought in from Mexico. The agents arrested the smugglers and had them make a “controlled delivery” to Donald Lynch, their employer. Lynch was arrested and agreed to cooperate with police. With police listening and taping the call, Lynch phoned Veon and told him that the “stuff” was in for “Gary.” Veon said, “Yeah, okay, uh?” Lynch replied, “Same old thing.” Veon signified assent. This call is the basis for the second count of the indictment.
"""

results = client.segment(text)

print(results["results"])

Beta functionality only available upon request

OpenAI compatible API

import os
from openai import OpenAI

client = OpenAI(
    base_url="",
    api_key=os.environ.get("TERAFLOPAI_API_KEY"),
)

response = client.embeddings.create(
    input=[
        "Your text string goes here",
        "Another text string",
    ],
    model=""
)

print(response)

Metadata

Release files for teraflopai 0.1.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teraflopai 0.1.14
File Size Uploaded Provenance
teraflopai-0.1.14.tar.gz 7.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for teraflopai 0.1.14
File Interpreter ABI Platform
teraflopai-0.1.14-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / teraflopai-0.1.14.tar.gz

Download URL teraflopai-0.1.14.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a90b4c762dc470ac5eda7fccd91d550808768801f4862670078447c063de7328
BLAKE2b-256 checksum
How to use checksums
ab7fa2c7dfe7b4576716cea782ad66ca07755544d433b6a19b4fcb21e5a188fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / teraflopai-0.1.14-py3-none-any.whl

Download URL teraflopai-0.1.14-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff2e2724a5f62488af3b1876e7b66fabb9d0e0360b4677761290074c7608eb82
BLAKE2b-256 checksum
How to use checksums
76f3e5d8d46b4212fabc6b86ea8725881666ae9e3f1669787d8faf46ff0b6ba7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Security for teraflopai 0.1.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page