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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lasso_ai-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1707452db87ee626f9a6e7900f7d720cb6e7c9068b096892ed6e41b42327e5dd
MD5 152c3706221377b464cf6f5aa75078de
BLAKE2b-256 9e0afa8a8ac4c8ebef052c01dc139f490f2c2eb56e997a87606e2e33b4397a5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lasso_ai-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78524754b4a64c1d2d15f72047f92e98eb1264bc92af24405aade1cd730c8bfa
MD5 42bff9660f11baa38fe24095acef2ec9
BLAKE2b-256 e1ab7d38e30bab3e99592b971caba400162b7c884fc3b561fda4a974e851e037

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