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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lasso_ai-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 5ca3df0b970744aa9f1eff85af9d0aaa466f5a4e690aa6f916a5d8f7d6a39e05
MD5 173616f81ac21748f79998257b0447e8
BLAKE2b-256 ea6ed4dc42e8425bab6113c3be7a31d5e213bba830ede24f50f7f455e011a189

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lasso_ai-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5a838cb37bf0e33151167d8f82dc5be125ed7bf287ee44e9f7882c56ecb5585c
MD5 4dcba7fec9a0193de9968855e67f7910
BLAKE2b-256 a6e8e0d0163104fd7a6d08bc848554aeb60a9268f362dcda3ccbe793f362972f

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