Spaces:
Sleeping
Sleeping
Commit
·
b2982ed
1
Parent(s):
bb3134a
next
Browse files
logs/access.log
CHANGED
|
@@ -1824,3 +1824,14 @@
|
|
| 1824 |
2025-11-14 15:21:39,030 | INFO | access_logger | app.py:20 | Response status: 200
|
| 1825 |
2025-11-14 15:34:22,638 | INFO | access_logger | app.py:18 | Request: POST http://127.0.0.1:8000/api/analytics-chatbot
|
| 1826 |
2025-11-14 15:34:30,193 | INFO | access_logger | app.py:20 | Response status: 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1824 |
2025-11-14 15:21:39,030 | INFO | access_logger | app.py:20 | Response status: 200
|
| 1825 |
2025-11-14 15:34:22,638 | INFO | access_logger | app.py:18 | Request: POST http://127.0.0.1:8000/api/analytics-chatbot
|
| 1826 |
2025-11-14 15:34:30,193 | INFO | access_logger | app.py:20 | Response status: 200
|
| 1827 |
+
2025-11-17 12:34:36,598 | INFO | access_logger | app.py:18 | Request: GET http://127.0.0.1:8000/
|
| 1828 |
+
2025-11-17 12:34:36,599 | INFO | access_logger | app.py:20 | Response status: 200
|
| 1829 |
+
2025-11-17 12:34:37,112 | INFO | access_logger | app.py:18 | Request: GET http://127.0.0.1:8000/favicon.ico
|
| 1830 |
+
2025-11-17 12:34:37,113 | INFO | access_logger | app.py:20 | Response status: 404
|
| 1831 |
+
2025-11-17 12:34:40,115 | INFO | access_logger | app.py:18 | Request: GET http://127.0.0.1:8000/docs
|
| 1832 |
+
2025-11-17 12:34:40,115 | INFO | access_logger | app.py:20 | Response status: 200
|
| 1833 |
+
2025-11-17 12:34:40,269 | INFO | access_logger | app.py:18 | Request: GET http://127.0.0.1:8000/openapi.json
|
| 1834 |
+
2025-11-17 12:34:40,276 | INFO | access_logger | app.py:20 | Response status: 200
|
| 1835 |
+
2025-11-17 12:35:00,599 | INFO | access_logger | app.py:18 | Request: POST http://127.0.0.1:8000/api/analytics-chatbot
|
| 1836 |
+
2025-11-17 12:35:24,309 | INFO | access_logger | app.py:20 | Response status: 200
|
| 1837 |
+
2025-11-17 12:36:00,652 | INFO | access_logger | app.py:18 | Request: POST http://127.0.0.1:8000/api/analytics-chatbot
|
src/genai/analytics_chatbot/agent.py
CHANGED
|
@@ -30,8 +30,8 @@ class ChatbotAgent:
|
|
| 30 |
graph_builder.add_edge(START, "fetch_last_message")
|
| 31 |
graph_builder.add_edge("fetch_last_message", 'retrieve_api_endpoints')
|
| 32 |
graph_builder.add_edge("retrieve_api_endpoints", 'retrieve_exact_endpoint')
|
| 33 |
-
graph_builder.add_edge("retrieve_exact_endpoint", '
|
| 34 |
-
graph_builder.add_edge("check_query_type", 'fetch_parameters')
|
| 35 |
graph_builder.add_edge("fetch_parameters", 'fetch_data')
|
| 36 |
graph_builder.add_edge("fetch_data", END)
|
| 37 |
graph_builder.add_edge("backup_response", END)
|
|
|
|
| 30 |
graph_builder.add_edge(START, "fetch_last_message")
|
| 31 |
graph_builder.add_edge("fetch_last_message", 'retrieve_api_endpoints')
|
| 32 |
graph_builder.add_edge("retrieve_api_endpoints", 'retrieve_exact_endpoint')
|
| 33 |
+
graph_builder.add_edge("retrieve_exact_endpoint", 'fetch_parameters')
|
| 34 |
+
# graph_builder.add_edge("check_query_type", 'fetch_parameters')
|
| 35 |
graph_builder.add_edge("fetch_parameters", 'fetch_data')
|
| 36 |
graph_builder.add_edge("fetch_data", END)
|
| 37 |
graph_builder.add_edge("backup_response", END)
|
src/genai/analytics_chatbot/utils/nodes.py
CHANGED
|
@@ -111,17 +111,18 @@ class FetchParametersNode:
|
|
| 111 |
result = self.llm.with_structured_output(ParameterFormatter, method='function_calling').invoke(messages)
|
| 112 |
parameters_values = {k: (process_query(v) if isinstance(v, str) else v) for k, v in result.parameters_values.items()}
|
| 113 |
|
| 114 |
-
if 'single_influencer_query' in state['query_type']:
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
elif 'aggregate_query' in state['query_type']:
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
| 125 |
except Exception as e:
|
| 126 |
print('Error occoured:', e)
|
| 127 |
return {'error_message': str(e)}
|
|
@@ -148,6 +149,7 @@ class FetchDataNode:
|
|
| 148 |
|
| 149 |
def run(self, state:State):
|
| 150 |
try:
|
|
|
|
| 151 |
|
| 152 |
print('Entered to fetch data')
|
| 153 |
url = f'''{self.base_url}{state['endpoint']}'''
|
|
@@ -165,22 +167,22 @@ class FetchDataNode:
|
|
| 165 |
print('Data from api:', response)
|
| 166 |
return {'response':response.json()}
|
| 167 |
|
| 168 |
-
elif 'aggregate_query' in state['query_type']:
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
|
| 185 |
|
| 186 |
except Exception as e:
|
|
|
|
| 111 |
result = self.llm.with_structured_output(ParameterFormatter, method='function_calling').invoke(messages)
|
| 112 |
parameters_values = {k: (process_query(v) if isinstance(v, str) else v) for k, v in result.parameters_values.items()}
|
| 113 |
|
| 114 |
+
# if 'single_influencer_query' in state['query_type']:
|
| 115 |
+
# print('The parameter values:', parameters_values)
|
| 116 |
+
# return {
|
| 117 |
+
# 'parameters_values':parameters_values
|
| 118 |
+
# }
|
| 119 |
+
# elif 'aggregate_query' in state['query_type']:
|
| 120 |
+
# parameters_values['influencer_username'] = ['divyadhakal_','munachiya','mydarlingfood','_its.me.muskan_']
|
| 121 |
+
# print('The parameter values:', parameters_values)
|
| 122 |
+
# return{
|
| 123 |
+
# 'parameters_values': parameters_values
|
| 124 |
+
# }
|
| 125 |
+
return {'parameters_values': parameters_values}
|
| 126 |
except Exception as e:
|
| 127 |
print('Error occoured:', e)
|
| 128 |
return {'error_message': str(e)}
|
|
|
|
| 149 |
|
| 150 |
def run(self, state:State):
|
| 151 |
try:
|
| 152 |
+
state['query_type']='single_influencer_query'
|
| 153 |
|
| 154 |
print('Entered to fetch data')
|
| 155 |
url = f'''{self.base_url}{state['endpoint']}'''
|
|
|
|
| 167 |
print('Data from api:', response)
|
| 168 |
return {'response':response.json()}
|
| 169 |
|
| 170 |
+
# elif 'aggregate_query' in state['query_type']:
|
| 171 |
+
# print('Entered to aggregrated query execution')
|
| 172 |
+
# print(state['parameters_values'])
|
| 173 |
+
# params = state["parameters_values"]
|
| 174 |
+
# if "influencer_username" in params and isinstance(params["influencer_username"], list):
|
| 175 |
+
# results = {}
|
| 176 |
+
|
| 177 |
+
# # Iterate through each influencer username
|
| 178 |
+
# for username in params["influencer_username"]:
|
| 179 |
+
# current_params = params.copy()
|
| 180 |
+
# current_params["influencer_username"] = username
|
| 181 |
+
|
| 182 |
+
# response = requests.get(url, params=current_params, headers=self.headers)
|
| 183 |
+
# results[username] = response.json() # Store influencer-wise response
|
| 184 |
+
# print('Data from api:', response)
|
| 185 |
+
# return {"response": results}
|
| 186 |
|
| 187 |
|
| 188 |
except Exception as e:
|