File tree Expand file tree Collapse file tree 4 files changed +8
-6
lines changed
Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ pip install vectorless
2828
2929``` python
3030import asyncio
31- from vectorless import Engine, IndexContext
31+ from vectorless import Engine, IndexContext, QueryContext
3232
3333async def main ():
3434 # Create engine — api_key and model are required
@@ -38,11 +38,13 @@ async def main():
3838 )
3939
4040 # Index a document (PDF or Markdown)
41- result = await engine.index(IndexContext.from_file (" ./report.pdf" ))
41+ result = await engine.index(IndexContext.from_path (" ./report.pdf" ))
4242 doc_id = result.doc_id
4343
4444 # Query
45- result = await engine.query(doc_id, " What is the total revenue?" )
45+ result = await engine.query(
46+ QueryContext(" What is the total revenue?" ).with_doc_ids([doc_id])
47+ )
4648 print (result.single().content)
4749
4850asyncio.run(main())
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ async def main():
3434 )
3535
3636 # Index a document
37- result = await engine.index(IndexContext.from_file (" ./report.pdf" ))
37+ result = await engine.index(IndexContext.from_path (" ./report.pdf" ))
3838 doc_id = result.doc_id
3939
4040 # Query
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ async def main():
3232 model = " gpt-4o" ,
3333 )
3434
35- result = await engine.index(IndexContext.from_file (" ./report.pdf" ))
35+ result = await engine.index(IndexContext.from_path (" ./report.pdf" ))
3636 doc_id = result.doc_id
3737
3838 answer = await engine.query(doc_id, " What is the total revenue?" )
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ async def main():
5555
5656 # Index a document
5757 result = await engine.index(
58- IndexContext.from_file ("./report.pdf")
58+ IndexContext.from_path ("./report.pdf")
5959 )
6060 doc_id = result.doc_id
6161
You can’t perform that action at this time.
0 commit comments