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.core.composability.ComposableGraph(all_indices: Dict[str, BaseIndex], root_id: str, storage_context: Optional[StorageContext] = None)#

Composable graph.

classmethod from_indices(root_index_cls: Type[BaseIndex], children_indices: Sequence[BaseIndex], index_summaries: Optional[Sequence[str]] = None, service_context: Optional[ServiceContext] = None, storage_context: Optional[StorageContext] = None, **kwargs: Any) ComposableGraph#

Create composable graph using this index class as the root.

get_index(index_struct_id: Optional[str] = None) BaseIndex#

Get index from index struct id.

class llama_index.core.composability.QASummaryQueryEngineBuilder(llm: Optional[LLM] = None, embed_model: Optional[BaseEmbedding] = None, callback_manager: Optional[CallbackManager] = None, transformations: Optional[List[TransformComponent]] = None, storage_context: Optional[StorageContext] = 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.', service_context: Optional[ServiceContext] = None)#

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.