shubhamchau222 commited on
Commit
796c2b8
·
1 Parent(s): 9153116

first draft UI completed

Browse files
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ langchain
2
+ langgraph
3
+ langchain_community
4
+ langchain_core
5
+ langchain_groq
6
+ langchain_openai
7
+ faiss-cpu
8
+ streamlit
src/__init__.py ADDED
File without changes
src/graph/__init__.py ADDED
File without changes
src/user_interface/__init__.py ADDED
File without changes
src/user_interface/streamlitui/loadui.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ # Add the src directory to the Python path
4
+ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
5
+
6
+ import streamlit as st
7
+ from datetime import datetime
8
+ from langchain_core.messages import HumanMessage, AIMessage
9
+ from src.user_interface.uiconfig import config
10
+ import sys
11
+
12
+
13
+
14
+ class LoadStreamlitUI:
15
+ def __init__(self):
16
+ self.config = config()
17
+ self.user_controls = {}
18
+
19
+ def initialize_session(self):
20
+ return {
21
+ "current_step": "requirements",
22
+ "requirements": "",
23
+ "user_stories": "",
24
+ "po_feedback": "",
25
+ "generated_code": "",
26
+ "review_feedback": "",
27
+ "decision": None
28
+ }
29
+
30
+ def load_streamlit_ui(self):
31
+ st.set_page_config(page_title= "🤖 " + self.config.get_page_title(),
32
+ layout="wide",
33
+ page_icon="🧊")
34
+ st.header("🤖 " + self.config.get_page_title())
35
+ st.session_state.timeframe = ''
36
+ st.session_state.IsFetchButtonClicked = False
37
+ st.session_state.IsSDLC = False
38
+
39
+ with st.sidebar:
40
+ llm_options = self.config.get_llm_options()
41
+ use_case_options = self.config.get_usecase_options()
42
+ self.user_controls["selected_llm"] = st.selectbox("Select LLM", llm_options)
43
+
44
+ if self.user_controls["selected_llm"] == 'Groq':
45
+ #select the model from the list
46
+ groq_model_options = self.config.get_groq_model_options()
47
+ self.user_controls["selected_model"] = st.selectbox("Select Model", groq_model_options)
48
+ #ask to enter the API Key as well
49
+ self.user_controls["GROQ_API_KEY"] = st.session_state["GROQ_API_KEY"] = st.text_input("Enter your Groq API Key", type="password")
50
+
51
+ #Validate the API key
52
+ if not self.user_controls["GROQ_API_KEY"]:
53
+ st.warning("⚠️ Please enter your GROQ API key to proceed. Don't have? refer : https://console.groq.com/keys ")
54
+
55
+ self.user_controls["selected_usecase"] = st.selectbox("Select Use Case", use_case_options)
56
+
57
+ if self.user_controls["selected_usecase"] == 'Chatbot with Tool':
58
+
59
+ #ask for Tavily API key
60
+ self.user_controls["TAVILY_API_KEY"] = st.session_state["TAVILY_API_KEY"] = st.text_input("Enter your Tavily API Key", type="password")
61
+ if not self.user_controls["TAVILY_API_KEY"]:
62
+ st.warning("⚠️ Please enter your TAVILTY API key to proceed. Don't have? refer : https://tavily.com/")
63
+
64
+ if "state" not in st.session_state:
65
+ st.session_state.state = self.initialize_session()
66
+
67
+
68
+
69
+ if __name__ == "__main__":
70
+ a= LoadStreamlitUI()
71
+ a.load_streamlit_ui()
72
+ print(a.config.get_page_title())
73
+
74
+
src/user_interface/uiconfig.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from configparser import ConfigParser
2
+ import sys
3
+ import os
4
+
5
+ # config_filepath= os.path.join(".","src", "user_interface", "uiconfigfile.ini")
6
+ config_filepath = os.path.join(os.path.dirname(__file__), "uiconfigfile.ini")
7
+ print("config_filepath >> ",config_filepath)
8
+
9
+ class config:
10
+ """To read the default config file, contains the page title, model providers and model lists
11
+ we can use Yaml file as well for configurations"""
12
+ def __init__(self, config_file=config_filepath):
13
+ self.config= ConfigParser()
14
+ self.config.read(config_file)
15
+
16
+ def get_llm_options(self):
17
+ return self.config['DEFAULT']["LLM_OPTIONS"].split(", ")
18
+
19
+ def get_groq_model_options(self):
20
+ return self.config['DEFAULT']["GROQ_MODEL_OPTIONS"].split(", ")
21
+
22
+ def get_page_title(self):
23
+ return self.config["DEFAULT"].get("PAGE_TITLE")
24
+
25
+ def get_usecase_options(self):
26
+ return self.config["DEFAULT"].get("USECASE_OPTIONS").split(", ")
src/user_interface/uiconfigfile.ini ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [DEFAULT]
2
+ PAGE_TITLE = LangGraph: Build Stateful Agentic AI graph
3
+ LLM_OPTIONS = Groq
4
+ USECASE_OPTIONS = Basic Chatbot, Chatbot with Tool
5
+ GROQ_MODEL_OPTIONS = mixtral-8x7b-32768, llama3-8b-8192, llama3-70b-8192, gemma-7b-i