Skip to main content

Official Python SDK for the Lasso API — AI-powered product data extraction, enrichment, and web search. Extract structured data from PDFs, URLs, and text. Enrich products with AI-generated descriptions, pricing, and specs.

Project description

lasso-ai

Official Python SDK for the Lasso API — AI-powered product data extraction, enrichment, and web search.

Search for products across the web and get structured results. Enrich partial product records with complete data including pricing, specs, and descriptions — all backed by citations. Extract structured data from PDFs, spreadsheets, URLs, and raw text into clean, typed tables. Export as JSON, CSV, XLSX, or images.

Features:

  • Search — Find products with natural language queries, get structured data back instantly
  • Enrich — Pass partial product info, get complete records with citations and confidence scores
  • Extract — Pull structured data from PDFs, CSVs, URLs, and free-form text
  • Enhance — AI-generate descriptions, translations, and computed fields for any column
  • Export — Download tables as JSON, CSV, XLSX, or image archives
  • Schemas — Define and reuse column structures across tables
  • Glossary — Manage translation terms and brand-specific vocabulary

Installation

pip install lasso-ai

With pandas support:

pip install lasso-ai[pandas]

Usage

from lasso import LassoClient

lasso = LassoClient(api_key="lasso_...")

Schemas

schema = lasso.schemas.create(
    name="Products",
    columns=[
        {"key": "name", "label": "Product Name", "type": "text", "required": True},
        {"key": "price", "label": "Price", "type": "number"},
        {"key": "description", "label": "Description", "type": "richtext"},
    ],
)

schemas = lasso.schemas.list()
detail = lasso.schemas.get(schema["id"])

Files

file = lasso.files.upload("products.pdf")
files = lasso.files.list()

Tables

table = lasso.tables.create(
    schema_id=schema["id"],
    name="My Products",
    file_ids=[file["id"]],
)

# Poll until extraction completes
result = lasso.tables.wait_for_completion(table["id"])

rows = lasso.tables.rows(result["id"])

Enhancement

job = lasso.enhance.cells(
    table["id"],
    row_ids=["row-1", "row-2"],
    column_key="description",
    prompt="Write a product description based on {{Product Name}}",
)

status = lasso.enhance.status(table["id"])

Export

csv_data = lasso.export.csv(table["id"])
json_data = lasso.export.json(table["id"])

# Download xlsx to disk
lasso.export.xlsx(table["id"], path="products.xlsx")

Pandas integration

df = lasso.tables.results_as_dataframe(table["id"])
print(df.head())

Glossary

lasso.glossary.create(term="LCD", type="do_not_translate")
terms = lasso.glossary.list()

Credits

balance = lasso.credits.balance()
usage = lasso.credits.usage(from_="2026-01-01")

Search

results = lasso.search(
    query="wireless noise-cancelling headphones under $200",
    max_results=5,
)

for item in results["results"]:
    print(item["data"]["name"], item["source_url"])

# With a custom schema
results = lasso.search(
    query="ergonomic office chairs",
    columns=[
        {"key": "name", "label": "Name", "type": "text"},
        {"key": "price", "label": "Price", "type": "number"},
        {"key": "rating", "label": "Rating", "type": "number"},
    ],
)

Enrich

enriched = lasso.enrich(
    items=[
        {"data": {"name": "Sony WH-1000XM5"}},
        {"data": {"name": "Apple AirPods Pro 2"}},
    ],
    columns=[
        {"key": "name", "label": "Name", "type": "text"},
        {"key": "price", "label": "Price", "type": "number"},
        {"key": "description", "label": "Description", "type": "richtext"},
    ],
    web_search=True,
    thinking="medium",
)

for item in enriched["items"]:
    print(item["data"]["name"], item["data"]["price"])
    for field in item["basis"]:
        print(f"  {field['field']}: {field['confidence']}", field["citations"])

Context manager

with LassoClient(api_key="lasso_...") as lasso:
    schemas = lasso.schemas.list()

Error handling

from lasso import LassoClient, LassoError

try:
    lasso.schemas.get("non-existent")
except LassoError as e:
    print(e.status_code)   # 404
    print(e.error_type)    # "not_found"
    print(e.request_id)    # "req_..."

License

MIT

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

lasso_ai-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

lasso_ai-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file lasso_ai-0.1.0.tar.gz.

File metadata

  • Download URL: lasso_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for lasso_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4b68b915d13bc90758440c0c09589b885e8d32075683875e2dddd220ccb55005
MD5 66e0d1cd1decacc5b3fa868dc5f6083e
BLAKE2b-256 a71e72ae6e970760ef4404ad4deb721d330dd03dc91acadef5200fdd8910f4cb

See more details on using hashes here.

File details

Details for the file lasso_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lasso_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for lasso_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 872bb763b331529188e97adfffaf2b6425c45b0ae22ac357886cf30e6a684753
MD5 c22f65799eb67de861b6f126430ea462
BLAKE2b-256 a50d723ce6790070984b87d5782f88458971affe5fc71228278ad8dffa76ff67

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