Spaces:
Running
Running
Kalyanbrata Maity
commited on
Commit
·
47d9cd0
1
Parent(s):
637fd0b
added display result ui
Browse files- src/langgraphagenticai/__pycache__/main.cpython-312.pyc +0 -0
- src/langgraphagenticai/graph/__pycache__/__init__.cpython-312.pyc +0 -0
- src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-312.pyc +0 -0
- src/langgraphagenticai/graph/graph_builder.py +0 -1
- src/langgraphagenticai/llms/__pycache__/__init__.cpython-312.pyc +0 -0
- src/langgraphagenticai/llms/__pycache__/groq_llm.cpython-312.pyc +0 -0
- src/langgraphagenticai/main.py +4 -4
- src/langgraphagenticai/nodes/__pycache__/__init__.cpython-312.pyc +0 -0
- src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-312.pyc +0 -0
- src/langgraphagenticai/nodes/basic_chatbot_node.py +1 -1
- src/langgraphagenticai/state/__pycache__/__init__.cpython-312.pyc +0 -0
- src/langgraphagenticai/state/__pycache__/state.cpython-312.pyc +0 -0
- src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-312.pyc +0 -0
- src/langgraphagenticai/ui/streamlit/__pycache__/display_result.cpython-312.pyc +0 -0
- src/langgraphagenticai/ui/streamlit/display_result.py +24 -0
- src/langgraphagenticai/ui/uiconfigfile.ini +1 -1
- src/langgraphagenticai/ui/uiconfigfile.py +3 -3
src/langgraphagenticai/__pycache__/main.cpython-312.pyc
CHANGED
Binary files a/src/langgraphagenticai/__pycache__/main.cpython-312.pyc and b/src/langgraphagenticai/__pycache__/main.cpython-312.pyc differ
|
|
src/langgraphagenticai/graph/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (188 Bytes). View file
|
|
src/langgraphagenticai/graph/__pycache__/graph_builder.cpython-312.pyc
ADDED
Binary file (2.27 kB). View file
|
|
src/langgraphagenticai/graph/graph_builder.py
CHANGED
@@ -4,7 +4,6 @@ from langchain_core.prompts import ChatPromptTemplate
|
|
4 |
from src.langgraphagenticai.state.state import State
|
5 |
from src.langgraphagenticai.nodes.basic_chatbot_node import BasicChatbotNode
|
6 |
|
7 |
-
|
8 |
class GraphBuilder:
|
9 |
def __init__(self, model):
|
10 |
self.llm = model
|
|
|
4 |
from src.langgraphagenticai.state.state import State
|
5 |
from src.langgraphagenticai.nodes.basic_chatbot_node import BasicChatbotNode
|
6 |
|
|
|
7 |
class GraphBuilder:
|
8 |
def __init__(self, model):
|
9 |
self.llm = model
|
src/langgraphagenticai/llms/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (187 Bytes). View file
|
|
src/langgraphagenticai/llms/__pycache__/groq_llm.cpython-312.pyc
ADDED
Binary file (1.35 kB). View file
|
|
src/langgraphagenticai/main.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import json
|
3 |
|
|
|
4 |
from src.langgraphagenticai.ui.streamlit.load_ui import LoadStreamlitUI
|
5 |
from src.langgraphagenticai.llms.groq_llm import GroqChatLLM
|
6 |
from src.langgraphagenticai.graph.graph_builder import GraphBuilder
|
@@ -48,11 +49,10 @@ def load_langgraph_agenticai_app():
|
|
48 |
graph_builder = GraphBuilder(model)
|
49 |
try:
|
50 |
graph = graph_builder.setup_graph(usecase)
|
|
|
51 |
except Exception as e:
|
52 |
-
st.error(f"Error: Graph setup failed
|
53 |
return
|
54 |
|
55 |
except Exception as e:
|
56 |
-
raise ValueError(f"Error Occurred with Exception: {e}")
|
57 |
-
|
58 |
-
print(user_input)
|
|
|
1 |
import streamlit as st
|
2 |
import json
|
3 |
|
4 |
+
from src.langgraphagenticai.ui.streamlit.display_result import DisplayResultStreamlit
|
5 |
from src.langgraphagenticai.ui.streamlit.load_ui import LoadStreamlitUI
|
6 |
from src.langgraphagenticai.llms.groq_llm import GroqChatLLM
|
7 |
from src.langgraphagenticai.graph.graph_builder import GraphBuilder
|
|
|
49 |
graph_builder = GraphBuilder(model)
|
50 |
try:
|
51 |
graph = graph_builder.setup_graph(usecase)
|
52 |
+
DisplayResultStreamlit(usecase, graph, user_message).display_result_in_ui()
|
53 |
except Exception as e:
|
54 |
+
st.error(f"Error: Graph setup failed {e}")
|
55 |
return
|
56 |
|
57 |
except Exception as e:
|
58 |
+
raise ValueError(f"Error Occurred with Exception: {e}")
|
|
|
|
src/langgraphagenticai/nodes/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (188 Bytes). View file
|
|
src/langgraphagenticai/nodes/__pycache__/basic_chatbot_node.cpython-312.pyc
ADDED
Binary file (1.04 kB). View file
|
|
src/langgraphagenticai/nodes/basic_chatbot_node.py
CHANGED
@@ -11,4 +11,4 @@ class BasicChatbotNode:
|
|
11 |
"""
|
12 |
Processes the input state and generates a chatbot response.
|
13 |
"""
|
14 |
-
return {"
|
|
|
11 |
"""
|
12 |
Processes the input state and generates a chatbot response.
|
13 |
"""
|
14 |
+
return {"messages": self.llm.invoke(state['messages'])}
|
src/langgraphagenticai/state/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (188 Bytes). View file
|
|
src/langgraphagenticai/state/__pycache__/state.cpython-312.pyc
ADDED
Binary file (851 Bytes). View file
|
|
src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-312.pyc
CHANGED
Binary files a/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-312.pyc and b/src/langgraphagenticai/ui/__pycache__/uiconfigfile.cpython-312.pyc differ
|
|
src/langgraphagenticai/ui/streamlit/__pycache__/display_result.cpython-312.pyc
ADDED
Binary file (1.88 kB). View file
|
|
src/langgraphagenticai/ui/streamlit/display_result.py
CHANGED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from langchain_core.messages import HumanMessage, AIMessage
|
3 |
+
import json
|
4 |
+
|
5 |
+
class DisplayResultStreamlit:
|
6 |
+
def __init__(self, usecase, graph, user_message):
|
7 |
+
self.usecase = usecase
|
8 |
+
self.graph = graph
|
9 |
+
self.user_message = user_message
|
10 |
+
|
11 |
+
def display_result_in_ui(self):
|
12 |
+
usecase = self.usecase
|
13 |
+
graph = self.graph
|
14 |
+
user_message = self.user_message
|
15 |
+
if usecase == "Basic Chatbot":
|
16 |
+
print(usecase, graph, user_message)
|
17 |
+
for event in graph.stream({'messages': ("user", user_message)}):
|
18 |
+
print(event.values())
|
19 |
+
for value in event.values():
|
20 |
+
print(value['messages'])
|
21 |
+
with st.chat_message("user"):
|
22 |
+
st.write(user_message)
|
23 |
+
with st.chat_message("assistant"):
|
24 |
+
st.write(value["messages"].content)
|
src/langgraphagenticai/ui/uiconfigfile.ini
CHANGED
@@ -2,4 +2,4 @@
|
|
2 |
PAGE_TITLE = LangGraph: Build Stateful Agentic AI graph
|
3 |
LLM_OPTIONS = Groq, OPENAI
|
4 |
USECASE_OPTIONS = Basic Chatbot, Voice Analyzer
|
5 |
-
GROQ_MODEL_OPTIONS = mixtral-8x7b-32768,
|
|
|
2 |
PAGE_TITLE = LangGraph: Build Stateful Agentic AI graph
|
3 |
LLM_OPTIONS = Groq, OPENAI
|
4 |
USECASE_OPTIONS = Basic Chatbot, Voice Analyzer
|
5 |
+
GROQ_MODEL_OPTIONS = mixtral-8x7b-32768, llama-3.3-70b-versatile, gemma2-9b-it
|
src/langgraphagenticai/ui/uiconfigfile.py
CHANGED
@@ -8,13 +8,13 @@ class Config:
|
|
8 |
|
9 |
|
10 |
def get_llm_options(self):
|
11 |
-
return self.config["DEFAULT"].get("LLM_OPTIONS").split(",")
|
12 |
|
13 |
def get_usecase_options(self):
|
14 |
-
return self.config["DEFAULT"].get("USECASE_OPTIONS").split(",")
|
15 |
|
16 |
def get_groq_model_options(self):
|
17 |
-
return self.config["DEFAULT"].get("GROQ_MODEL_OPTIONS").split(",")
|
18 |
|
19 |
def get_page_title(self):
|
20 |
return self.config["DEFAULT"].get("PAGE_TITLE")
|
|
|
8 |
|
9 |
|
10 |
def get_llm_options(self):
|
11 |
+
return self.config["DEFAULT"].get("LLM_OPTIONS").split(", ")
|
12 |
|
13 |
def get_usecase_options(self):
|
14 |
+
return self.config["DEFAULT"].get("USECASE_OPTIONS").split(", ")
|
15 |
|
16 |
def get_groq_model_options(self):
|
17 |
+
return self.config["DEFAULT"].get("GROQ_MODEL_OPTIONS").split(", ")
|
18 |
|
19 |
def get_page_title(self):
|
20 |
return self.config["DEFAULT"].get("PAGE_TITLE")
|