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.14.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.14-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: teraflopai-0.1.14.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.14.tar.gz
Algorithm Hash digest
SHA256 a90b4c762dc470ac5eda7fccd91d550808768801f4862670078447c063de7328
MD5 b79ae637a05db48092d48c67e54ea029
BLAKE2b-256 ab7fa2c7dfe7b4576716cea782ad66ca07755544d433b6a19b4fcb21e5a188fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teraflopai-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 ff2e2724a5f62488af3b1876e7b66fabb9d0e0360b4677761290074c7608eb82
MD5 e2e282cbb8c244a79dd5e5588cdc0e40
BLAKE2b-256 76f3e5d8d46b4212fabc6b86ea8725881666ae9e3f1669787d8faf46ff0b6ba7

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