可组合性

下面我们展示可组合数据结构的API参考。这包括`ComposableGraph`类以及生成`ComposableGraph`对象的任何构建器类。

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, service_context: Optional[ServiceContext] = 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.

参数
  • 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.