Documentation Index Fetch the complete documentation index at: https://productlasso.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
1. Vytvoření schématu
Schéma definuje sloupce, které chcete extrahovat.
schema = client.schemas.create(
name = "Product Catalog" ,
columns = [
{ "key" : "product_name" , "label" : "Product Name" , "type" : "text" , "required" : True },
{ "key" : "price" , "label" : "Price" , "type" : "number" },
{ "key" : "description" , "label" : "Description" , "type" : "text" },
{ "key" : "image_url" , "label" : "Image" , "type" : "image" },
],
)
print (schema[ "id" ])
Schéma můžete také vygenerovat automaticky ze vzorových dat: schema = client.schemas.generate(
sample_data = "Product: iPhone 15 Pro, Price: $999, Storage: 128GB" ,
name = "Smartphones" ,
)
2. Nahrání souboru
Nahrajte PDF, tabulku nebo obrázek, ze kterého chcete extrahovat data.
uploaded = client.files.upload( "/path/to/catalog.pdf" )
print (uploaded[ "id" ]) # "file_abc123"
3. Vytvoření tabulky
Spusťte extrakci vytvořením tabulky s vaším schématem a nahraným souborem.
table = client.tables.create(
schema_id = schema[ "id" ],
name = "Q1 Product Catalog" ,
file_ids = [uploaded[ "id" ]],
)
print (table[ "id" ]) # "tbl_..."
print (table[ "status" ]) # "processing"
4. Čekání na výsledky
SDK obsahuje pomocnou funkci pro polling, která čeká na dokončení extrakce.
completed = client.tables.wait_for_completion(
table[ "id" ],
interval_s = 3 ,
timeout_s = 300 ,
)
print (completed[ "status" ]) # "completed"
print (completed[ "total_rows" ]) # 42
5. Získání řádků
rows = client.tables.rows(completed[ "id" ], limit = 100 )
for row in rows[ "data" ]:
print (row[ "data" ][ "product_name" ], row[ "data" ][ "price" ])
# Nebo jako pandas DataFrame
df = client.tables.results_as_dataframe(completed[ "id" ])
print (df.head())
Další
Obohacení pomocí AI Použijte AI ke generování popisků, překladu obsahu a obohacení vašich dat.