Composability

Below we show the API reference for composable data structures. This contains both the ComposableGraph class as well as any builder classes that generate ComposableGraph objects.

Init composability.

class llama_index.composability.ComposableGraph(all_indices: Dict[str, BaseGPTIndex], root_id: str)

Composable graph.

classmethod from_indices(root_index_cls: Type[BaseGPTIndex], children_indices: Sequence[BaseGPTIndex], index_summaries: Optional[Sequence[str]] = None, **kwargs: Any) ComposableGraph

Create composable graph using this index class as the root.

get_index(index_struct_id: Optional[str] = None) BaseGPTIndex

Get index from index struct id.

class llama_index.composability.QASummaryQueryEngineBuilder(storage_context: Optional[StorageContext] = None, service_context: Optional[ServiceContext] = None, summary_text: str = 'Use this index for summarization queries', qa_text: str = 'Use this index for queries that require retrieval of specific context from documents.')

Joint QA Summary graph builder.

Can build a graph that provides a unified query interface for both QA and summarization tasks.

NOTE: this is a beta feature. The API may change in the future.

Parameters
  • docstore (BaseDocumentStore) – A BaseDocumentStore to use for storing nodes.

  • service_context (ServiceContext) – A ServiceContext to use for building indices.

  • summary_text (str) – Text to use for the summary index.

  • qa_text (str) – Text to use for the QA index.

  • node_parser (NodeParser) – A NodeParser to use for parsing.

build_from_documents(documents: Sequence[Document]) RouterQueryEngine

Build query engine.