Documentation
¶
Overview ¶
Package graph provides graph-related utilities for RAG systems. It includes components for extracting entities and relationships from text, as well as searching knowledge graphs for relevant information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraphExtractor ¶
type GraphExtractor struct {
// contains filtered or unexported fields
}
GraphExtractor uses an LLM to extract Entities (Nodes) and Relationships (Edges) from text chunks. It helps build knowledge graphs from unstructured text for better retrieval and reasoning.
func DefaultGraphExtractor ¶
func DefaultGraphExtractor(llm chat.Client) *GraphExtractor
DefaultGraphExtractor 创建默认的图提取器 使用 gochat 的标准 LLM 客户端进行实体和关系提取
func NewGraphExtractor ¶
func NewGraphExtractor(llm chat.Client) *GraphExtractor
NewGraphExtractor creates a new graph extractor.
Parameters: - llm: The LLM client to use for extraction
Returns: - A new GraphExtractor instance
func (*GraphExtractor) Extract ¶
func (e *GraphExtractor) Extract(ctx context.Context, chunk *core.Chunk) ([]core.Node, []core.Edge, error)
Extract extracts entities and relationships from a text chunk.
Parameters: - ctx: The context for the operation - chunk: The text chunk to extract from
Returns: - A slice of nodes (entities) - A slice of edges (relationships) - An error if extraction fails