dao-ai 0.1.1__py3-none-any.whl → 0.1.3__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.
Files changed (47) hide show
  1. dao_ai/agent_as_code.py +2 -5
  2. dao_ai/cli.py +65 -15
  3. dao_ai/config.py +672 -218
  4. dao_ai/genie/cache/core.py +6 -2
  5. dao_ai/genie/cache/lru.py +29 -11
  6. dao_ai/genie/cache/semantic.py +95 -44
  7. dao_ai/hooks/core.py +5 -5
  8. dao_ai/logging.py +56 -0
  9. dao_ai/memory/core.py +61 -44
  10. dao_ai/memory/databricks.py +54 -41
  11. dao_ai/memory/postgres.py +77 -36
  12. dao_ai/middleware/assertions.py +45 -17
  13. dao_ai/middleware/core.py +13 -7
  14. dao_ai/middleware/guardrails.py +30 -25
  15. dao_ai/middleware/human_in_the_loop.py +9 -5
  16. dao_ai/middleware/message_validation.py +61 -29
  17. dao_ai/middleware/summarization.py +16 -11
  18. dao_ai/models.py +172 -69
  19. dao_ai/nodes.py +148 -19
  20. dao_ai/optimization.py +26 -16
  21. dao_ai/orchestration/core.py +15 -8
  22. dao_ai/orchestration/supervisor.py +22 -8
  23. dao_ai/orchestration/swarm.py +57 -12
  24. dao_ai/prompts.py +17 -17
  25. dao_ai/providers/databricks.py +365 -155
  26. dao_ai/state.py +24 -6
  27. dao_ai/tools/__init__.py +2 -0
  28. dao_ai/tools/agent.py +1 -3
  29. dao_ai/tools/core.py +7 -7
  30. dao_ai/tools/email.py +29 -77
  31. dao_ai/tools/genie.py +18 -13
  32. dao_ai/tools/mcp.py +223 -156
  33. dao_ai/tools/python.py +5 -2
  34. dao_ai/tools/search.py +1 -1
  35. dao_ai/tools/slack.py +21 -9
  36. dao_ai/tools/sql.py +202 -0
  37. dao_ai/tools/time.py +30 -7
  38. dao_ai/tools/unity_catalog.py +129 -86
  39. dao_ai/tools/vector_search.py +318 -244
  40. dao_ai/utils.py +15 -10
  41. dao_ai-0.1.3.dist-info/METADATA +455 -0
  42. dao_ai-0.1.3.dist-info/RECORD +64 -0
  43. dao_ai-0.1.1.dist-info/METADATA +0 -1878
  44. dao_ai-0.1.1.dist-info/RECORD +0 -62
  45. {dao_ai-0.1.1.dist-info → dao_ai-0.1.3.dist-info}/WHEEL +0 -0
  46. {dao_ai-0.1.1.dist-info → dao_ai-0.1.3.dist-info}/entry_points.txt +0 -0
  47. {dao_ai-0.1.1.dist-info → dao_ai-0.1.3.dist-info}/licenses/LICENSE +0 -0
dao_ai/prompts.py CHANGED
@@ -36,7 +36,7 @@ def make_prompt(
36
36
  Returns:
37
37
  An AgentMiddleware created by @dynamic_prompt, or None if no prompt
38
38
  """
39
- logger.debug(f"make_prompt: {base_system_prompt}")
39
+ logger.trace("Creating prompt middleware", has_prompt=bool(base_system_prompt))
40
40
 
41
41
  if not base_system_prompt:
42
42
  return None
@@ -52,11 +52,11 @@ def make_prompt(
52
52
  prompt_template: PromptTemplate = PromptTemplate.from_template(template)
53
53
 
54
54
  if prompt_template.input_variables:
55
- logger.debug(
56
- f"Dynamic prompt with variables: {prompt_template.input_variables}"
55
+ logger.trace(
56
+ "Dynamic prompt with variables", variables=prompt_template.input_variables
57
57
  )
58
58
  else:
59
- logger.debug("Static prompt (no variables, using middleware for consistency)")
59
+ logger.trace("Static prompt (no variables, using middleware for consistency)")
60
60
 
61
61
  @dynamic_prompt
62
62
  def dynamic_system_prompt(request: ModelRequest) -> str:
@@ -73,15 +73,18 @@ def make_prompt(
73
73
  params["user_id"] = context.user_id
74
74
  if context.thread_id and "thread_id" in params:
75
75
  params["thread_id"] = context.thread_id
76
- # Apply all custom context values as template parameters
77
- for key, value in context.custom.items():
78
- if key in params:
76
+ # Apply all context fields as template parameters
77
+ context_dict = context.model_dump()
78
+ for key, value in context_dict.items():
79
+ if key in params and value is not None:
79
80
  params[key] = value
80
81
 
81
82
  # Format the prompt
82
83
  formatted_prompt: str = prompt_template.format(**params)
83
- logger.debug("Formatted dynamic prompt with context")
84
- logger.trace(f"Prompt: {formatted_prompt[:200]}...")
84
+ logger.trace(
85
+ "Formatted dynamic prompt with context",
86
+ prompt_prefix=formatted_prompt[:200],
87
+ )
85
88
 
86
89
  return formatted_prompt
87
90
 
@@ -126,18 +129,15 @@ def create_prompt_middleware(
126
129
  # Access context from runtime
127
130
  context: Context = request.runtime.context
128
131
  if context:
129
- if context.user_id and "user_id" in params:
130
- params["user_id"] = context.user_id
131
- if context.thread_id and "thread_id" in params:
132
- params["thread_id"] = context.thread_id
133
- # Apply all custom context values as template parameters
134
- for key, value in context.custom.items():
135
- if key in params:
132
+ # Apply all context fields as template parameters
133
+ context_dict = context.model_dump()
134
+ for key, value in context_dict.items():
135
+ if key in params and value is not None:
136
136
  params[key] = value
137
137
 
138
138
  # Format the prompt
139
139
  formatted_prompt: str = prompt_template.format(**params)
140
- logger.debug("Formatted dynamic prompt with context")
140
+ logger.trace("Formatted dynamic prompt with context")
141
141
 
142
142
  return formatted_prompt
143
143