GraphIndexCreator#

class langchain_community.graphs.index_creator.GraphIndexCreator[source]#

基础类:BaseModel

创建图形索引的功能。

通过解析和验证来自关键字参数的输入数据来创建一个新模型。

如果输入数据无法验证以形成有效模型,则引发 [ValidationError][pydantic_core.ValidationError]。

self 被显式地设为仅位置参数,以允许 self 作为字段名称。

param graph_type: Type[NetworkxEntityGraph] = <class 'langchain_community.graphs.networkx_graph.NetworkxEntityGraph'>#
param llm: BaseLanguageModel | None = None#
async afrom_text(text: str, prompt: BasePromptTemplate = PromptTemplate(input_variables=['text'], input_types={}, partial_variables={}, template="You are a networked intelligence helping a human track knowledge triples about all relevant people, things, concepts, etc. and integrating them with your knowledge stored within your weights as well as that stored in a knowledge graph. Extract all of the knowledge triples from the text. A knowledge triple is a clause that contains a subject, a predicate, and an object. The subject is the entity being described, the predicate is the property of the subject that is being described, and the object is the value of the property.\n\nEXAMPLE\nIt's a state in the US. It's also the number 1 producer of gold in the US.\n\nOutput: (Nevada, is a, state)<|>(Nevada, is in, US)<|>(Nevada, is the number 1 producer of, gold)\nEND OF EXAMPLE\n\nEXAMPLE\nI'm going to the store.\n\nOutput: NONE\nEND OF EXAMPLE\n\nEXAMPLE\nOh huh. I know Descartes likes to drive antique scooters and play the mandolin.\nOutput: (Descartes, likes to drive, antique scooters)<|>(Descartes, plays, mandolin)\nEND OF EXAMPLE\n\nEXAMPLE\n{text}Output:")) NetworkxEntityGraph[来源]#

从文本异步创建图形索引。

Parameters:
Return type:

NetworkxEntityGraph

from_text(text: str, prompt: BasePromptTemplate = PromptTemplate(input_variables=['text'], input_types={}, partial_variables={}, template="You are a networked intelligence helping a human track knowledge triples about all relevant people, things, concepts, etc. and integrating them with your knowledge stored within your weights as well as that stored in a knowledge graph. Extract all of the knowledge triples from the text. A knowledge triple is a clause that contains a subject, a predicate, and an object. The subject is the entity being described, the predicate is the property of the subject that is being described, and the object is the value of the property.\n\nEXAMPLE\nIt's a state in the US. It's also the number 1 producer of gold in the US.\n\nOutput: (Nevada, is a, state)<|>(Nevada, is in, US)<|>(Nevada, is the number 1 producer of, gold)\nEND OF EXAMPLE\n\nEXAMPLE\nI'm going to the store.\n\nOutput: NONE\nEND OF EXAMPLE\n\nEXAMPLE\nOh huh. I know Descartes likes to drive antique scooters and play the mandolin.\nOutput: (Descartes, likes to drive, antique scooters)<|>(Descartes, plays, mandolin)\nEND OF EXAMPLE\n\nEXAMPLE\n{text}Output:")) NetworkxEntityGraph[来源]#

从文本创建图形索引。

Parameters:
Return type:

NetworkxEntityGraph

使用 GraphIndexCreator 的示例