dao-ai 0.0.7__py3-none-any.whl → 0.0.9__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 +27 -1
- dao_ai/models.py +1 -1
- dao_ai/providers/databricks.py +15 -8
- dao_ai/utils.py +8 -0
- {dao_ai-0.0.7.dist-info → dao_ai-0.0.9.dist-info}/METADATA +1 -1
- {dao_ai-0.0.7.dist-info → dao_ai-0.0.9.dist-info}/RECORD +9 -9
- {dao_ai-0.0.7.dist-info → dao_ai-0.0.9.dist-info}/WHEEL +0 -0
- {dao_ai-0.0.7.dist-info → dao_ai-0.0.9.dist-info}/entry_points.txt +0 -0
- {dao_ai-0.0.7.dist-info → dao_ai-0.0.9.dist-info}/licenses/LICENSE +0 -0
dao_ai/config.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import atexit
|
|
2
2
|
import os
|
|
3
|
+
import sys
|
|
3
4
|
from abc import ABC, abstractmethod
|
|
4
5
|
from enum import Enum
|
|
5
6
|
from os import PathLike
|
|
@@ -13,7 +14,7 @@ from typing import (
|
|
|
13
14
|
TypeAlias,
|
|
14
15
|
Union,
|
|
15
16
|
)
|
|
16
|
-
|
|
17
|
+
import importlib
|
|
17
18
|
from databricks.sdk import WorkspaceClient
|
|
18
19
|
from databricks.sdk.credentials_provider import (
|
|
19
20
|
CredentialsStrategy,
|
|
@@ -28,6 +29,7 @@ from langchain_core.language_models import LanguageModelLike
|
|
|
28
29
|
from langchain_core.runnables.base import RunnableLike
|
|
29
30
|
from langchain_openai import ChatOpenAI
|
|
30
31
|
from langgraph.checkpoint.base import BaseCheckpointSaver
|
|
32
|
+
from langgraph.graph.state import CompiledStateGraph
|
|
31
33
|
from langgraph.store.base import BaseStore
|
|
32
34
|
from loguru import logger
|
|
33
35
|
from mlflow.models import ModelConfig
|
|
@@ -41,6 +43,7 @@ from mlflow.models.resources import (
|
|
|
41
43
|
DatabricksUCConnection,
|
|
42
44
|
DatabricksVectorSearchIndex,
|
|
43
45
|
)
|
|
46
|
+
from mlflow.pyfunc import ChatModel
|
|
44
47
|
from pydantic import BaseModel, ConfigDict, Field, field_serializer, model_validator
|
|
45
48
|
|
|
46
49
|
|
|
@@ -1067,6 +1070,16 @@ class AppModel(BaseModel):
|
|
|
1067
1070
|
|
|
1068
1071
|
return self
|
|
1069
1072
|
|
|
1073
|
+
@model_validator(mode="after")
|
|
1074
|
+
def add_code_paths_to_sys_path(self):
|
|
1075
|
+
for code_path in self.code_paths:
|
|
1076
|
+
parent_path: str = str(Path(code_path).parent)
|
|
1077
|
+
if parent_path not in sys.path:
|
|
1078
|
+
sys.path.insert(0, parent_path)
|
|
1079
|
+
logger.debug(f"Added code path to sys.path: {parent_path}")
|
|
1080
|
+
importlib.invalidate_caches()
|
|
1081
|
+
return self
|
|
1082
|
+
|
|
1070
1083
|
|
|
1071
1084
|
class GuidelineModel(BaseModel):
|
|
1072
1085
|
model_config = ConfigDict(use_enum_values=True, extra="forbid")
|
|
@@ -1320,3 +1333,16 @@ class AppConfig(BaseModel):
|
|
|
1320
1333
|
return [
|
|
1321
1334
|
guardrail for guardrail in self.guardrails.values() if predicate(guardrail)
|
|
1322
1335
|
]
|
|
1336
|
+
|
|
1337
|
+
def as_graph(self) -> CompiledStateGraph:
|
|
1338
|
+
from dao_ai.graph import create_dao_ai_graph
|
|
1339
|
+
|
|
1340
|
+
graph: CompiledStateGraph = create_dao_ai_graph(config=self)
|
|
1341
|
+
return graph
|
|
1342
|
+
|
|
1343
|
+
def as_chat_model(self) -> ChatModel:
|
|
1344
|
+
from dao_ai.models import create_agent
|
|
1345
|
+
|
|
1346
|
+
graph: CompiledStateGraph = self.as_graph()
|
|
1347
|
+
app: ChatModel = create_agent(graph)
|
|
1348
|
+
return app
|
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.
|
dao_ai/providers/databricks.py
CHANGED
|
@@ -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
|
|
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
|
-
|
|
280
|
-
|
|
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.
|
|
3
|
+
Version: 0.0.9
|
|
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
|
|
@@ -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=
|
|
6
|
+
dao_ai/config.py,sha256=b6tSRMCLPIG4WeDagXIEJVcTHq9ldZILyGe8o_k_yaw,44196
|
|
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=
|
|
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=
|
|
15
|
+
dao_ai/utils.py,sha256=VcYeGrXsPAKwXPNL6k5DEfzNGT3T_J9WxVJ9hDf__s8,4165
|
|
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=
|
|
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.
|
|
37
|
-
dao_ai-0.0.
|
|
38
|
-
dao_ai-0.0.
|
|
39
|
-
dao_ai-0.0.
|
|
40
|
-
dao_ai-0.0.
|
|
36
|
+
dao_ai-0.0.9.dist-info/METADATA,sha256=wpLMfCr0n0x-1tkDKnuAyiWJIBl1xbWTkNLrKCGjI_s,41169
|
|
37
|
+
dao_ai-0.0.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
38
|
+
dao_ai-0.0.9.dist-info/entry_points.txt,sha256=Xa-UFyc6gWGwMqMJOt06ZOog2vAfygV_DSwg1AiP46g,43
|
|
39
|
+
dao_ai-0.0.9.dist-info/licenses/LICENSE,sha256=YZt3W32LtPYruuvHE9lGk2bw6ZPMMJD8yLrjgHybyz4,1069
|
|
40
|
+
dao_ai-0.0.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|