GraphQueryTool

org.llm4s.knowledgegraph.tool.GraphQueryTool

Agent tool integration for graph-guided question answering.

Wraps GraphQAPipeline as a ToolFunction that an Agent can call to query a knowledge graph using natural language. The tool accepts a question and optional configuration, executes the full QA pipeline, and returns the answer with citations.

Attributes

Example
import org.llm4s.knowledgegraph.tool.GraphQueryTool
import org.llm4s.toolapi.ToolRegistry
for {
 tool <- GraphQueryTool.toolSafe(llmClient, graphStore)
 tools = new ToolRegistry(Seq(tool))
 state <- agent.run("Who does Alice work with?", tools)
} yield state
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def toolSafe(llmClient: LLMClient, graphStore: GraphStore, config: GraphQAConfig): Result[ToolFunction[Map[String, Any], GraphQueryToolResult]]

Creates the graph query tool instance, returning a Result for safe error handling.

Creates the graph query tool instance, returning a Result for safe error handling.

Value parameters

config

Optional QA pipeline configuration

graphStore

The graph store containing the knowledge graph

llmClient

The LLM client for the QA pipeline

Attributes

Returns

Right(tool) on success, Left(error) on failure