Spaces:
Sleeping
Sleeping
Update insight_and_tasks/agents/post_agent.py
Browse files
insight_and_tasks/agents/post_agent.py
CHANGED
@@ -416,13 +416,20 @@ class EnhancedPostPerformanceAgent:
|
|
416 |
Provide a concise summary of findings and actionable recommendations.
|
417 |
"""
|
418 |
def chat_operation():
|
419 |
-
|
420 |
-
|
421 |
-
|
|
|
|
|
|
|
422 |
configure_pandasai(self.api_key, self.model_name)
|
423 |
-
|
424 |
-
|
425 |
-
|
|
|
|
|
|
|
|
|
426 |
return pandas_ai_df.chat(analysis_query)
|
427 |
|
428 |
analysis_result_raw = self.retry_mechanism.retry_with_backoff(
|
|
|
416 |
Provide a concise summary of findings and actionable recommendations.
|
417 |
"""
|
418 |
def chat_operation():
|
419 |
+
config = pai.config.get()
|
420 |
+
logger.info(f"pai_config: {config}, Type of config: {type(config)}")
|
421 |
+
if not config.llm:
|
422 |
+
logger.warning("PandasAI LLM not configured. Attempting to configure now.")
|
423 |
+
# This assumes configure_pandasai is available and sets the LLM config
|
424 |
+
from insight_and_tasks.utils.pandasai_setup import configure_pandasai
|
425 |
configure_pandasai(self.api_key, self.model_name)
|
426 |
+
|
427 |
+
# Re-check configuration after setup attempt
|
428 |
+
config = pai.config.get()
|
429 |
+
if not config.llm:
|
430 |
+
raise RuntimeError("PandasAI LLM could not be configured for chat operation.")
|
431 |
+
|
432 |
+
logger.info(f"Executing PandasAI chat for follower analysis with LLM: {config.llm}")
|
433 |
return pandas_ai_df.chat(analysis_query)
|
434 |
|
435 |
analysis_result_raw = self.retry_mechanism.retry_with_backoff(
|