diff --git "a/.github\\workflows/main.yml" "b/.github\\workflows/main.yml" new file mode 100644 index 0000000000000000000000000000000000000000..837e01992e5c05c43ee29a39965c1c800f8ddcde --- /dev/null +++ "b/.github\\workflows/main.yml" @@ -0,0 +1,25 @@ +name: Sync to Hugging Face Space +on: + push: + branches: [main] + + # to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + sync-to-hub: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: false + + - name: Ignore large files + run : git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch "Rag_Documents/layout-parser-paper.pdf"' HEAD + + - name: Push to hub + env: + HF_TOKEN: ${{secrets.HF_TOKEN}} + run: git push --force https://Techiiot:$HF_TOKEN@huggingface.co/spaces/Techiiot/sandeep_basic_chatbot main + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..eba74f4cd2e2acfb1470300d69b58d8cff458c68 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b015302cb4a741ff5fba358f4ee2cac93bc403e0 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +--- +title: LanggraphAgenticAI +emoji: 🐨 +colorFrom: blue +colorTo: red +sdk: streamlit +sdk_version: 1.42.0 +app_file: app.py +pinned: false +license: apache-2.0 +short_description: Refined langgraphAgenticAI +--- + +### End To End Agentic AI Projects + + diff --git a/app.py b/app.py new file mode 100644 index 0000000000000000000000000000000000000000..fe9bee6b6cae2f6e5edb0641ac917c310c3bc46b --- /dev/null +++ b/app.py @@ -0,0 +1,5 @@ +from src.langgraphagenticai.main import load_langgraph_agenticai_app + + +if __name__=="__main__": + load_langgraph_agenticai_app() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..22419dc14e33ae130ee8f220d72caf78c34c8828 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +langchain +langgraph +langchain_community +langchain_core +langchain_groq +langchain_openai +faiss-cpu +streamlit diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/__pycache__/__init__.cpython-310.pyc b/src/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f561531f2e66371a10fd1852e4febe8a2aa3cb27 Binary files /dev/null and b/src/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/__pycache__/__init__.cpython-312.pyc b/src/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09f791e5d1f6b0f802670767fe99ebfd36e8ac31 Binary files /dev/null and b/src/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/langgraphagenticai/LLMS/__init__.py b/src/langgraphagenticai/LLMS/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/langgraphagenticai/LLMS/__pycache__/__init__.cpython-310.pyc b/src/langgraphagenticai/LLMS/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed2212f042d5406bbf32eadb431f3bcf5198c059 Binary files /dev/null and b/src/langgraphagenticai/LLMS/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/langgraphagenticai/LLMS/__pycache__/__init__.cpython-312.pyc b/src/langgraphagenticai/LLMS/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5eb7cdc7e92f891e13fa49562a16174d4a989f50 Binary files /dev/null and b/src/langgraphagenticai/LLMS/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/langgraphagenticai/LLMS/__pycache__/groqllm.cpython-310.pyc b/src/langgraphagenticai/LLMS/__pycache__/groqllm.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe45104304a96465528def97cf198d6a978176f2 Binary files /dev/null and b/src/langgraphagenticai/LLMS/__pycache__/groqllm.cpython-310.pyc differ diff --git a/src/langgraphagenticai/LLMS/__pycache__/groqllm.cpython-312.pyc b/src/langgraphagenticai/LLMS/__pycache__/groqllm.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d9d6a7249cfebf683dffc3857e2035dd50819b5 Binary files /dev/null and b/src/langgraphagenticai/LLMS/__pycache__/groqllm.cpython-312.pyc differ diff --git a/src/langgraphagenticai/LLMS/groqllm.py b/src/langgraphagenticai/LLMS/groqllm.py new file mode 100644 index 0000000000000000000000000000000000000000..aebd4183b66698f1ae05ec341b9bfd4c950f155f --- /dev/null +++ b/src/langgraphagenticai/LLMS/groqllm.py @@ -0,0 +1,20 @@ +import os +import streamlit as st +from langchain_groq import ChatGroq + +class GroqLLM: + def __init__(self,user_controls_input): + self.user_controls_input=user_controls_input + + def get_llm_model(self): + try: + groq_api_key=self.user_controls_input['GROQ_API_KEY'] + selected_groq_model=self.user_controls_input['selected_groq_model'] + if groq_api_key=='' and os.environ["GROQ_API_KEY"] =='': + st.error("Please Enter the Groq API KEY") + + llm = ChatGroq(api_key =groq_api_key, model=selected_groq_model) + + except Exception as e: + raise ValueError(f"Error Occurred with Exception : {e}") + return llm \ No newline at end of file diff --git a/src/langgraphagenticai/__init__.py b/src/langgraphagenticai/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/langgraphagenticai/__pycache__/__init__.cpython-310.pyc b/src/langgraphagenticai/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e2d9ebb3a7016e751e63331f98a540ddf0718fd Binary files /dev/null and b/src/langgraphagenticai/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/langgraphagenticai/__pycache__/__init__.cpython-312.pyc b/src/langgraphagenticai/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..20ff31691502550c5fbc3a2c2df56b2f94bf2e72 Binary files /dev/null and b/src/langgraphagenticai/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/langgraphagenticai/__pycache__/main.cpython-310.pyc b/src/langgraphagenticai/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d37aee0c6bf78b347f349f3976d7a933ede9f58e Binary files /dev/null and b/src/langgraphagenticai/__pycache__/main.cpython-310.pyc differ diff --git a/src/langgraphagenticai/__pycache__/main.cpython-312.pyc b/src/langgraphagenticai/__pycache__/main.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2776f34ee081623b6caa32974f9883febf2dfb0 Binary files /dev/null and b/src/langgraphagenticai/__pycache__/main.cpython-312.pyc differ diff --git a/src/langgraphagenticai/graph/__init__.py b/src/langgraphagenticai/graph/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/langgraphagenticai/graph/__pycache__/__init__.cpython-310.pyc b/src/langgraphagenticai/graph/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3212b98cec674e6e7ab7bc63a1b88692a516c655 Binary files /dev/null and b/src/langgraphagenticai/graph/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/langgraphagenticai/graph/__pycache__/__init__.cpython-312.pyc b/src/langgraphagenticai/graph/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..855709664d08847aeca030125faff73ed23d2a99 Binary files /dev/null and b/src/langgraphagenticai/graph/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-310.pyc b/src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b3cbcd3863df16fc06347f51a213a5221855d856 Binary files /dev/null and b/src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-310.pyc differ diff --git a/src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-312.pyc b/src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..839021ef7fbf4057b376574d2eb99bb67d3b1213 Binary files /dev/null and b/src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-312.pyc differ diff --git a/src/langgraphagenticai/graph/graph_builder.py b/src/langgraphagenticai/graph/graph_builder.py new file mode 100644 index 0000000000000000000000000000000000000000..0a3f7495b8dc7f1ab7608396847adbabafdd4cb1 --- /dev/null +++ b/src/langgraphagenticai/graph/graph_builder.py @@ -0,0 +1,39 @@ +from langgraph.graph import StateGraph, START,END, MessagesState +from langgraph.prebuilt import tools_condition,ToolNode +from langchain_core.prompts import ChatPromptTemplate +from src.langgraphagenticai.state.state import State +from src.langgraphagenticai.nodes.basic_chatbot_node import BasicChatbotNode + + + + +class GraphBuilder: + + def __init__(self,model): + self.llm=model + self.graph_builder=StateGraph(State) + + def basic_chatbot_build_graph(self): + """ + Builds a basic chatbot graph using LangGraph. + This method initializes a chatbot node using the `BasicChatbotNode` class + and integrates it into the graph. The chatbot node is set as both the + entry and exit point of the graph. + """ + self.basic_chatbot_node=BasicChatbotNode(self.llm) + self.graph_builder.add_node("chatbot",self.basic_chatbot_node.process) + self.graph_builder.add_edge(START,"chatbot") + self.graph_builder.add_edge("chatbot",END) + + def setup_graph(self, usecase: str): + """ + Sets up the graph for the selected use case. + """ + if usecase == "Basic Chatbot": + self.basic_chatbot_build_graph() + return self.graph_builder.compile() + + + + + diff --git a/src/langgraphagenticai/main.py b/src/langgraphagenticai/main.py new file mode 100644 index 0000000000000000000000000000000000000000..4d426cbffd8518d912895b8dae791f1eadc7cb0b --- /dev/null +++ b/src/langgraphagenticai/main.py @@ -0,0 +1,66 @@ +import streamlit as st +import json +from src.langgraphagenticai.ui.streamlitui.loadui import LoadStreamlitUI +from src.langgraphagenticai.LLMS.groqllm import GroqLLM +from src.langgraphagenticai.graph.graph_builder import GraphBuilder +from src.langgraphagenticai.ui.streamlitui.display_result import DisplayResultStreamlit + +# MAIN Function START +def load_langgraph_agenticai_app(): + """ + Loads and runs the LangGraph AgenticAI application with Streamlit UI. + This function initializes the UI, handles user input, configures the LLM model, + sets up the graph based on the selected use case, and displays the output while + implementing exception handling for robustness. + """ + + # Load UI + ui = LoadStreamlitUI() + user_input = ui.load_streamlit_ui() + + if not user_input: + st.error("Error: Failed to load user input from the U.") + return + + # Text input for user message + if st.session_state.IsFetchButtonClicked: + user_message = st.session_state.timeframe + else : + user_message = st.chat_input("Enter your message:") + + if user_message: + try: + # Configure LLM + obj_llm_config = GroqLLM(user_controls_input=user_input) + model = obj_llm_config.get_llm_model() + + if not model: + st.error("Error: LLM model could not be initialized.") + return + + # Initialize and set up the graph based on use case + usecase = user_input.get('selected_usecase') + if not usecase: + st.error("Error: No use case selected.") + return + + + ### Graph Builder + graph_builder=GraphBuilder(model) + try: + graph = graph_builder.setup_graph(usecase) + DisplayResultStreamlit(usecase,graph,user_message).display_result_on_ui() + except Exception as e: + st.error(f"Error: Graph setup failed - {e}") + return + + + except Exception as e: + raise ValueError(f"Error Occurred with Exception : {e}") + + + + + + + diff --git a/src/langgraphagenticai/nodes/__init__.py b/src/langgraphagenticai/nodes/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/langgraphagenticai/nodes/__pycache__/__init__.cpython-310.pyc b/src/langgraphagenticai/nodes/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f275a6de6c3360bab47774a49117b31e5031931 Binary files /dev/null and b/src/langgraphagenticai/nodes/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/langgraphagenticai/nodes/__pycache__/__init__.cpython-312.pyc b/src/langgraphagenticai/nodes/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9dabacb55344a6d44e6c732440386d461f4ac25 Binary files /dev/null and b/src/langgraphagenticai/nodes/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-310.pyc b/src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e1c3ccb18d4d234e74ca60caca0c55c56dded1e Binary files /dev/null and b/src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-310.pyc differ diff --git a/src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-312.pyc b/src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..424d97755b7b3fbec8c7f4c156d41af76c49e978 Binary files /dev/null and b/src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-312.pyc differ diff --git a/src/langgraphagenticai/nodes/basic_chatbot_node.py b/src/langgraphagenticai/nodes/basic_chatbot_node.py new file mode 100644 index 0000000000000000000000000000000000000000..97a8cd6ad415dfa74efd664b2879ba1b0aa4493a --- /dev/null +++ b/src/langgraphagenticai/nodes/basic_chatbot_node.py @@ -0,0 +1,14 @@ +from src.langgraphagenticai.state.state import State + +class BasicChatbotNode: + """ + Basic chatbot logic implementation. + """ + def __init__(self,model): + self.llm = model + + def process(self, state: State) -> dict: + """ + Processes the input state and generates a chatbot response. + """ + return {"messages":self.llm.invoke(state['messages'])} \ No newline at end of file diff --git a/src/langgraphagenticai/state/__init__.py b/src/langgraphagenticai/state/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/langgraphagenticai/state/__pycache__/__init__.cpython-310.pyc b/src/langgraphagenticai/state/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88fffffa6f0cfab6f60317605c50a5931c642d2e Binary files /dev/null and b/src/langgraphagenticai/state/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/langgraphagenticai/state/__pycache__/__init__.cpython-312.pyc b/src/langgraphagenticai/state/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8938be50232cdfeb556263850a997dc7dacf0744 Binary files /dev/null and b/src/langgraphagenticai/state/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/langgraphagenticai/state/__pycache__/state.cpython-310.pyc b/src/langgraphagenticai/state/__pycache__/state.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03d23a3ed2898479759e1925607aa3983aa2b373 Binary files /dev/null and b/src/langgraphagenticai/state/__pycache__/state.cpython-310.pyc differ diff --git a/src/langgraphagenticai/state/__pycache__/state.cpython-312.pyc b/src/langgraphagenticai/state/__pycache__/state.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0695d3aff6c97d2d77a587022902b5eacf9e223e Binary files /dev/null and b/src/langgraphagenticai/state/__pycache__/state.cpython-312.pyc differ diff --git a/src/langgraphagenticai/state/state.py b/src/langgraphagenticai/state/state.py new file mode 100644 index 0000000000000000000000000000000000000000..26dcb3ce853c6c1a6d384a995a5f966424ce2211 --- /dev/null +++ b/src/langgraphagenticai/state/state.py @@ -0,0 +1,11 @@ +from typing import Annotated, Literal, Optional +from typing_extensions import TypedDict +from langgraph.graph.message import add_messages +from typing import TypedDict, Annotated, List +from langchain_core.messages import HumanMessage, AIMessage + +class State(TypedDict): + """ + Represents the structure of the state used in the graph. + """ + messages: Annotated[list, add_messages] \ No newline at end of file diff --git a/src/langgraphagenticai/tools/__init__.py b/src/langgraphagenticai/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/langgraphagenticai/ui/__init__.py b/src/langgraphagenticai/ui/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/langgraphagenticai/ui/__pycache__/__init__.cpython-310.pyc b/src/langgraphagenticai/ui/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dbbb884825970699bc0e9ff9572d7e387d5d4908 Binary files /dev/null and b/src/langgraphagenticai/ui/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/langgraphagenticai/ui/__pycache__/__init__.cpython-312.pyc b/src/langgraphagenticai/ui/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f123b2eb385d28fc2828d36078513a704f7cdb2 Binary files /dev/null and b/src/langgraphagenticai/ui/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-310.pyc b/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..98af89e389c4b473ff5483f697b345f24964ec68 Binary files /dev/null and b/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-310.pyc differ diff --git a/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-312.pyc b/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bcc8560c996ea5fabb144ff4c5259aa4702e9361 Binary files /dev/null and b/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-312.pyc differ diff --git a/src/langgraphagenticai/ui/streamlitui/__pycache__/display_result.cpython-310.pyc b/src/langgraphagenticai/ui/streamlitui/__pycache__/display_result.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..593e29579c51a28dfdb0a7788e2dac028ea91063 Binary files /dev/null and b/src/langgraphagenticai/ui/streamlitui/__pycache__/display_result.cpython-310.pyc differ diff --git a/src/langgraphagenticai/ui/streamlitui/__pycache__/display_result.cpython-312.pyc b/src/langgraphagenticai/ui/streamlitui/__pycache__/display_result.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d8aa2e684785250919e4ce9589b617e33e02feb Binary files /dev/null and b/src/langgraphagenticai/ui/streamlitui/__pycache__/display_result.cpython-312.pyc differ diff --git a/src/langgraphagenticai/ui/streamlitui/__pycache__/loadui.cpython-310.pyc b/src/langgraphagenticai/ui/streamlitui/__pycache__/loadui.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..26235232c8ac93cc0e6a88368cd6fa11ae9defba Binary files /dev/null and b/src/langgraphagenticai/ui/streamlitui/__pycache__/loadui.cpython-310.pyc differ diff --git a/src/langgraphagenticai/ui/streamlitui/__pycache__/loadui.cpython-312.pyc b/src/langgraphagenticai/ui/streamlitui/__pycache__/loadui.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e31b96fbb7824bdf81f17a9ce24508f069ebf08 Binary files /dev/null and b/src/langgraphagenticai/ui/streamlitui/__pycache__/loadui.cpython-312.pyc differ diff --git a/src/langgraphagenticai/ui/streamlitui/display_result.py b/src/langgraphagenticai/ui/streamlitui/display_result.py new file mode 100644 index 0000000000000000000000000000000000000000..79ec76c895a5efbc8b2f957b2116bfcef9399111 --- /dev/null +++ b/src/langgraphagenticai/ui/streamlitui/display_result.py @@ -0,0 +1,24 @@ +import streamlit as st +from langchain_core.messages import HumanMessage,AIMessage +import json + + +class DisplayResultStreamlit: + def __init__(self,usecase,graph,user_message): + self.usecase= usecase + self.graph = graph + self.user_message = user_message + + def display_result_on_ui(self): + usecase= self.usecase + graph = self.graph + user_message = self.user_message + if usecase =="Basic Chatbot": + for event in graph.stream({'messages':("user",user_message)}): + print(event.values()) + for value in event.values(): + print(value['messages']) + with st.chat_message("user"): + st.write(user_message) + with st.chat_message("assistant"): + st.write(value["messages"].content) \ No newline at end of file diff --git a/src/langgraphagenticai/ui/streamlitui/loadui.py b/src/langgraphagenticai/ui/streamlitui/loadui.py new file mode 100644 index 0000000000000000000000000000000000000000..3ce8da10d29f52d0e83e7a5869b56aead4cae321 --- /dev/null +++ b/src/langgraphagenticai/ui/streamlitui/loadui.py @@ -0,0 +1,64 @@ +import streamlit as st +import os +from datetime import date + +from langchain_core.messages import AIMessage,HumanMessage +from src.langgraphagenticai.ui.uiconfigfile import Config + + +class LoadStreamlitUI: + def __init__(self): + self.config = Config() # config + self.user_controls = {} + + def initialize_session(self): + return { + "current_step": "requirements", + "requirements": "", + "user_stories": "", + "po_feedback": "", + "generated_code": "", + "review_feedback": "", + "decision": None + } + + + + def load_streamlit_ui(self): + st.set_page_config(page_title= self.config.get_page_title(), layout="wide") #"🤖 " + st.header(self.config.get_page_title()) + st.session_state.timeframe = '' + st.session_state.IsFetchButtonClicked = False + st.session_state.IsSDLC = False + + + + with st.sidebar: + # Get options from config + llm_options = self.config.get_llm_options() + usecase_options = self.config.get_usecase_options() + + # LLM selection + self.user_controls["selected_llm"] = st.selectbox("Select LLM", llm_options) + + if self.user_controls["selected_llm"] == 'Groq': + # Model selection + model_options = self.config.get_groq_model_options() + self.user_controls["selected_groq_model"] = st.selectbox("Select Model", model_options) + # API key input + self.user_controls["GROQ_API_KEY"] = st.session_state["GROQ_API_KEY"] = st.text_input("API Key", + type="password") + # Validate API key + if not self.user_controls["GROQ_API_KEY"]: + st.warning("⚠️ Please enter your GROQ API key to proceed. Don't have? refer : https://console.groq.com/keys ") + + + # Use case selection + self.user_controls["selected_usecase"] = st.selectbox("Select Usecases", usecase_options) + + if "state" not in st.session_state: + st.session_state.state = self.initialize_session() + + + + return self.user_controls diff --git a/src/langgraphagenticai/ui/uiconfigfile.ini b/src/langgraphagenticai/ui/uiconfigfile.ini new file mode 100644 index 0000000000000000000000000000000000000000..d2347932d7452fae5e5faf7767622e761409902a --- /dev/null +++ b/src/langgraphagenticai/ui/uiconfigfile.ini @@ -0,0 +1,6 @@ +[DEFAULT] +PAGE_TITLE = LangGraph: Build Stateful Agentic AI graph +LLM_OPTIONS = Groq +USECASE_OPTIONS = Basic Chatbot +GROQ_MODEL_OPTIONS = mixtral-8x7b-32768, llama3-8b-8192, llama3-70b-8192, gemma-7b-i + diff --git a/src/langgraphagenticai/ui/uiconfigfile.py b/src/langgraphagenticai/ui/uiconfigfile.py new file mode 100644 index 0000000000000000000000000000000000000000..e9a4db4ab4c18235c331c378786694ca70bf676d --- /dev/null +++ b/src/langgraphagenticai/ui/uiconfigfile.py @@ -0,0 +1,19 @@ +from configparser import ConfigParser + +class Config: + def __init__(self,config_file="./src/langgraphagenticai/ui/uiconfigfile.ini"): + self.config=ConfigParser() + self.config.read(config_file) + + def get_llm_options(self): + return self.config["DEFAULT"].get("LLM_OPTIONS").split(", ") + + def get_usecase_options(self): + return self.config["DEFAULT"].get("USECASE_OPTIONS").split(", ") + + def get_groq_model_options(self): + return self.config["DEFAULT"].get("GROQ_MODEL_OPTIONS").split(", ") + + def get_page_title(self): + return self.config["DEFAULT"].get("PAGE_TITLE") + diff --git a/src/langgraphagenticai/vectorstore/__init__.py b/src/langgraphagenticai/vectorstore/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391