response = requests.post( "https://api.lighton.ai/api/v3/search", headers=headers, json={ "query": "What is the vacation policy at LightOn?", "workspace_id": [42], "max_results": 3, },)for result in response.json()["results"]: score = result["score"]["reranking"] or result["score"]["retrieval"] print(f"[p.{result['source']['page_start']}–{result['source']['page_end']}, score={score:.2f}]") print(result["content"][:120]) print()
[p.4–4, score=0.94]Employees are entitled to 25 days of paid leave per year...[p.4–4, score=0.87]Unused vacation days carry over up to a maximum of 10 days...[p.7–7, score=0.71]Public holidays are in addition to the annual leave entitlement...
Three API calls — upload, wait, search. That’s the full pipeline.
Next: Authentication
Learn how API keys work and how to handle auth errors.