dao-ai 0.0.8__py3-none-any.whl → 0.0.10__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/config.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import atexit
2
+ import importlib
2
3
  import os
4
+ import sys
3
5
  from abc import ABC, abstractmethod
4
6
  from enum import Enum
5
7
  from os import PathLike
@@ -1069,6 +1071,16 @@ class AppModel(BaseModel):
1069
1071
 
1070
1072
  return self
1071
1073
 
1074
+ @model_validator(mode="after")
1075
+ def add_code_paths_to_sys_path(self):
1076
+ for code_path in self.code_paths:
1077
+ parent_path: str = str(Path(code_path).parent)
1078
+ if parent_path not in sys.path:
1079
+ sys.path.insert(0, parent_path)
1080
+ logger.debug(f"Added code path to sys.path: {parent_path}")
1081
+ importlib.invalidate_caches()
1082
+ return self
1083
+
1072
1084
 
1073
1085
  class GuidelineModel(BaseModel):
1074
1086
  model_config = ConfigDict(use_enum_values=True, extra="forbid")
dao_ai/models.py CHANGED
@@ -266,7 +266,7 @@ def _process_config_messages_stream(
266
266
  def process_messages_stream(
267
267
  app: LanggraphChatModel,
268
268
  messages: Sequence[BaseMessage] | Sequence[ChatMessage] | dict[str, Any],
269
- custom_inputs: dict[str, Any],
269
+ custom_inputs: Optional[dict[str, Any]] = None,
270
270
  ) -> Generator[ChatCompletionChunk | AIMessageChunk, None, None]:
271
271
  """
272
272
  Process messages through a ChatAgent in streaming mode.
@@ -1,4 +1,5 @@
1
1
  import base64
2
+ from importlib.metadata import version
2
3
  from pathlib import Path
3
4
  from typing import Any, Callable, Final, Sequence
4
5
 
@@ -57,7 +58,12 @@ from dao_ai.config import (
57
58
  )
58
59
  from dao_ai.models import get_latest_model_version
59
60
  from dao_ai.providers.base import ServiceProvider
60
- from dao_ai.utils import get_installed_packages, is_installed, normalize_name
61
+ from dao_ai.utils import (
62
+ get_installed_packages,
63
+ is_installed,
64
+ is_lib_provided,
65
+ normalize_name,
66
+ )
61
67
  from dao_ai.vector_search import endpoint_exists, index_exists
62
68
 
63
69
  MAX_NUM_INDEXES: Final[int] = 50
@@ -262,10 +268,6 @@ class DatabricksProvider(ServiceProvider):
262
268
  )
263
269
  logger.debug(f"auth_policy: {auth_policy}")
264
270
 
265
- pip_requirements: Sequence[str] = (
266
- get_installed_packages() + config.app.pip_requirements
267
- )
268
-
269
271
  code_paths: list[str] = config.app.code_paths
270
272
  for path in code_paths:
271
273
  path = Path(path)
@@ -275,10 +277,13 @@ class DatabricksProvider(ServiceProvider):
275
277
  model_root_path: Path = Path(dao_ai.__file__).parent
276
278
  model_path: Path = model_root_path / "agent_as_code.py"
277
279
 
280
+ pip_requirements: Sequence[str] = config.app.pip_requirements
281
+
278
282
  if is_installed():
279
- pip_requirements += [
280
- f"dao-ai=={dao_ai.__version__}",
281
- ]
283
+ if not is_lib_provided("dao-ai", pip_requirements):
284
+ pip_requirements += [
285
+ f"dao-ai=={version('dao-ai')}",
286
+ ]
282
287
  else:
283
288
  src_path: Path = model_root_path.parent
284
289
  directories: Sequence[Path] = [d for d in src_path.iterdir() if d.is_dir()]
@@ -286,6 +291,8 @@ class DatabricksProvider(ServiceProvider):
286
291
  directory: Path
287
292
  code_paths.append(directory.as_posix())
288
293
 
294
+ pip_requirements += get_installed_packages()
295
+
289
296
  logger.debug(f"pip_requirements: {pip_requirements}")
290
297
  logger.debug(f"code_paths: {code_paths}")
291
298
 
dao_ai/utils.py CHANGED
@@ -11,6 +11,13 @@ from loguru import logger
11
11
  import dao_ai
12
12
 
13
13
 
14
+ def is_lib_provided(lib_name: str, pip_requirements: Sequence[str]) -> bool:
15
+ return any(
16
+ re.search(rf"\b{re.escape(lib_name)}\b", requirement)
17
+ for requirement in pip_requirements
18
+ )
19
+
20
+
14
21
  def is_installed():
15
22
  current_file = os.path.abspath(dao_ai.__file__)
16
23
  site_packages = [os.path.abspath(path) for path in site.getsitepackages()]
@@ -85,6 +92,7 @@ def load_function(function_name: str) -> Callable[..., Any]:
85
92
  >>> version = func("my_model")
86
93
  """
87
94
  logger.debug(f"Loading function: {function_name}")
95
+
88
96
  try:
89
97
  # Split the FQN into module path and function name
90
98
  module_path, func_name = function_name.rsplit(".", 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dao-ai
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: DAO AI: A modular, multi-agent orchestration framework for complex AI workflows. Supports agent handoff, tool integration, and dynamic configuration via YAML.
5
5
  Project-URL: Homepage, https://github.com/natefleming/dao-ai
6
6
  Project-URL: Documentation, https://natefleming.github.io/dao-ai
@@ -27,7 +27,6 @@ Requires-Python: >=3.12
27
27
  Requires-Dist: databricks-agents>=1.2.0
28
28
  Requires-Dist: databricks-langchain>=0.4.2
29
29
  Requires-Dist: databricks-sdk[openai]>=0.55.0
30
- Requires-Dist: databricks-vectorsearch>=0.56
31
30
  Requires-Dist: duckduckgo-search>=8.0.2
32
31
  Requires-Dist: grandalf>=0.8
33
32
  Requires-Dist: langchain-mcp-adapters>=0.1.9
@@ -51,6 +50,10 @@ Requires-Dist: rich>=14.0.0
51
50
  Requires-Dist: scipy<=1.15
52
51
  Requires-Dist: sqlparse>=0.5.3
53
52
  Requires-Dist: unitycatalog-ai[databricks]>=0.3.0
53
+ Provides-Extra: databricks
54
+ Requires-Dist: databricks-connect>=15.0.0; extra == 'databricks'
55
+ Requires-Dist: databricks-vectorsearch>=0.56; extra == 'databricks'
56
+ Requires-Dist: pyspark>=3.5.0; extra == 'databricks'
54
57
  Provides-Extra: dev
55
58
  Requires-Dist: mypy>=1.0.0; extra == 'dev'
56
59
  Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
@@ -3,16 +3,16 @@ dao_ai/agent_as_code.py,sha256=WjBUJzHMAEX7joMaQGgBgnofiKxjJjdQEVsBJ4VSkPA,655
3
3
  dao_ai/catalog.py,sha256=sPZpHTD3lPx4EZUtIWeQV7VQM89WJ6YH__wluk1v2lE,4947
4
4
  dao_ai/chat_models.py,sha256=uhwwOTeLyHWqoTTgHrs4n5iSyTwe4EQcLKnh3jRxPWI,8626
5
5
  dao_ai/cli.py,sha256=Aez2TQW3Q8Ho1IaIkRggt0NevDxAAVPjXkePC5GPJF0,20429
6
- dao_ai/config.py,sha256=0Hz_beCpK2vE-l-8nXl91L71HOzI9VxyojU0AiEg62k,43764
6
+ dao_ai/config.py,sha256=vT3CYFmTDzxc7zSLIat4B5vt-Q4Su-tl3BvFVbkXQIo,44197
7
7
  dao_ai/graph.py,sha256=rIm6cLsWwViB3L1dIZp9qc-U-JgFNB5ngEi22Y3iVGQ,7806
8
8
  dao_ai/guardrails.py,sha256=-Qh0f_2Db9t4Nbrrx9FM7tnpqShjMoyxepZ0HByItfU,4027
9
9
  dao_ai/messages.py,sha256=tRZQTeb5YFKu8cm1xeaCkKhidq-0tdzncNEzVePvits,6806
10
- dao_ai/models.py,sha256=ikfDg2U08meT-b01iGsfkqqy2u_fdlNMSFzVT78taHY,11819
10
+ dao_ai/models.py,sha256=wME6hS7w2BTS4SUlhEYuCExMOYStnWk-YWsyatAHYyY,11836
11
11
  dao_ai/nodes.py,sha256=nusBk8tBLY4JlkmzObCKwDe5JR11A8XzYcenC-yS43o,8406
12
12
  dao_ai/prompts.py,sha256=vpmIbWs_szXUgNNDs5Gh2LcxKZti5pHDKSfoClUcgX0,1289
13
13
  dao_ai/state.py,sha256=GwbMbd1TWZx1T5iQrEOX6_rpxOitlmyeJ8dMr2o_pag,1031
14
14
  dao_ai/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- dao_ai/utils.py,sha256=f4j8HhAxkvFovOfa-AqjEH_635NhyEclvnEbDxU3y1M,3949
15
+ dao_ai/utils.py,sha256=HOSnt9_9kJR8K8d4HfCUmPBfUsM6IYVI2jKxVFeZOvM,4157
16
16
  dao_ai/vector_search.py,sha256=jlaFS_iizJ55wblgzZmswMM3UOL-qOp2BGJc0JqXYSg,2839
17
17
  dao_ai/hooks/__init__.py,sha256=LlHGIuiZt6vGW8K5AQo1XJEkBP5vDVtMhq0IdjcLrD4,417
18
18
  dao_ai/hooks/core.py,sha256=ZShHctUSoauhBgdf1cecy9-D7J6-sGn-pKjuRMumW5U,6663
@@ -22,7 +22,7 @@ dao_ai/memory/core.py,sha256=K45iCEFbqJCVxMi4m3vmBJi4c6TQ-UtKGzyugDTkPP0,4141
22
22
  dao_ai/memory/postgres.py,sha256=YILzA7xtqawPAOLFaGG_i17zW7cQxXTzTD8yd-ipe8k,12480
23
23
  dao_ai/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  dao_ai/providers/base.py,sha256=-fjKypCOk28h6vioPfMj9YZSw_3Kcbi2nMuAyY7vX9k,1383
25
- dao_ai/providers/databricks.py,sha256=8aj2O_m4w55U3p7ZdP48m_jhbknANWv-9wiFtkygw8w,27525
25
+ dao_ai/providers/databricks.py,sha256=vV11SptrzIBEQQyiUqrysMfdpKKPrhVPvUVeEOQxx0o,27684
26
26
  dao_ai/tools/__init__.py,sha256=ye6MHaJY7tUnJ8336YJiLxuZr55zDPNdOw6gm7j5jlc,1103
27
27
  dao_ai/tools/agent.py,sha256=_XMz6HtrybpVthhRyStADechF6vXLFyK97i01XTBhtw,1868
28
28
  dao_ai/tools/core.py,sha256=Kei33S8vrmvPOAyrFNekaWmV2jqZ-IPS1QDSvU7RZF0,1984
@@ -33,8 +33,8 @@ dao_ai/tools/python.py,sha256=XcQiTMshZyLUTVR5peB3vqsoUoAAy8gol9_pcrhddfI,1831
33
33
  dao_ai/tools/time.py,sha256=Y-23qdnNHzwjvnfkWvYsE7PoWS1hfeKy44tA7sCnNac,8759
34
34
  dao_ai/tools/unity_catalog.py,sha256=PXfLj2EgyQgaXq4Qq3t25AmTC4KyVCF_-sCtg6enens,1404
35
35
  dao_ai/tools/vector_search.py,sha256=kLveW-JGwc4IbJ7fKclJFmDXhP3h5XBrjljgab2tRD4,2559
36
- dao_ai-0.0.8.dist-info/METADATA,sha256=2gDd0G5eOPA0RbQcFcx6-kqFIPGJTK3y3wh-Wjk0AS8,41169
37
- dao_ai-0.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
- dao_ai-0.0.8.dist-info/entry_points.txt,sha256=Xa-UFyc6gWGwMqMJOt06ZOog2vAfygV_DSwg1AiP46g,43
39
- dao_ai-0.0.8.dist-info/licenses/LICENSE,sha256=YZt3W32LtPYruuvHE9lGk2bw6ZPMMJD8yLrjgHybyz4,1069
40
- dao_ai-0.0.8.dist-info/RECORD,,
36
+ dao_ai-0.0.10.dist-info/METADATA,sha256=m1Q8MwvYDumRLrJnWwtQkuU1wgauSvbLOay7b92kuHY,41338
37
+ dao_ai-0.0.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
+ dao_ai-0.0.10.dist-info/entry_points.txt,sha256=Xa-UFyc6gWGwMqMJOt06ZOog2vAfygV_DSwg1AiP46g,43
39
+ dao_ai-0.0.10.dist-info/licenses/LICENSE,sha256=YZt3W32LtPYruuvHE9lGk2bw6ZPMMJD8yLrjgHybyz4,1069
40
+ dao_ai-0.0.10.dist-info/RECORD,,