Skip to content

Commit

Permalink
pre-release beta
Browse files Browse the repository at this point in the history
  • Loading branch information
neokd committed Nov 30, 2023
1 parent 292453f commit e1a484d
Show file tree
Hide file tree
Showing 28 changed files with 939 additions and 36 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ Join our [Discord](https://discord.gg/qNqjsGuCTG) community to stay up to date w
- ✓ User Interface 💻 (Streamlit)
- ✓ Chat with SQL DB 🤖
- ✓ Support for other search engines (DuckDuckGo) 🔍
- Add support for other LLM types (Ollama) 🧠
- Add support for other LLM types (Ollama) 🧠
- ☐ Add other database support (MongoDB, ElasticSearch, etc.) 📁🔍
- Docker Support 🐳
- Better Documentation 📖
- Agent based chatbot 🤖
- Docker Support 🐳
- Better Documentation 📖
- Agent based chatbot 🤖
## Features
Expand Down
29 changes: 29 additions & 0 deletions docs/content/about/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@

This page lists the highlights, bug fixes and known issues for each release of NeoGPT.

## v0.1.0-beta 🕵️‍♂️🚀

__Release Date:__ 30th November 2023

Features:

- __Agent based chatbot 🤖__ : 2 New agents are added (ML Engineer, QA Engineer).

- __Writing Assistant 📝__ : NeoGPT can now help you write your documents and assignments with `--write` flag.

- __Shell Mode 🐚__ : NeoGPT can now be used as a shell by passing the `--persona shell` flag.

- __Docker Support 🐳__ : NeoGPT can now be run in a docker container.

- __Ollama Support 🧠__ : NeoGPT can now be used with Ollama.

- __Timer for User Input in UI ⏱__ : Timed user input for ui mode by @savyez in [#105](https://github.com/neokd/NeoGPT/pull/105)


Bug Fixes:
- Fixed Dockerfile

### New Contributors
* @Tashuuuu [#98](https://github.com/neokd/NeoGPT/pull/98)
* @C0DE-SLAYER [#99](https://github.com/neokd/NeoGPT/pull/99)



## v0.1.0-alpha 🚀🤖✨

Expand Down Expand Up @@ -77,5 +104,7 @@ Project Roadmap Achievements:
* @ha36d
* @bryce-seefieldt
* @kehsihba19
* @Tashuuuu
* @C0DE-SLAYER

We would like to thank all the contributors for their valuable contributions to NeoGPT. :heart_on_fire:
20 changes: 18 additions & 2 deletions docs/content/advance/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ Supported URL patterns for ingestion.
- **Log File:** The log file name.
Default: `logs/builder.log`

## Agent

!!! info "Release Note"
You cannot change config directly from the CLI or UI. We will add support for that in the future releases.
- **Agent Name:** The name of the agent.
Default: `NeoGPT`

- **Agent Thoughts:** List of agent thoughts.
Default: `[]` (empty list)

- **QA feedback:** List of QA feedback.
Default: `[]` (empty list)



!!! info "Update Note"
You can update the configurations by using `export` command. For example, to update the `MODEL_NAME` configuration, you can use the following command:

```bash
export MODEL_NAME="TheBloke/Mistral-7B-Instruct-v0.1-GGUF"
```
60 changes: 60 additions & 0 deletions docs/content/agents/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# __Agents & NeoGPT 🕵️🤖__

## What is an Agent?

In artificial intelligence, an agent is a computer program or system that is designed to perceive its environment, make decisions and take actions to achieve a specific goal or set of goals. The agent operates autonomously, meaning it is not directly controlled by a human operator.

!!! info "Info"
Agents are in very early stages of development. They may produce unexpected results or errors. Please use them with caution.

## Agents & NeoGPT

Agents are a new feature in NeoGPT. They are designed to be able to interact with the world around them. Currently there are only two agents, but more are planned to be added in the future.

## Agents in Focus

Agents within the NeoGPT ecosystem are designed to collaborate with the language model, enabling a broader range of interactions and problem-solving capabilities. Stay tuned for further updates and the introduction of additional agents, expanding the collaborative intelligence of NeoGPT.

## Meet the Agents

### __ML Engineer 🤖🧠__

The ML Engineer is a specialized agent for machine learning tasks, thinking like an experienced ML professional. It understands and solves various ML-related queries, making it a valuable asset for those needing support in Python programming, data science, and machine learning basics.

### __QA Engineer 🕵️🔍__

The QA Engineer, or Quality Assurance Engineer, is an agent with expertise in validating and assessing code and solutions. When presented with a problem, the QA Engineer can analyze the solution and provide feedback, helping to ensure the quality and correctness of the code.


## How to use Agents

Run the below command to see the agents in action.

=== "Command"
```bash title="Terminal"
python main.py --task "Your task goes here"
```

=== "Example"
```bash title="Terminal"
python main.py --task "Write a program to find the sum of all numbers stored in a list"
```


## How do Agents work?

1. The `hire()` method is like an assistant manager overseeing the collaboration between a machine learning (ML) specialist (ML Engineer) and a quality assurance (QA) expert (QA Engineer) to solve a task.

2. __Load Model__: The `hire()` function initiates by loading the machine learning model designed for the task.

3. __Collaboration Setup__: It establishes collaboration between two key roles - the ML Engineer and the QA Engineer.

4. __Task Assignment__: A task is assigned to the ML Engineer, who employs the loaded model to generate a solution.

5. __Quality Check__: The QA Engineer assesses the proposed solution for correctness and quality.

6. __Termination or Retry__: If the solution is approved, the program terminates. In case of disapproval, the process retries for a defined number of attempts.

7. __Collaborative Iteration__: Steps 3 to 5 are iteratively performed, facilitating collaboration until a satisfactory solution is achieved or attempts are exhausted.


10 changes: 5 additions & 5 deletions docs/content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ Join our [Discord](https://discord.gg/qNqjsGuCTG) community to stay up to date w

- [x] Support for other search engines (DuckDuckGo) 🔍

- [ ] Add support for other LLM types (Ollama) 🧠
- [x] Add support for other LLM types (Ollama) 🧠

- [ ] Add other database support (MongoDB, ElasticSearch, etc.) 📁🔍
- [x] Docker Support 🐳

- [ ] Docker Support 🐳
- [x] Better Documentation 📖

- [ ] Better Documentation 📖
- [x] Agent based chatbot 🤖

- [ ] Agent based chatbot 🤖
- [ ] Add other database support (MongoDB, ElasticSearch, etc.) 📁🔍


!!! info "Release Note"
Expand Down
11 changes: 11 additions & 0 deletions docs/content/persona/persona.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following personas are currently available:
- `ML_ENGINEER`: Explains complex ML concepts in an easy-to-understand manner.
- `CEO`: Acts as the CEO, making strategic decisions.
- `RESEARCHER`: Analyzes, synthesizes, and provides insights.
- `SHELL`: Executes shell commands.


### Default Persona
Expand Down Expand Up @@ -84,6 +85,16 @@ For data exploration and analysis, NeoGPT becomes a researcher. Dive into the wo
python main.py --persona researcher
```

### Shell Persona

NeoGPT's shell persona is a powerful tool for executing shell commands. It can be used to perform a variety of tasks, such as installing software, managing files, and more. However, it is important to note that this persona can be dangerous if used incorrectly. Always review the generated commands before executing them.

```bash title="Terminal"
python main.py --persona shell
```

Refer to the [Executing Shell Commands with NeoGPT 🤖](/NeoGPT/persona/shell) section for more information.


### Conclusion

Expand Down
44 changes: 44 additions & 0 deletions docs/content/persona/shell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# __Executing Shell Commands with NeoGPT 🤖__



## Introduction

NeoGPT 🤖 has a special persona known as "shell," which allows it to generate shell commands based on user input. It's important to note that these commands have the potential to make changes to your system, and you should use them at your own risk.

## Warning

When using NeoGPT 🤖 in the "shell" persona, be cautious, as it may generate commands that can be harmful to your system. Always review the generated commands before executing them. The following steps guide you through the process of executing or manually reviewing commands.

## Steps

!!! warning "Warning"
When using NeoGPT 🤖 in the "shell" persona, be cautious, as it may generate commands that can be harmful to your system. Always review the generated commands before executing them. The following steps guide you through the process of executing or manually reviewing commands.


### Step 1: Persona Selection

If you choose the "shell" persona, NeoGPT 🤖 will inform you about the potential risks and ask whether you want to execute the generated commands.

```bash
You are using NeoGPT 🤖 as a shell. It may generate commands that can be harmful to your system. Use it at your own risk. ⚠️
```

### Step 2: User Input
You will be prompted to decide whether you want to execute the generated commands.

```bash
Do you want to execute the commands? (Y/N):
```

### Step 3: Execution Confirmation
If you choose to execute the commands, NeoGPT 🤖 will inform you that it will execute the commands in your default shell.

```bash
NeoGPT 🤖 will execute the commands in your default shell.
```

### Conclusion
Using NeoGPT 🤖 in the "shell" persona can be a powerful tool, but it comes with risks. Always exercise caution, review the generated commands, and ensure they align with your intentions.


3 changes: 3 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ nav:
- SQL : retrievers/sql.md
- Persona:
- Persona & NeoGPT: persona/persona.md
- Shell Persona: persona/shell.md
- Agents:
- Agents & NeoGPT: agents/index.md
- Settings:
- Configure Search: advance/search.md
- Configuration: advance/configuration.md
Expand Down
31 changes: 27 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from neogpt.builder import builder
from neogpt.config import DEVICE_TYPE, NEOGPT_LOG_FILE
from neogpt.manager import db_retriver
from neogpt.manager import db_retriver, hire


def main():
Expand Down Expand Up @@ -39,7 +39,7 @@ def main():
"ml_engineer",
"ceo",
"researcher",
"shell"
"shell",
],
default="default",
help="Specify the persona (default, recruiter). It allows you to customize the persona i.e. how the chatbot should behave.",
Expand Down Expand Up @@ -92,13 +92,22 @@ def main():
action="version",
version="You are using NeoGPT🤖 v0.1.0-alpha.",
)
parser.add_argument("--task", type=str, help="Task to be performed by the Agent")
parser.add_argument(
"--tries",
type=int,
default=5,
help="Number of retries if the Agent fails to perform the task",
)

args = parser.parse_args()

if args.debug:
log_level = logging.DEBUG

if args.verbose:
elif args.verbose:
log_level = logging.INFO
else:
log_level = logging.WARNING

if args.log:
log_level = logging.INFO
Expand All @@ -107,6 +116,11 @@ def main():
level=log_level,
filename=NEOGPT_LOG_FILE,
)
else:
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(filename)s:%(lineno)s - %(message)s",
level=log_level,
)

# if not os.path.exists(FAISS_PERSIST_DIRECTORY):
# builder(vectorstore="FAISS")
Expand All @@ -127,6 +141,15 @@ def main():
logging.info("Note: The UI server only supports local retriever and Chroma DB")
sys.argv = ["streamlit", "run", "neogpt/ui.py"]
sys.exit(stcli.main())

elif args.task is not None:
print()
hire(
task=args.task,
tries=args.tries,
LOGGING=logging,
)

else:
db_retriver(
device_type=args.device_type,
Expand Down
7 changes: 7 additions & 0 deletions neogpt/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from neogpt.agents.ml_engineer import ML_Engineer
from neogpt.agents.qa_engineer import QA_Engineer

__all__ = [
"ML_Engineer",
"QA_Engineer",
]
43 changes: 43 additions & 0 deletions neogpt/agents/examples/calculate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import math

from flask import Flask, request

app = Flask(__name__)


@app.route("/calculate", methods=["GET", "POST"])
def calculate():
if request.method == "GET":
return """
<h1>Calculator</h1>
<form method="post" action="/calculate">
Operation:<br>
<input type="text" name="operation"><br><br>
num1:<br>
<input type="float" name="num1"><br><br>
num2:<br>
<input type="float" name="num2"><br><br>
<input type="submit" value="Calculate">
</form>"""
else:
operation = request.form["operation"]
num1 = float(request.form["num1"])
num2 = float(request.form["num2"])

if operation == "add":
result = num1 + num2
elif operation == "subtract":
result = num1 - num2
elif operation == "multiply":
result = num1 * num2
elif operation == "divide":
result = num1 / num2
else:
result = "Invalid operation"

return f"""<h1>Result: {result}</h1>"""


if __name__ == "__main__":
app.run()
Loading

0 comments on commit e1a484d

Please sign in to comment.