Documentation
¶
Overview ¶
Package graph implements the graph.neo4j module and associated steps.
Index ¶
- func GraphModuleSchemas() []sdk.ModuleSchemaData
- func NewGraphExtractEntitiesLLMStep(name string, _ map[string]any) (sdk.StepInstance, error)
- func NewGraphExtractEntitiesStep(name string, _ map[string]any) (sdk.StepInstance, error)
- func NewGraphImportStep(name string, _ map[string]any) (sdk.StepInstance, error)
- func NewGraphLinkStep(name string, _ map[string]any) (sdk.StepInstance, error)
- func NewGraphQueryStep(name string, _ map[string]any) (sdk.StepInstance, error)
- func NewGraphWriteStep(name string, _ map[string]any) (sdk.StepInstance, error)
- func NewNeo4jModule(name string, config map[string]any) (sdk.ModuleInstance, error)
- func RegisterNeo4jModule(name string, m *Neo4jModule) error
- func UnregisterNeo4jModule(name string)
- type Entity
- type GraphResult
- type GraphSession
- type LLMClient
- type LLMEntity
- type Neo4jConfig
- type Neo4jDriver
- type Neo4jModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GraphModuleSchemas ¶
func GraphModuleSchemas() []sdk.ModuleSchemaData
GraphModuleSchemas returns schema metadata for all graph module types.
func NewGraphExtractEntitiesLLMStep ¶
NewGraphExtractEntitiesLLMStep creates a new step.graph_extract_entities_llm instance.
func NewGraphExtractEntitiesStep ¶
NewGraphExtractEntitiesStep creates a new step.graph_extract_entities instance.
func NewGraphImportStep ¶
NewGraphImportStep creates a new step.graph_import instance.
func NewGraphLinkStep ¶
NewGraphLinkStep creates a new step.graph_link instance.
func NewGraphQueryStep ¶
NewGraphQueryStep creates a new step.graph_query instance.
func NewGraphWriteStep ¶
NewGraphWriteStep creates a new step.graph_write instance.
func NewNeo4jModule ¶
NewNeo4jModule creates a new graph.neo4j module.
func RegisterNeo4jModule ¶
func RegisterNeo4jModule(name string, m *Neo4jModule) error
RegisterNeo4jModule registers a Neo4jModule under the given name.
func UnregisterNeo4jModule ¶
func UnregisterNeo4jModule(name string)
UnregisterNeo4jModule removes a registered Neo4jModule.
Types ¶
type Entity ¶
type Entity struct {
Type string `json:"type"`
Value string `json:"value"`
Start int `json:"start"`
End int `json:"end"`
}
Entity represents an extracted entity from text.
type GraphResult ¶
GraphResult is a narrow interface over neo4j.ResultWithContext for testability.
type GraphSession ¶
type GraphSession interface {
Run(ctx context.Context, cypher string, params map[string]any) (GraphResult, error)
Close(ctx context.Context) error
}
GraphSession is a narrow interface over neo4j.SessionWithContext for testability.
type LLMClient ¶
type LLMClient interface {
ExtractEntities(ctx context.Context, text string, types []string) ([]LLMEntity, error)
}
LLMClient is the interface for LLM-based entity extraction.
func NewClaudeClient ¶
NewClaudeClient creates an LLM client backed by the Anthropic Messages API.
func NewOpenAIClient ¶
NewOpenAIClient creates an LLM client backed by the OpenAI Chat Completions API.
type LLMEntity ¶
type LLMEntity struct {
Type string `json:"type"`
Value string `json:"value"`
Context string `json:"context"`
Confidence float64 `json:"confidence"`
}
LLMEntity is an entity extracted by an LLM.
type Neo4jConfig ¶
type Neo4jConfig struct {
URI string `json:"uri" yaml:"uri"`
Database string `json:"database" yaml:"database"`
Username string `json:"username" yaml:"username"`
Password string `json:"password" yaml:"password"`
MaxConnectionPoolSize int `json:"maxConnectionPoolSize" yaml:"maxConnectionPoolSize"`
ConnectionAcquisitionTimeout time.Duration `json:"connectionAcquisitionTimeout" yaml:"connectionAcquisitionTimeout"`
}
Neo4jConfig holds configuration for the graph.neo4j module.
type Neo4jDriver ¶
type Neo4jDriver interface {
NewSession(ctx context.Context, config neo4j.SessionConfig) GraphSession
VerifyConnectivity(ctx context.Context) error
Close(ctx context.Context) error
}
Neo4jDriver is a narrow interface over neo4j.DriverWithContext for testability.
type Neo4jModule ¶
type Neo4jModule struct {
// contains filtered or unexported fields
}
Neo4jModule implements the graph.neo4j module.
func LookupNeo4jModule ¶
func LookupNeo4jModule(name string) (*Neo4jModule, error)
LookupNeo4jModule returns the registered Neo4jModule by name.
func NewNeo4jModuleForTest ¶
func NewNeo4jModuleForTest(name string, driver Neo4jDriver) *Neo4jModule
NewNeo4jModuleForTest creates a Neo4jModule with an injected driver for integration testing.
func (*Neo4jModule) ExecuteCypher ¶
func (m *Neo4jModule) ExecuteCypher(ctx context.Context, cypher string, params map[string]any) ([]map[string]any, error)
ExecuteCypher runs a Cypher query and returns all rows as maps.