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.
- dao_ai/agent_as_code.py +2 -5
- dao_ai/cli.py +65 -15
- dao_ai/config.py +672 -218
- dao_ai/genie/cache/core.py +6 -2
- dao_ai/genie/cache/lru.py +29 -11
- dao_ai/genie/cache/semantic.py +95 -44
- dao_ai/hooks/core.py +5 -5
- dao_ai/logging.py +56 -0
- dao_ai/memory/core.py +61 -44
- dao_ai/memory/databricks.py +54 -41
- dao_ai/memory/postgres.py +77 -36
- dao_ai/middleware/assertions.py +45 -17
- dao_ai/middleware/core.py +13 -7
- dao_ai/middleware/guardrails.py +30 -25
- dao_ai/middleware/human_in_the_loop.py +9 -5
- dao_ai/middleware/message_validation.py +61 -29
- dao_ai/middleware/summarization.py +16 -11
- dao_ai/models.py +172 -69
- dao_ai/nodes.py +148 -19
- dao_ai/optimization.py +26 -16
- dao_ai/orchestration/core.py +15 -8
- dao_ai/orchestration/supervisor.py +22 -8
- dao_ai/orchestration/swarm.py +57 -12
- dao_ai/prompts.py +17 -17
- dao_ai/providers/databricks.py +365 -155
- dao_ai/state.py +24 -6
- dao_ai/tools/__init__.py +2 -0
- dao_ai/tools/agent.py +1 -3
- dao_ai/tools/core.py +7 -7
- dao_ai/tools/email.py +29 -77
- dao_ai/tools/genie.py +18 -13
- dao_ai/tools/mcp.py +223 -156
- dao_ai/tools/python.py +5 -2
- dao_ai/tools/search.py +1 -1
- dao_ai/tools/slack.py +21 -9
- dao_ai/tools/sql.py +202 -0
- dao_ai/tools/time.py +30 -7
- dao_ai/tools/unity_catalog.py +129 -86
- dao_ai/tools/vector_search.py +318 -244
- dao_ai/utils.py +15 -10
- dao_ai-0.1.3.dist-info/METADATA +455 -0
- dao_ai-0.1.3.dist-info/RECORD +64 -0
- dao_ai-0.1.1.dist-info/METADATA +0 -1878
- dao_ai-0.1.1.dist-info/RECORD +0 -62
- {dao_ai-0.1.1.dist-info → dao_ai-0.1.3.dist-info}/WHEEL +0 -0
- {dao_ai-0.1.1.dist-info → dao_ai-0.1.3.dist-info}/entry_points.txt +0 -0
- {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.
|
|
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.
|
|
56
|
-
|
|
55
|
+
logger.trace(
|
|
56
|
+
"Dynamic prompt with variables", variables=prompt_template.input_variables
|
|
57
57
|
)
|
|
58
58
|
else:
|
|
59
|
-
logger.
|
|
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
|
|
77
|
-
|
|
78
|
-
|
|
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.
|
|
84
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
params
|
|
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.
|
|
140
|
+
logger.trace("Formatted dynamic prompt with context")
|
|
141
141
|
|
|
142
142
|
return formatted_prompt
|
|
143
143
|
|