Skip to content

Commit

Permalink
Merge pull request #4 from Upsonic/knowledge-module
Browse files Browse the repository at this point in the history
Added knowledge module
  • Loading branch information
onuratakan authored Apr 9, 2024
2 parents 7ec0463 + 3abf60b commit 76143e8
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 24 deletions.
51 changes: 28 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
<a href="https://huggingface.co/spaces/congxin95/BMTools-demo">Public Dashboard</a> •
</p>


<br>
<div align="center">
<img src="assets/overview.png" width="700px">
</div>
<br>

# What is Tiger ?
Tiger is an community project for developing reusable and integrated tool ecosystem for LLM Agent Revolution. Tiger uses Upsonic to storing tools in isolation and automaticaly generated documents. You can create your own tiger for your agents or you can use the community maintained public and strongest Tiger 🐅.

Tiger is an community project for developing reusable and integrated tool ecosystem for LLM Agent Revolution. Tiger uses Upsonic to storing tools in isolation and automaticaly generated documents. You can create your own tiger for your agents or you can use the community maintained public and strongest Tiger 🐅.

## Details

Tiger inspired from [Neuralink](https://neuralink.com/) and and provides AI computer interface with its threads that connected to LLM interface. Tiger gives an opportunity to AI to use computer by thinking.

With Tiger your LLM agents write codes and run, uses search engines, view your calendar, use your mouse and keyboard. Saying somethink in your headphones and anythink that thinked by your agent. Tiger will transform this thinks to real actions. In this way the Tiger project philosophy is using AI knowladge to generate action and supporting with standart infrastructures. We aim to make:
Expand All @@ -39,17 +39,14 @@ With Tiger your LLM agents write codes and run, uses search engines, view your c
- **Great community for great tools** support in different technologies and sources
- **Free, Open and MIT** licenced tool library for AI agent ecosystem


<br>
<div align="center">
<img src="assets/question_answer_2.png" width="700px">
</div>
<br>




# Setup

Tiger projects have a general usage public library at [tiger.upsonic.co](https://tiger.upsonic.co). Its include the tools that in `tools` library. For usage this you can use the standart connection that in upsonic python library. After installing the `upsonic` library we will use the Tiger object wand integrate to your agents.

- Tiger requires equal or higher python version to 3.8
Expand All @@ -59,49 +56,60 @@ pip3 install upsonic
```

## Currently Tools
We are working on Upsonic and the tools that inside the `tools` folder is sending to public tiger in each release. We are aiming to create tools without any api key and just like normal human events like searching on google with mouse, keyboard and browser.

We are working on Upsonic and the tools that inside the `tools` folder is sending to public tiger in each release. We are aiming to create tools without any api key and just like normal human events like searching on google with mouse, keyboard and browser.

- Interpreter

- python
- check_package
- execute
- install_package
- sh
- execute
- execute

- Search

- google
- duckduckgo
- read_website

- System

- os_name
- architecture
- python_version

If you want to add functions to public and strongest Tiger you can see to [Adding Tools](#adding-tools) section.
- Knowledge
- put
- pull
- delete
- index
- reset

If you want to add functions to public and strongest Tiger you can see to [Adding Tools](#adding-tools) section.

## Public Dashboard

For the public Tiger you can see the functions and their documentations and readmes in [tiger.upsonic.co](https://tiger.upsonic.co). You can use this place for documentation also.

**Auth**

- username: tiger
- password: tiger


<br>
<div align="center">
<img src="assets/dashboard.png" width="700px">
</div>
<br>


## Documentation of Tiger Tools

Thanks to Upsonic we just write the codes and its gives us an storage system with detailed documentation and cpu ram usage for each function. Also you can make search and use functions in your other projects with connection code.

**Auth**

- username: tiger
- password: tiger

Expand All @@ -112,9 +120,8 @@ Thanks to Upsonic we just write the codes and its gives us an storage system wit
<br>

# LangChain Integration
Tiger is able to make a collabration for sharing tools with LangChain agents with this your agents will able to use Tiger functions. In this example we are asking for an multiplation question and the agent will use the tiger `interpreter.python` module and after that its write a python code and tiger will give the result in behind. With this agent will able to make mathematical operations in just two lines of code.


Tiger is able to make a collabration for sharing tools with LangChain agents with this your agents will able to use Tiger functions. In this example we are asking for an multiplation question and the agent will use the tiger `interpreter.python` module and after that its write a python code and tiger will give the result in behind. With this agent will able to make mathematical operations in just two lines of code.

```python
# Geting the tiger tools about interpreter.python
Expand All @@ -139,8 +146,8 @@ agent_executor.invoke({"input": "What is the result of 15231 * 64231"})

```


# AutoGen Integration

Tiger is also have a integration with AutoGen agents. You can put a tiger to your AutoGen agents. In this examples we will use the 'interpreter.python' module and with this your autogen agent able to run and view result of python codes. With this your agent will able to wait 2 second as we request.

```python
Expand Down Expand Up @@ -188,12 +195,14 @@ user_proxy.initiate_chat(
```

## Adding Tools

Tiger project is open to any contribution for public tiger, also in the bottom we have another way to create your own, offline tiger. For adding the public tiger you should create a pull request with your new tool.

1) Create a python file in `tiger/tools` section.
for ex: `tiger/tools/interpreter/python/execute.py`
1. Create a python file in `tiger/tools` section.
for ex: `tiger/tools/interpreter/python/execute.py`

2. Write your function in this format

2) Write your function in this format
```python
#imports

Expand All @@ -206,11 +215,10 @@ tool_obj = my_function
tool_requirements = ["beautifulsoup4==4.12.3"]
```


3) Create the pull request. When its merged its will be available at public Tiger and dashboard.

3. Create the pull request. When its merged its will be available at public Tiger and dashboard.

## Creating your Own Tiger

For creating your own tiger you should install a Upsonic On-Prem docker container. Its will give a dashboard for viewing your own tools and will make documentation automatic. After that you should use the Upsonic Client to connect your On-Prem for this you should get the connection code from your dashboard and finaly you use the tiger function in upsonic client.

[Installation document](https://docs.upsonic.co/on-prem/getting_started/install_on_prem)
Expand All @@ -226,9 +234,6 @@ For creating your own tiger you should install a Upsonic On-Prem docker containe
upsonic.autogen(chatbot, userproxy)
```




## Star History

<br>
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ beautifulsoup4==4.12.3
requests
python-dotenv==1.0.0
duckduckgo-search==5.3.0
upsonic
tinydb==4.8.0
upsonic
28 changes: 28 additions & 0 deletions tiger/tools/knowledge/delete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import inspect
import os

import upsonic
from tinydb import Query
from tinydb import TinyDB


def delete(knowledge_name: str) -> bool:
"""
:param knowledge_name: str:
"""
folder = os.path.join(os.path.dirname(inspect.getfile(upsonic)),
"upsonic_tiger_knowledge.json")
db = TinyDB(folder)
try:
Knowledge = Query()
db.remove(Knowledge.knowledge_name == knowledge_name)
return True
except:
return False


tool_name = "knowledge.delete"
tool_obj = delete
tool_requirements = ["tinydb==4.8.0"]
19 changes: 19 additions & 0 deletions tiger/tools/knowledge/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import inspect
import os

import upsonic
from tinydb import Query
from tinydb import TinyDB


def index() -> list:
""" """
folder = os.path.join(os.path.dirname(inspect.getfile(upsonic)),
"upsonic_tiger_knowledge.json")
db = TinyDB(folder)
return [knowledge["knowledge_name"] for knowledge in db.all()]


tool_name = "knowledge.index"
tool_obj = index
tool_requirements = ["tinydb==4.8.0"]
28 changes: 28 additions & 0 deletions tiger/tools/knowledge/pull.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import inspect
import os

import upsonic
from tinydb import Query
from tinydb import TinyDB


def pull(knowledge_name: str) -> str:
"""
:param knowledge_name: str:
"""
folder = os.path.join(os.path.dirname(inspect.getfile(upsonic)),
"upsonic_tiger_knowledge.json")
db = TinyDB(folder)
Knowledge = Query()
result = db.search(Knowledge.knowledge_name == knowledge_name)
if result:
return result[0]["description"]
else:
return None


tool_name = "knowledge.pull"
tool_obj = pull
tool_requirements = ["tinydb==4.8.0"]
36 changes: 36 additions & 0 deletions tiger/tools/knowledge/put.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import inspect
import os

import upsonic
from tinydb import Query
from tinydb import TinyDB


def put(knowledge_name: str, description: str) -> bool:
"""
:param knowledge_name: str:
:param description: str:
"""
folder = os.path.join(os.path.dirname(inspect.getfile(upsonic)),
"upsonic_tiger_knowledge.json")
db = TinyDB(folder)
try:
Knowledge = Query()
if db.search(Knowledge.knowledge_name == knowledge_name):
db.update({"description": description},
Knowledge.knowledge_name == knowledge_name)
else:
db.insert({
"knowledge_name": knowledge_name,
"description": description
})
return True
except:
return False


tool_name = "knowledge.put"
tool_obj = put
tool_requirements = ["tinydb==4.8.0"]
23 changes: 23 additions & 0 deletions tiger/tools/knowledge/reset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import inspect
import os

import upsonic
from tinydb import Query
from tinydb import TinyDB


def reset() -> None:
""" """
folder = os.path.join(os.path.dirname(inspect.getfile(upsonic)),
"upsonic_tiger_knowledge.json")
db = TinyDB(folder)
try:
# Empty the database
db.truncate()
except:
print("Error occurred while resetting the knowledge database.")


tool_name = "knowledge.reset"
tool_obj = reset
tool_requirements = ["tinydb==4.8.0"]

0 comments on commit 76143e8

Please sign in to comment.