praisonaiagents 0.0.46__py3-none-any.whl → 0.0.47__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -390,7 +390,15 @@ Context:
390
390
  task.status = "completed"
391
391
  # Run execute_callback for memory operations
392
392
  try:
393
- await task.execute_callback(task_output)
393
+ try:
394
+ # If a loop is already running, just create the task
395
+ loop = asyncio.get_running_loop()
396
+ loop.create_task(task.execute_callback(task_output))
397
+ except RuntimeError:
398
+ # Otherwise, create and set a new loop, and run the callback
399
+ loop = asyncio.new_event_loop()
400
+ asyncio.set_event_loop(loop)
401
+ loop.create_task(task.execute_callback(task_output))
394
402
  except Exception as e:
395
403
  logger.error(f"Error executing memory callback for task {task_id}: {e}")
396
404
  logger.exception(e)
@@ -399,7 +407,12 @@ Context:
399
407
  if task.callback:
400
408
  try:
401
409
  if asyncio.iscoroutinefunction(task.callback):
402
- await task.callback(task_output)
410
+ if asyncio.get_event_loop().is_running():
411
+ asyncio.create_task(task.callback(task_output))
412
+ else:
413
+ loop = asyncio.new_event_loop()
414
+ asyncio.set_event_loop(loop)
415
+ loop.run_until_complete(task.callback(task_output))
403
416
  else:
404
417
  task.callback(task_output)
405
418
  except Exception as e:
@@ -707,12 +720,15 @@ Context:
707
720
  task.status = "completed"
708
721
  # Run execute_callback for memory operations
709
722
  try:
710
- if asyncio.get_event_loop().is_running():
711
- asyncio.create_task(task.execute_callback(task_output))
712
- else:
723
+ try:
724
+ # If a loop is already running, just create the task
725
+ loop = asyncio.get_running_loop()
726
+ loop.create_task(task.execute_callback(task_output))
727
+ except RuntimeError:
728
+ # Otherwise, create and set a new loop, and run the callback
713
729
  loop = asyncio.new_event_loop()
714
730
  asyncio.set_event_loop(loop)
715
- loop.run_until_complete(task.execute_callback(task_output))
731
+ loop.create_task(task.execute_callback(task_output))
716
732
  except Exception as e:
717
733
  logger.error(f"Error executing memory callback for task {task_id}: {e}")
718
734
  logger.exception(e)
@@ -0,0 +1,20 @@
1
+ import logging
2
+ import warnings
3
+
4
+ # Suppress all relevant logs at module level
5
+ logging.getLogger("litellm").setLevel(logging.ERROR)
6
+ logging.getLogger("openai").setLevel(logging.ERROR)
7
+ logging.getLogger("httpx").setLevel(logging.ERROR)
8
+ logging.getLogger("httpcore").setLevel(logging.ERROR)
9
+ logging.getLogger("pydantic").setLevel(logging.ERROR)
10
+
11
+ # Suppress pydantic warnings
12
+ warnings.filterwarnings("ignore", category=UserWarning, module="pydantic")
13
+
14
+ # Configure logging to suppress all INFO messages
15
+ logging.basicConfig(level=logging.WARNING)
16
+
17
+ # Import after suppressing warnings
18
+ from .llm import LLM, LLMContextLengthExceededException
19
+
20
+ __all__ = ["LLM", "LLMContextLengthExceededException"]