Skip to main content
The GKP Agent enhances its reasoning by generating relevant knowledge before answering queries. This approach, inspired by Liu et al. 2022, is particularly effective for tasks requiring commonsense reasoning and factual information. The agent consists of three main components:
  1. Knowledge Generator — Creates relevant factual information
  2. Reasoner — Uses generated knowledge to form answers
  3. Coordinator — Synthesizes multiple reasoning paths into a final answer

Architecture

API Reference

GKPAgent

run() only accepts a single task string (it internally calls the private _run([task])[0]). There is no public batch-processing method that accepts a list of tasks; process each task with a separate run() call if you need to handle multiple queries.

KnowledgeGenerator

Reasoner

Example

Best Practices

  1. Knowledge Generation: Set appropriate number of knowledge items based on query complexity
  2. Reasoning Process: Ensure diverse reasoning paths for complex queries. Validate confidence levels.
  3. Coordination: Review coordination logic for complex scenarios. Validate final answers against source knowledge.

Performance Considerations

  • Processing time increases with number of knowledge items
  • Complex queries may require more knowledge items
  • Consider caching frequently used knowledge
  • Monitor token usage for cost optimization