Skip to main content

The official Python library for the teraflopai API

Project description

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)

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

teraflopai-0.1.13.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

teraflopai-0.1.13-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file teraflopai-0.1.13.tar.gz.

File metadata

  • Download URL: teraflopai-0.1.13.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for teraflopai-0.1.13.tar.gz
Algorithm Hash digest
SHA256 5d6fe92fd3c91e89445964d5c69d8d05956f1cd5164a9cccb1fd337e3b28b96e
MD5 b64d2dd540a636493be246ee87fecc94
BLAKE2b-256 13a2073318ed3a6a81a94c9fdce981d30c08b5e272a4b800c66afb3d3c27abfc

See more details on using hashes here.

File details

Details for the file teraflopai-0.1.13-py3-none-any.whl.

File metadata

File hashes

Hashes for teraflopai-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 059da87788af14f67af694f015812c4c798aa39a25fac672ab24a5baeaa98f03
MD5 5df9ff87d84ca38ee7e2b70ca766861c
BLAKE2b-256 99771b98861c220892ed5ce3a030fac1731752a626f35786fad7e5d72794d060

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