Spaces:
Sleeping
Sleeping
Commit
·
4d3bcdf
1
Parent(s):
ef1f21b
multiagent coder
Browse files- README.md +4 -0
- app.py +5 -3
- image-1.png +0 -0
- src/agents/agents.py +5 -3
- src/llmconfig/groqllm.py +2 -2
- src/streamlitUI/loadui.py +5 -1
README.md
CHANGED
|
@@ -87,7 +87,11 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
| 87 |
- Inspiration and support from our user base.
|
| 88 |
|
| 89 |
## Screeshot
|
|
|
|
| 90 |

|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
---
|
| 93 |
|
|
|
|
| 87 |
- Inspiration and support from our user base.
|
| 88 |
|
| 89 |
## Screeshot
|
| 90 |
+
### MultiAgent Coder and planner
|
| 91 |

|
| 92 |
+

|
| 93 |
+
|
| 94 |
+
|
| 95 |
|
| 96 |
---
|
| 97 |
|
app.py
CHANGED
|
@@ -19,9 +19,7 @@ if __name__ == "__main__":
|
|
| 19 |
# load ui
|
| 20 |
ui = LoadStreamlitUI()
|
| 21 |
user_input = ui.load_streamlit_ui()
|
| 22 |
-
|
| 23 |
-
obj_llm_config = GroqLLM(user_controls_input=user_input)
|
| 24 |
-
llm = obj_llm_config.groq_llm_config()
|
| 25 |
|
| 26 |
|
| 27 |
# Initialize the message log in session state if not already present
|
|
@@ -37,6 +35,10 @@ if __name__ == "__main__":
|
|
| 37 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 38 |
st.chat_message("user").write(prompt)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# agents
|
| 42 |
obj_crewai_agents = CrewAIAgents(llm=llm)
|
|
|
|
| 19 |
# load ui
|
| 20 |
ui = LoadStreamlitUI()
|
| 21 |
user_input = ui.load_streamlit_ui()
|
| 22 |
+
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
# Initialize the message log in session state if not already present
|
|
|
|
| 35 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 36 |
st.chat_message("user").write(prompt)
|
| 37 |
|
| 38 |
+
# Configure LLM
|
| 39 |
+
obj_llm_config = GroqLLM(user_controls_input=user_input)
|
| 40 |
+
llm = obj_llm_config.groq_llm_config()
|
| 41 |
+
|
| 42 |
|
| 43 |
# agents
|
| 44 |
obj_crewai_agents = CrewAIAgents(llm=llm)
|
image-1.png
ADDED
|
src/agents/agents.py
CHANGED
|
@@ -41,16 +41,18 @@ class CrewAIAgents:
|
|
| 41 |
goal='Generate actionable steps for task completion.',
|
| 42 |
llm=self.llm,
|
| 43 |
callbacks=[CustomHandler("Project Manager")],
|
|
|
|
| 44 |
)
|
| 45 |
coder = Agent(
|
| 46 |
-
role='
|
| 47 |
-
backstory='''You are a Senior
|
| 48 |
that is easy to read and understand.
|
| 49 |
You write code using object oriented programming principles and follow best practices.
|
| 50 |
You produce functional, feature complete code.''',
|
| 51 |
-
goal='Develop high-quality, well-structured
|
| 52 |
llm=self.llm,
|
| 53 |
callbacks=[CustomHandler("Coder")],
|
|
|
|
| 54 |
)
|
| 55 |
|
| 56 |
return [project_manager,coder]
|
|
|
|
| 41 |
goal='Generate actionable steps for task completion.',
|
| 42 |
llm=self.llm,
|
| 43 |
callbacks=[CustomHandler("Project Manager")],
|
| 44 |
+
max_iter = 3
|
| 45 |
)
|
| 46 |
coder = Agent(
|
| 47 |
+
role='Coder',
|
| 48 |
+
backstory='''You are a Senior Developer responsible for writing clean, efficient and robust code
|
| 49 |
that is easy to read and understand.
|
| 50 |
You write code using object oriented programming principles and follow best practices.
|
| 51 |
You produce functional, feature complete code.''',
|
| 52 |
+
goal='Develop high-quality, well-structured code.',
|
| 53 |
llm=self.llm,
|
| 54 |
callbacks=[CustomHandler("Coder")],
|
| 55 |
+
max_iter = 3
|
| 56 |
)
|
| 57 |
|
| 58 |
return [project_manager,coder]
|
src/llmconfig/groqllm.py
CHANGED
|
@@ -13,7 +13,7 @@ class GroqLLM:
|
|
| 13 |
def groq_llm_config(self):
|
| 14 |
groq = ChatGroq(
|
| 15 |
temperature=0.5,
|
| 16 |
-
model="
|
| 17 |
-
|
| 18 |
)
|
| 19 |
return groq
|
|
|
|
| 13 |
def groq_llm_config(self):
|
| 14 |
groq = ChatGroq(
|
| 15 |
temperature=0.5,
|
| 16 |
+
model= self.user_controls_input["selected_model"],
|
| 17 |
+
api_key="" # Optional if not set as an environment variable
|
| 18 |
)
|
| 19 |
return groq
|
src/streamlitUI/loadui.py
CHANGED
|
@@ -2,6 +2,7 @@ import streamlit as st
|
|
| 2 |
from crewai import Crew, Process
|
| 3 |
import streamlit as st
|
| 4 |
from configfile import Config # Import the Config class
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
class LoadStreamlitUI:
|
|
@@ -24,10 +25,13 @@ class LoadStreamlitUI:
|
|
| 24 |
if self.user_controls["selected_llm"] == 'Groq':
|
| 25 |
# Model selection
|
| 26 |
model_options = self.config.get_groq_model_options()
|
| 27 |
-
self.user_controls["
|
| 28 |
# API key input
|
| 29 |
self.user_controls["GROQ_API_KEY"] = st.session_state["GROQ_API_KEY"] = st.text_input("API Key",
|
| 30 |
type="password")
|
|
|
|
|
|
|
|
|
|
| 31 |
# Use case selection
|
| 32 |
self.user_controls["selected_usecase"] = st.selectbox("Select Usecases", usecase_options)
|
| 33 |
st.session_state["chat_with_history"] = st.sidebar.toggle("Chat With History")
|
|
|
|
| 2 |
from crewai import Crew, Process
|
| 3 |
import streamlit as st
|
| 4 |
from configfile import Config # Import the Config class
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
|
| 8 |
class LoadStreamlitUI:
|
|
|
|
| 25 |
if self.user_controls["selected_llm"] == 'Groq':
|
| 26 |
# Model selection
|
| 27 |
model_options = self.config.get_groq_model_options()
|
| 28 |
+
self.user_controls["selected_model"] = st.selectbox("Select Model", model_options)
|
| 29 |
# API key input
|
| 30 |
self.user_controls["GROQ_API_KEY"] = st.session_state["GROQ_API_KEY"] = st.text_input("API Key",
|
| 31 |
type="password")
|
| 32 |
+
|
| 33 |
+
# Set your OpenAI API key
|
| 34 |
+
os.environ["GROQ_API_KEY"] = self.user_controls["GROQ_API_KEY"]
|
| 35 |
# Use case selection
|
| 36 |
self.user_controls["selected_usecase"] = st.selectbox("Select Usecases", usecase_options)
|
| 37 |
st.session_state["chat_with_history"] = st.sidebar.toggle("Chat With History")
|