Skip to content

Commit bcf7472

Browse files
committed
refactor(docs): update API usage examples with new QueryContext and from_path methods
- Replace IndexContext.from_file() with IndexContext.from_path() in documentation examples - Update query method to use QueryContext with with_doc_ids() instead of direct doc_id parameter - Add QueryContext import to code examples
1 parent f5b1f3f commit bcf7472

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pip install vectorless
2828

2929
```python
3030
import asyncio
31-
from vectorless import Engine, IndexContext
31+
from vectorless import Engine, IndexContext, QueryContext
3232

3333
async 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

4850
asyncio.run(main())

docs/blog/2026-04-12-welcome/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

docs/docs/intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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?")

docs/src/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)