Skip to content

Commit 03df9f4

Browse files
added logs for debugging
1 parent 6c3f497 commit 03df9f4

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/api/api/api_routes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ async def conversation(request: Request):
117117
# Get the request JSON and last RAG response from the client
118118
request_json = await request.json()
119119
conversation_id = request_json.get("conversation_id")
120+
logger.info(f"Chat request received - Conversation ID: {conversation_id}")
121+
print(f"Chat request received - Conversation ID: {conversation_id}")
122+
120123
query = request_json.get("messages")[-1].get("content")
121124
chat_service = ChatService(request=request)
122125
result = await chat_service.stream_chat_request(request_json, conversation_id, query)

src/api/plugins/chat_with_data_plugin.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ async def get_database_metrics(
8989
# Clean up
9090
project_client.agents.threads.delete(thread_id=thread.id)
9191

92-
except Exception:
92+
except Exception as e:
93+
print(f"Exception during database metrics retrieval from get_database_metrics: {e}")
9394
answer = 'Details could not be retrieved. Please try again later.'
9495

96+
print(f"Response from Plugin: Database metrics from get_database_metrics : %s", answer)
9597
return answer
9698

9799
@kernel_function(name="GetCallInsights", description="Provides summaries, explanations, and insights from customer call transcripts.")
@@ -163,8 +165,10 @@ def replace_marker(match):
163165
answer["answer"] = convert_citation_markers(answer["answer"])
164166
break
165167
project_client.agents.threads.delete(thread_id=thread.id)
166-
except Exception:
168+
except Exception as e:
169+
print(f"Error in get_call_insights: %s", e)
167170
return "Details could not be retrieved. Please try again later."
171+
print(f"Response from Plugin: Call insights data from get_call_insights : %s", answer)
168172
return answer
169173

170174
@kernel_function(name="GenerateChartData", description="Generates Chart.js v4.4.4 compatible JSON data for data visualization requests using current and immediate previous context.")
@@ -174,8 +178,13 @@ async def generate_chart_data(
174178
):
175179
query = input
176180
query = query.strip()
181+
print(f"Chart generation started for query: {query}")
182+
177183
try:
184+
print("Fetching chart agent from factory...")
178185
agent_info = await ChartAgentFactory.get_agent()
186+
print(f"Chart agent retrieved successfully. Agent ID: {agent_info['agent'].id if agent_info.get('agent') else 'Unknown'}")
187+
179188
agent = agent_info["agent"]
180189
project_client = agent_info["client"]
181190

@@ -193,7 +202,8 @@ async def generate_chart_data(
193202
)
194203

195204
if run.status == "failed":
196-
print(f"Run failed: {run.last_error}")
205+
print(f"Chart generation run failed: {run.last_error}")
206+
print(f"Run details - ID: {run.id}, Thread ID: {thread.id}")
197207
return "Details could not be retrieved. Please try again later."
198208

199209
chartdata = ""
@@ -205,6 +215,8 @@ async def generate_chart_data(
205215
# Clean up
206216
project_client.agents.threads.delete(thread_id=thread.id)
207217

208-
except Exception:
218+
except Exception as e:
219+
print(f"Exception during chart data generation from generate_chart_data: {e}")
209220
chartdata = 'Details could not be retrieved. Please try again later.'
221+
print(f"Response from Plugin: Chart data from generate_chart_data : %s", chartdata)
210222
return chartdata

src/api/services/chat_service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ async def stream_chat_request(self, request_body, conversation_id, query):
140140
Handles streaming chat requests.
141141
"""
142142
history_metadata = request_body.get("history_metadata", {})
143+
logger.info(f"History Metadata: {history_metadata}")
144+
print(f"History Metadata: {history_metadata}")
143145

144146
async def generate():
145147
try:
@@ -206,6 +208,8 @@ async def complete_chat_request(self, query, last_rag_response=None):
206208
"""
207209
Completes a chat request by generating a chart from the RAG response.
208210
"""
211+
logger.info(f"GBC: Starting complete_chat_request in chat_Service.")
212+
print(f"GBC: Starting complete_chat_request in chat_Service.")
209213
if not last_rag_response:
210214
return {"error": "A previous RAG response is required to generate a chart."}
211215

0 commit comments

Comments
 (0)