Knowledge Base

Give all the required information to LLM

The Knowledge Base feature in the Beacon Labs framework plays a crucial role in supplying relevant task-related data to the LLM during analysis and processing. By providing essential information to task-performing agents or direct LLM calls, it significantly improves the chances of successful task completion.

A key advantage of the Knowledge Base is its seamless integration with context compression, which optimizes the handling of large datasets. The framework supports two types of knowledge bases:

  1. Direct Data Integration: These knowledge bases provide the necessary data alongside each prompt, ensuring that the LLM has immediate access to the required information.

  2. Searchable Knowledge Bases: These function as tools that the LLM can query when needed, allowing for efficient retrieval of large or unstructured data.

Both approaches offer benefits, particularly in cases requiring Retrieval-Augmented Generation (RAG). By allowing the LLM to determine search queries independently, the framework enhances accuracy and efficiency in data retrieval.

Key Benefits of the Knowledge Base

  • Enhances agents for domain-specific tasks

  • Improves decision-making with real-world data

Creating a Knowledge Base

To create a knowledge base, simply import the KnowledgeBase class. Then, create an instance of this class and add it to a task's context list. The KnowledgeBase integrates seamlessly wherever context is required.

pythonCopyEditfrom beaconlabs import KnowledgeBase  

resume_list = KnowledgeBase(  
  files=["resume1.pdf", "resume2.pdf"]  
)

For file-based knowledge sources, ensure that your files are stored in the current working directory. You can also use a full file path if needed.

Adding a Knowledge Base to a Task

Once created, a KnowledgeBase object can be added to any task’s context list. The Agent or LLM will use this context while performing operations.

pythonCopyEditfrom beaconlabs import Task  

task1 = Task(  
  "Summarize the resumes",  
  context=[resume_list] # Adding the Knowledge Base to the task  
)

Supported Formats

Supported File Types

  • PDF

  • PowerPoint

  • Word

  • Excel

  • Images

  • Audio

  • HTML

  • CSV

  • JSON

  • XML

  • ZIP

Supported Data Types

  • STRING

Last updated