Skip to main content

Knowledge and Aptitude Augmented Generation framework

Project description

KAAG: Knowledge and Aptitude Augmented Generation

KAAG is a framework for creating adaptive AI agents that engage in dynamic, context-aware conversations. It integrates knowledge retrieval, aptitude modeling, and large language models to provide a flexible system for complex interactions.

PyPI version License: MIT

Features

  • Dynamic Bayesian Networks (DBNs) for modeling conversation states
  • Gamified Interaction Model (GIM) for managing interaction context
  • Integration with various LLM providers (OpenAI, Anthropic, Ollama)
  • Customizable analyzers for interaction state analysis
  • Flexible configuration system for conversation stages and metrics
  • Simulation capabilities for testing and evaluating AI agents

Installation

pip install kaag

For development:

git clone https://github.com/aroundAI/kaag.git
cd kaag
pip install -e ".[dev]"

Quick Start

from kaag import KAAG, RAG, NoRAG
from kaag.llm.ollama import OllamaLLM
from kaag.knowledge_retriever.text_file import TextFileKnowledgeRetriever
from kaag.utils.config import load_config
from jinja2 import Environment, FileSystemLoader

# Load configuration and initialize components
config = load_config("config.yaml")
llm = OllamaLLM(model="llama2", api_url="http://localhost:11434")
knowledge_retriever = TextFileKnowledgeRetriever("knowledge.txt", top_k=3)

# Load templates
env = Environment(loader=FileSystemLoader("templates"))
kaag_template = env.get_template('kaag.jinja')
rag_template = env.get_template('rag.jinja')
norag_template = env.get_template('norag.jinja')

# Initialize agents
kaag_agent = KAAG(llm, config, kaag_template)
rag_agent = RAG(llm, config, knowledge_retriever, rag_template)
norag_agent = NoRAG(llm, config, norag_template)

# Process user input
user_input = "Hello, I'm interested in your product."
kaag_response = kaag_agent.process_turn(user_input)
rag_response = rag_agent.process_turn(user_input)
norag_response = norag_agent.process_turn(user_input)

print("KAAG response:", kaag_response)
print("RAG response:", rag_response)
print("NoRAG response:", norag_response)

Documentation

For full documentation, visit docs.kaag.io.

Evaluation

To run evaluations:

python -m scripts.evaluation <num_runs>

Results will be saved in the results directory.

Contributing

We welcome contributions! Please see our Contributing Guide for more details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use KAAG in your research, please cite:

@article{chaudhuri2023kaag,
  title={Knowledge and Aptitude Augmented Generation: Adaptive Multi-Turn Interaction in LLM Systems},
  author={Chaudhuri, Shauryadeep},
  journal={AroundAI},
  year={2023}
}

Contact

For questions and support, please open an issue on the GitHub repository or contact shaurya@aroundai.co.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kaag-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kaag-0.1.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file kaag-0.1.0.tar.gz.

File metadata

  • Download URL: kaag-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for kaag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dc228931aa4dbc4d6690d4c5749c2a3f8032f139bcfd5a7ef5e46ce287408bf5
MD5 245302db82e9fea6719d0e1e84b79713
BLAKE2b-256 9afa5f42e3692d6942beedec0a5ed348951c8204e97af3258e7d0cd4f08c1c0a

See more details on using hashes here.

File details

Details for the file kaag-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kaag-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for kaag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 972776fdca4e411fe545588b660063ca522862bc9f31ec167a1bd9ea1d9dacf0
MD5 e38b94163229caa32b31321da627ca32
BLAKE2b-256 57b0dadf3aa719e3858005849ea0fddddfcc977b138dd0c3fd94fe1683950e05

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page