Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Josephrp patch 2 #3

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1cc3389
added demo with interface
Dec 10, 2023
cc96401
added plugins.py files in plugins folder
Dec 10, 2023
45b6dc7
Create __init__.py
Dec 10, 2023
a0ab9dd
Update README.md
Dec 10, 2023
eb12989
making the demo work :-)
Dec 10, 2023
b770224
still fixing this app
Dec 10, 2023
234983d
add code execution
Dec 10, 2023
8cf4d13
Added Zilliz Cloud Retrieval Agent
Dec 10, 2023
90aa897
Update README.md
Dec 10, 2023
69a0986
Update README.md
Josephrp Dec 10, 2023
cdae2c7
Update README.md
Josephrp Dec 10, 2023
2aaa322
remove empty plugins
Dec 10, 2023
be23e28
Merge branch 'main' of https://github.com/Tonic-AI/EasyAGI
Dec 10, 2023
7a8ca3b
making things work
Dec 10, 2023
b14a7d7
Update zillizcloud.py
Dec 10, 2023
f263f0c
Update requirements.txt
Dec 10, 2023
467bb7e
Update autogen_planner.py
Dec 10, 2023
4fb38ea
added agent_builder
Dec 10, 2023
2732e3a
small updates
Dec 10, 2023
1655290
rename OAI_CONFIG_LIST
Dec 10, 2023
8e5c763
updating llm config method
Dec 10, 2023
e55daf9
update
Dec 10, 2023
a5011a0
Update README.md
Josephrp Dec 10, 2023
52fb380
Update README.md
Josephrp Dec 10, 2023
33b8189
Update app.py
Dec 10, 2023
fa4aa4c
Merge branch 'main' of https://github.com/Tonic-AI/EasyAGI
Dec 10, 2023
3792abb
OAI_CONFIG_LIST <3
Dec 10, 2023
543d37b
update config
Dec 10, 2023
9b99697
Update app.py
Dec 10, 2023
7803a7f
Update OAI_CONFIG_LIST.json
Josephrp Dec 11, 2023
2398b06
add convo for aider to read
twilwa Dec 11, 2023
4142558
aider: Created `gorilla_plugin.py` with initial code for the Semantic…
twilwa Dec 11, 2023
cb2493a
move plugin skeleton
twilwa Dec 11, 2023
8ee004b
aider: Refactored `gorilla_plugin.py` to implement the functionality …
twilwa Dec 11, 2023
5467de8
aider: To build out the `GorillaPlugin` in a similar way to the `Bing…
twilwa Dec 11, 2023
2af6249
add gorilla-cli to requirements
twilwa Dec 11, 2023
ffb9f24
aider: Replaced placeholder command execution logic with actual subpr…
twilwa Dec 11, 2023
233a580
aider: Refactored GorillaPlugin to collect environment information be…
twilwa Dec 11, 2023
43dddbe
aider: Removed `process_user_input` and `generate_cli_commands` metho…
twilwa Dec 11, 2023
6721e67
aider: Removed calls to non-existent methods in `gorilla_plugin.py` m…
twilwa Dec 11, 2023
f610542
aider: Implement comparison logic, improve error handling, and add us…
twilwa Dec 11, 2023
3fd67bd
aider: Refactored `execute_commands` method to interact with the Gori…
twilwa Dec 11, 2023
8a9d483
add python-dotenv, add env example
twilwa Dec 11, 2023
f319ee1
aider: Refactored `gorilla_plugin.py` to allow for async interactions…
twilwa Dec 11, 2023
8db12b5
aider: Refactored `execute_commands` method to queue commands and exe…
twilwa Dec 11, 2023
76ac58d
aider: Implemented user confirmation logic in `execute_commands` and …
twilwa Dec 11, 2023
37da826
aider: Removed unreachable code block for processing natural language…
twilwa Dec 11, 2023
9e4b6ac
aider: Remove incorrect recursive call and undefined variable in exec…
twilwa Dec 11, 2023
1fea557
apply sourcery refactoring suggestions
twilwa Dec 11, 2023
239523d
aider: Updated `.env.example` file to include `GORILLA_CLI_PATH` envi…
twilwa Dec 11, 2023
52f5867
forgot to push this i think ?
Dec 11, 2023
a05fb93
Update README.md
Dec 11, 2023
ab40b07
Merge pull request #6 from twilwa/yikes-dev-hopethisworks
twilwa Dec 11, 2023
2934831
Update README.md
Josephrp Dec 12, 2023
8d161be
Merge pull request #8 from Tonic-AI/Josephrp-patch-1
Josephrp Dec 12, 2023
c92e759
Delete convo.md
Josephrp Dec 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Path to the gorilla-cli executable
GORILLA_CLI_PATH=/path/to/gorilla-cli
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,4 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.aider*
28 changes: 28 additions & 0 deletions OAI_CONFIG_LIST.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"model": "gpt-4",
"api_key": "${OPENAI_API_KEY}"
},
{
"model": "gpt-4-1106-preview",
"api_key": "${OPENAI_API_KEY}"
},
{
"model": "gpt-3.5-turbo-16k",
"api_key": "${OPENAI_API_KEY}"
},
{
"model": "gpt-4",
"api_key": "${AZURE_OPENAI_API_KEY}",
"api_base": "${AZURE_OPENAI_API_BASE}",
"api_type": "azure",
"api_version": "2023-07-01-preview"
},
{
"model": "gpt-3.5-turbo",
"api_key": "${AZURE_OPENAI_API_KEY}",
"api_base": "${AZURE_OPENAI_API_BASE}",
"api_type": "azure",
"api_version": "2023-07-01-preview"
}
]
115 changes: 105 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,87 @@ pinned: false
license: mit
---

## Use and Install on the Command Line
**Check the plugins folder for new Semantic Kernel Plugins**

```bashh
git clone https://github.com/Josephrp/LablabAutogen.git
```
## Before You Install and Use

- sign up and get an api key for open ai
- sign up and set up a project in [zilliz cloud](https://cloud.zilliz.com/)

=======
- sign up and get an api key for Bing! Search

## Zilliz Plugin

This plugin allows users to plug in their existing zilliz account to a multiagent framework using autogen and semantic-kernel.

#### Set Up Zilliz
![Screenshot 2023-12-11 131536](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/d1b42e9c-8fa0-4145-bf60-c975277c6f27)
![Screenshot 2023-12-11 131608](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/5b6b1510-631a-43bb-a647-ea892793e821)

#### Create an Account

1. Navigate to cloud.zilliz.com
2. sign-up


![Screenshot 2023-12-11 131518](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/5d657875-dc31-4f16-a36f-77f8f2391add)
![Screenshot 2023-12-11 131237](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/4747afcf-8e34-40ae-9cd4-47d70a6fb908)
![Screenshot 2023-12-11 131243](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/d90029c5-869b-444d-adc1-6a997cac0976)

#### Create a Cluster
![Screenshot 2023-12-11 131633](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/01af90cd-22d8-4813-b677-c13714c3b79c)
![Screenshot 2023-12-11 131710](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/918eaa0a-cb67-4835-a302-2666193de29c)
![Screenshot 2023-12-11 131739](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/515855a8-1ff8-407f-9184-972848f8b0af)
![Screenshot 2023-12-11 131744](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/c728e6dc-b02d-476b-8b6a-8f5f7c6f8072)

#### AutoCreate a Pipeline
![Screenshot 2023-12-11 131824](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/0b9de3e2-74c2-428f-960a-bf7f2e901904)
![Screenshot 2023-12-11 131913](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/73550d75-9a6d-4454-a12c-1935584cfc92)
![Screenshot 2023-12-11 132006](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/3fd90763-d64d-4194-bd96-cda996921425)

#### AutoCreate all the Pipeline
![Screenshot 2023-12-11 132023](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/7f5a9910-fad7-45c9-9f18-af9e2b876699)
![Screenshot 2023-12-11 132035](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/69b23ec3-ecb8-494d-bb69-c7665d9e31e8)

#### Use Curl to Upload a Document
![Screenshot 2023-12-11 135943](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/21bdfac4-99bf-413a-9cf8-a2fafeb9c837)
![Screenshot 2023-12-11 140115](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/b89f3c69-258f-4311-962f-10f7f5bc0096)
![Screenshot 2023-12-11 132130](https://github.com/Josephrp/semantic-kernel-v1.0-hackathon/assets/18212928/66a17880-699b-4dde-bc8a-d3e37b04e69e)

#### Use Your Credentials + Existing Zilliz Cloud With Semantic Kernel !

## Get Your Bing! Search API Key

1. visit this weblink [https://aka.ms/bingapisignup](https://portal.azure.com/#create/microsoft.bingsearch)
2. open your portal : [https://portal.azure.com/#create/microsoft.bingsearch](https://portal.azure.com/#create/microsoft.bingsearch)

# **Check the plugins folder for new Semantic Kernel Plugins**
>>>>>>> 8ff1c563cb0c715e932c267d2fe967f50b8aee0d

## Use and Install

on the command line :

```bash
cd LablabAutogen
git clone https://github.com/Tonic-AI/EasyAGI
```

```bash
nano app.py
cd EasyAGI
```

edit line 17 " ```"openai_api_key": "YOUR_KEY_HERE", # OpenAI API Key``` with your key
If you're on Windows run the following command and edit the files below using notepad or VSCode and save them accordingly.

```bash
set PATH=%PATH%
```
then edit the OAI_CONFIG_LIST file or on the command line:

then press:
```bash
nano OAI_CONFIG_LIST.json
```
on the command line , press:

```nano
control + x
Expand All @@ -38,7 +102,38 @@ Write :
Y
```

to save then type :
to save then run

```bash
nano app.py
```

and edit lines 25-27 of app.py

```python
"host": "your_milvus_host",
"port": "your_milvus_port",
"collection_name": "your_collection_name"
```

with your zilliz cloud credentials.

and line 15 with your Bing! api key then save.

or if you're on the command line press:

```nano
control + x
```
Write :

```nano
y
```

to save.

then type the following in your command line

```bash
pip install -r requirements.txt
Expand All @@ -49,4 +144,4 @@ and finally :
```bash
python app.py
```
to run.
to run. or install and run the application inside your compiler - like VS Code.
Empty file added __init__.py
Empty file.
42 changes: 31 additions & 11 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gradio as gr
import semantic_kernel , autogen
from pydantic import BaseModel, ValidationError
from plugins.sk_bing_plugin import BingPlugin
from plugins.sk_web_pages_plugin import WebPagesPlugin
Expand All @@ -8,28 +9,47 @@
from azure.core.credentials import AzureKeyCredential
from semantic_kernel.core_skills.text_skill import TextSkill
from semantic_kernel.planning.basic_planner import BasicPlanner
from semantic_kernel import Kernel

# Configure your credentials here
bing_api_key = "ArXXXXdpJ" # Replace with your Bing API key

llm_config = {
"type": "openai", # "azure" or "openai"
"openai_api_key": "sk-rR5XXXXm", # OpenAI API Key
"azure_deployment": "", # Azure OpenAI deployment name
"azure_api_key": "", # Azure OpenAI API key in the Azure portal
"azure_endpoint": "" # Endpoint URL for Azure OpenAI, e.g. https://contoso.openai.azure.com/
# llm_config = {
# "type": "openai", # "azure" or "openai"
# "openai_api_key": "sk-rR5XXXXm", # OpenAI API Key
# "azure_deployment": "", # Azure OpenAI deployment name
# "azure_api_key": "", # Azure OpenAI API key in the Azure portal
# "azure_endpoint": "" # Endpoint URL for Azure OpenAI, e.g. https://contoso.openai.azure.com/
#}
llm_config = autogen.config_list_from_json(
env_or_file="OAI_CONFIG_LIST.json",
filter_dict={"model": {"gpt-4", "gpt-3.5-turbo-16k", "gpt-4-1106-preview"}}
)

builder_config_path = autogen.config_list_from_json(
env_or_file="OAI_CONFIG_LIST.json",
filter_dict={"model": {"gpt-4-1106-preview"}}
)

Zilliz_config = {
"host": "your_milvus_host", # use Zilliz Cloud
"port": "your_milvus_port", # use Zilliz Cloud
"collection_name": "your_collection_name" # use Zilliz Cloud
}
import semantic_kernel
kernel = semantic_kernel.Kernel()
kernel.import_skill(BingPlugin(bing_api_key))
kernel.import_skill(WebPagesPlugin())
sk_planner = AutoGenPlanner(kernel, llm_config)
assistant = sk_planner.create_assistant_agent("Assistant")
sk_planner = AutoGenPlanner(kernel, llm_config, builder_config_path)

assistant = sk_planner.create_assistant_agent("Assistant")
def get_response(question, max_auto_reply):
worker = sk_planner.create_user_agent("Worker", max_auto_reply=max_auto_reply, human_input="NEVER")
assistant = sk_planner.create_assistant_agent("Assistant")
worker.initiate_chat(assistant, message=question)
return worker.get_response()

iface = gr.Interface(fn=get_response, inputs=["text", "number"], outputs="text", inputs_label=["Question", "Max Auto Reply"])
iface.launch()
if __name__ == "__main__":
question = input("Tonic's EasyAGI builds multi-agent systems that use Semantic-Kernel Plugins to automate your business operations ! Describe your problem in detail, then optionally bullet point a brief step by step way to solve it, then (or optionally) give a clear command or instruction to solve the issues above:")
max_auto_reply = int(input("Set a maximum number of autoreplies by entering a number with minimum 10: "))
response = get_response(question, max_auto_reply)
print("Response:", response)
78 changes: 78 additions & 0 deletions chainlitdemo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import gradio as gr
from pydantic import BaseModel, ValidationError
from plugins.sk_bing_plugin import BingPlugin
from plugins.sk_web_pages_plugin import WebPagesPlugin
from planning.autogen_planner import AutoGenPlanner
from web_search_client import WebSearchClient
from web_search_client.models import SafeSearch
from azure.core.credentials import AzureKeyCredential
from semantic_kernel.core_skills.text_skill import TextSkill
from semantic_kernel.planning.basic_planner import BasicPlanner
from semantic_kernel import Kernel

# Configure your credentials here
bing_api_key = "ArXXXXdpJ" # Replace with your Bing API key

llm_config = {
"type": "openai", # "azure" or "openai"
"openai_api_key": "sk-rR5XXXXm", # OpenAI API Key
"azure_deployment": "", # Azure OpenAI deployment name
"azure_api_key": "", # Azure OpenAI API key in the Azure portal
"azure_endpoint": "" # Endpoint URL for Azure OpenAI, e.g. https://contoso.openai.azure.com/
}
import semantic_kernel
kernel = semantic_kernel.Kernel()
kernel.import_skill(BingPlugin(bing_api_key))
kernel.import_skill(WebPagesPlugin())
sk_planner = AutoGenPlanner(kernel, llm_config)
assistant = sk_planner.create_assistant_agent("Assistant")

def get_response(question, max_auto_reply):
worker = sk_planner.create_user_agent("Worker", max_auto_reply=max_auto_reply, human_input="NEVER")
assistant = sk_planner.create_assistant_agent("Assistant")
worker.initiate_chat(assistant, message=question)
return worker.get_response()

class ChainlitAssistantAgent(AssistantAgent):
def __init__(self, name, sk_planner):
super().__init__(name)
self.sk_planner = sk_planner

async def process_message(self, message):
# Use sk_planner to process the message and generate a response
response = self.sk_planner.create_assistant_agent("Assistant")
response.initiate_chat(self, message=message)
return response.get_response()

class ChainlitUserProxyAgent(UserProxyAgent):
def __init__(self, name, assistant_agent):
super().__init__(name)
self.assistant_agent = assistant_agent

async def get_human_input(self, prompt):
# Get input from the user via Chainlit interface
reply = await cl.ask_user_message(content=prompt)
return reply["content"].strip()

async def send(self, message):
# Send the message to the assistant agent and get the response
response = await self.assistant_agent.process_message(message)
# Display the response in the Chainlit interface
cl.message(content=response, author=self.assistant_agent.name).send()

# Initialize the agents
assistant_agent = ChainlitAssistantAgent("Assistant", sk_planner)
user_proxy_agent = ChainlitUserProxyAgent("User_Proxy", assistant_agent)

# Chainlit Web Interface
@cl.page("/")
def main_page():
with cl.form("user_input_form"):
question = cl.text_input("Describe your problem:")
submit_button = cl.button("Submit")

if submit_button:
cl.run_async(user_proxy_agent.send(question))

if __name__ == "__main__":
cl.run(main_page)
Loading