1- # Vectorless Python SDK
1+ # Vectorless
22
3- Python bindings for [ vectorless ] ( https://github.com/vectorlessflow/vectorless ) — a Document Understanding Engine for AI .
3+ Python bindings for [ Vectorless ] ( https://github.com/vectorlessflow/vectorless ) — knowing by reasoning, not vectors .
44
55## Installation
66
77``` bash
8- pip install vectorless
8+ pip install -U vectorless
99```
1010
1111## Quick Start
@@ -15,33 +15,25 @@ import asyncio
1515from vectorless import Engine
1616
1717async def main ():
18- # Create engine — api_key and model are required
19- engine = Engine(
20- api_key = " sk-..." ,
21- model = " gpt-4o" ,
22- )
18+ engine = Engine(api_key = " sk-..." , model = " gpt-4o" )
2319
24- # Understand a document
25- doc = await engine.ingest( " ./report.pdf" )
26- print ( f " Understood: { doc.name } — { doc.summary } " )
20+ # Compile a document
21+ result = await engine.compile( path = " ./report.pdf" )
22+ doc_id = result.doc_id
2723
2824 # Ask a question
29- answer = await engine.ask(
30- " What is the total revenue?" ,
31- doc_ids = [doc.doc_id],
32- )
33- print (f " Answer: { answer.content} " )
34- print (f " Confidence: { answer.confidence:.2f } " )
35- print (f " Evidence: { len (answer.evidence)} pieces " )
36- print (f " Trace: { len (answer.trace.steps)} steps " )
37-
38- # List all understood documents
25+ response = await engine.ask(" What is the total revenue?" , doc_ids = [doc_id])
26+ print (response.answer)
27+ print (f " Confidence: { response.confidence:.2f } " )
28+ print (f " Evidence: { len (response.evidence)} pieces " )
29+
30+ # List all documents
3931 docs = await engine.list_documents()
4032 for d in docs:
4133 print (f " - { d.name} ( { d.doc_id} ) " )
4234
43- # Forget a document
44- await engine.forget(doc. doc_id)
35+ # Remove a document
36+ await engine.remove_document( doc_id)
4537
4638asyncio.run(main())
4739```
@@ -59,40 +51,39 @@ class Engine:
5951 api_key : str | None = None ,
6052 model : str | None = None ,
6153 endpoint : str | None = None ,
62- config : Config | None = None ,
54+ config : EngineConfig | None = None ,
6355 ): ...
6456
65- async def ingest (self , path : str ) -> DocumentInfo: ...
66- async def ask (self , question : str , doc_ids : list[str ] | None = None ) -> Answer: ...
67- async def forget (self , doc_id : str ) -> None : ...
68- async def list_documents (self ) -> list[DocumentInfo]: ...
69- async def exists (self , doc_id : str ) -> bool : ...
70- async def clear (self ) -> int : ...
57+ async def compile (self , path : str | None = None , * , format : str | None = None , mode : str | None = None , force : bool = False ) -> IndexResultWrapper: ...
58+ async def compile_batch (self , paths : list[str ], * , mode : str | None = None , jobs : int = 4 , force : bool = False ) -> IndexResultWrapper: ...
59+ async def ask (self , question : str , doc_ids : list[str ] | None = None , timeout_secs : int | None = None ) -> Output: ...
60+ async def query_stream (self , question : str , doc_ids : list[str ] | None = None ) -> StreamingQueryResult: ...
61+ async def list_documents (self ) -> list[DocCard]: ...
62+ async def remove_document (self , doc_id : str ) -> None : ...
63+ async def document_exists (self , doc_id : str ) -> bool : ...
64+ async def clear_all (self ) -> int : ...
7165 async def get_graph (self ) -> DocumentGraph | None : ...
7266 def metrics_report (self ) -> MetricsReport: ...
7367```
7468
75- ### DocumentInfo
69+ ### IndexResultWrapper
7670
7771``` python
78- class DocumentInfo :
79- doc_id: str
80- name: str
81- format : str
82- summary: str
83- concepts: list[Concept]
84- section_count: int
85- page_count: int | None
72+ class IndexResultWrapper :
73+ doc_id: str | None
74+ items: list[DocCard]
75+ failed: list[FailedItem]
8676```
8777
88- ### Answer
78+ ### Output
8979
9080``` python
91- class Answer :
92- content : str
81+ class Output :
82+ answer : str
9383 evidence: list[Evidence]
9484 confidence: float
95- trace: ReasoningTrace
85+ trace_steps: list[TraceStep]
86+ metrics: QueryMetrics
9687```
9788
9889### Evidence
@@ -101,15 +92,19 @@ class Answer:
10192class Evidence :
10293 content: str
10394 source_path: str
95+ node_title: str
10496 doc_name: str
105- relevance: float
10697```
10798
108- ### ReasoningTrace
99+ ### DocCard
109100
110101``` python
111- class ReasoningTrace :
112- steps: list[TraceStep]
102+ class DocCard :
103+ doc_id: str
104+ name: str
105+ summary: str
106+ section_count: int
107+ concepts: list[Concept]
113108```
114109
115110### TraceStep
@@ -121,15 +116,6 @@ class TraceStep:
121116 round : int
122117```
123118
124- ### Concept
125-
126- ``` python
127- class Concept :
128- name: str
129- description: str
130- confidence: float
131- ```
132-
133119### VectorlessError
134120
135121``` python
@@ -140,24 +126,10 @@ class VectorlessError(Exception):
140126
141127## Development
142128
143- ### Building from source
144-
145129``` bash
146- # Install maturin
147130pip install maturin
148-
149- # Build and install (from project root)
150- maturin develop
151-
152- # Run tests
153- pytest
154- ```
155-
156- ### Publishing to PyPI
157-
158- ``` bash
159- maturin build --release
160- maturin publish
131+ maturin develop # Build and install
132+ pytest # Run tests
161133```
162134
163135## License
0 commit comments