llama_index
llama_index copied to clipboard
[0.5.0] Composability
Conceptual changes
- Decouple index structure and data
V2IndexStruct
is no longer aBaseDocument
.
- We introduce
CompositeIndexStruct
to model a composed graph
This makes
ComposableGraph
is very similar toBaseGPTIndex
. We could unify this further later.
- Model relationship between indices via
IndexNode
IndexNode
is aNode
with a pointer to anIndexStruct
We no longer "set_text" on aIndexStruct
, which breaks various abstractions. The same can be expressed as creating anIndexNode
with some summary text, and point it to theIndexStruct
.
Storage
- We use DocumentStore to store data (i.e.
Document
andNode
)
This eliminates many ugly "if this is an index struct, do X, otherwise do Y" logic.
- We save
V2IndexStruct
separately
To support saving and loading polymorphic objects, we always save its type along with the actual object
Querying
- Remove recursive logic from
BaseGPTIndexQuery
Now recursive logic is entirely managed via
QueryRunner
. This removes mutual recursion and make things easier to reason about.
- Introduce
def retrieve
anddef synthesize
API
This makes it explicit which queries support recursive call vs. not.
Misc Change (WIP)
- group common params into
ServiceContext
object
We basically pass these around across all data objects. This is mostly an attempt to make code cleaner.
Todos
- [ ] Figure out how to deal with query type to query map
- [ ] Fix composability for tree
- [ ] Fix query combiner support
- [ ] Lint and tests
- [ ] Clean up
BaseGPTIndexQuery
ctor mess