Code Monkey home page Code Monkey logo

kai's Introduction

KAI

KAI is a custom app for Frappe Framework that implements CrewAI framework to integrate AI Agents with Frappe Framework. If you are not familiar with these platforms please take a look at the following web sites.

KEY CONCEPTS

  • LLM :: Large Language Models are machine learning models that can comprehend and generate human language text.
  • CREW :: A crew represents a collaborative group of agents working together to achieve a set of tasks.
  • AGENT :: An agent is an autonomous unit programmed to perform TASKS, make decisions and communicate with other agents.
  • TASK :: Specific assignments completed by agents.
  • TOOL :: A tool is a skill or function that agents can utilize to perform various actions.
  • JOB :: Set of Inputs given to a crew to be used by agents to produce a result or output.

LLM, CREW, AGENT, TASK, TOOL, JOB are implemented as DocType.
So you can create unlimited Crews, Agents and Tasks to accomplish unique goals.
You can interact with Crews via UI or python fucntion calls.\

Currently KAI can interface with the following LLM providers:

  • GroqCloud (fastest, free for now)
  • Ollama (local, slow but free)
  • OpenAI (soon, paid)
  • AWS Bedrock (soon, paid)

We have tested KAI with llama3-8B and llama3-70B on GroqCloud but there is no reason why you cannot use other LLMs.

INSTALLATION

Since KAI is a Custom Frappe App it can be installed using frappe bench CLI commands.

bench get-app https://github.com/KorucuTech/kai.git
bench --site your-site-name install kai

HOW TO RUN

After you create CREW,AGENT,TASK,TOOL definitions you can run the crew with input to get an output.

import frappe

crew_name = "My Science Crew"
crew = frappe.get_doc("KAI Crew",crew_name)

inputs = { "question": "Why is the sky Blue" }
output = crew.kickoff(inputs=inputs)
print(output)

How about this to verify if a user exists in Frappe and is Authorized.

import frappe

crew_name = "My Security Crew"
crew = frappe.get_doc("KAI Crew",crew_name)

inputs = { "email": "[email protected]" }
output = crew.kickoff(inputs=inputs)
print(output)

You can also run a crew from a JOB

This is the AGENT that answered the question.

This was the TASK at hand.

Agent decides if it needs to use a tool to complete a TASK. Here is a TOOL definition.

And here is the very simple CREW that has only one AGENT that worked on the answer.

You must have an LLM setup to begin with. You can setup multiple LLM providers and even assign different LLMs to each AGENT or CREW.

Technically you can write these CREWS,AGENTS,TASKS etc. in pure python. KAI gives you a way to do it via frappe UI and use/call them directly from any frappe app or server script.

It is possible to add more TOOLS to do much more with Frappe or even ERPNext.

Here is a simple TOOL that checks if a user exists if given an email address.

Here is the backend of this TOOL!

Hard part of this is writing/testing/re-writing the "prompts" so that AGNETS can produce the result you want.

Let me know what you think!

LICENSE

MIT

kai's People

Contributors

korucutech avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.