datarobot-genai 0.2.41__tar.gz → 0.2.42__tar.gz
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.
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/PKG-INFO +1 -1
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/pyproject.toml +4 -1
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/agents/base.py +5 -2
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/chat/responses.py +6 -1
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/crewai/agent.py +12 -4
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/crewai/base.py +4 -1
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/crewai/events.py +11 -4
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/microsoft_graph.py +96 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/microsoft_graph/tools.py +146 -1
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/langgraph/agent.py +10 -2
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/llama_index/agent.py +12 -5
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/llama_index/base.py +4 -1
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/agent.py +17 -6
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/.gitignore +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/AUTHORS +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/LICENSE +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/README.md +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/agents/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/chat/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/chat/auth.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/chat/client.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/cli/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/cli/agent_environment.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/cli/agent_kernel.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/custom_model.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/mcp/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/mcp/common.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/telemetry_agent.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/utils/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/utils/auth.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/utils/urls.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/crewai/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/crewai/mcp.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/auth.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/clients.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/config.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/config_utils.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/constants.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/credentials.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dr_mcp_server.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dr_mcp_server_logo.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_prompts/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_prompts/controllers.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_prompts/dr_lib.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_prompts/register.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_prompts/utils.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/base.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/default.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/drum.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/config.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/controllers.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/metadata.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/register.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/schemas/drum_agentic_fallback_schema.json +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/schemas/drum_prediction_fallback_schema.json +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/register.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dynamic_tools/schema.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/exceptions.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/logging.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/mcp_instance.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/memory_management/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/memory_management/manager.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/memory_management/memory_tools.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/routes.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/routes_utils.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/server_life_cycle.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/telemetry.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/tool_config.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/tool_filter.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/utils.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/server.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/clients/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/clients/anthropic.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/clients/base.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/clients/dr_gateway.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/clients/openai.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/elicitation_test_tool.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/integration_mcp_server.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/mcp_utils_ete.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/mcp_utils_integration.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/test_interactive.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/tool_base_ete.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/utils.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/atlassian.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/confluence.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/gdrive.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/jira.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/s3.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/confluence/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/confluence/tools.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/gdrive/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/gdrive/tools.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/jira/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/jira/tools.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/microsoft_graph/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/data.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/deployment.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/deployment_info.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/model.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/predict.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/predict_realtime.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/project.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/training.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/langgraph/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/langgraph/mcp.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/llama_index/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/llama_index/mcp.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/__init__.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_auth_provider.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_llm_clients.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_llm_providers.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_mcp_client.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/helpers.py +0 -0
- {datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/py.typed +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "datarobot-genai"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.42"
|
|
8
8
|
description = "Generic helpers for GenAI"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10, <3.13"
|
|
@@ -187,6 +187,9 @@ fixable = [
|
|
|
187
187
|
"I001", # isort import order within functions
|
|
188
188
|
"PLC0415",# pylint import-outside-toplevel for controlled local imports
|
|
189
189
|
]
|
|
190
|
+
"src/datarobot_genai/**/*.py" = [
|
|
191
|
+
"PLC0415",# pylint import-outside-toplevel: allow lazy imports for memory optimization
|
|
192
|
+
]
|
|
190
193
|
|
|
191
194
|
[tool.ruff.lint.isort]
|
|
192
195
|
force-single-line = true
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
import abc
|
|
16
18
|
import json
|
|
17
19
|
import os
|
|
@@ -19,6 +21,7 @@ from collections.abc import AsyncGenerator
|
|
|
19
21
|
from collections.abc import Mapping
|
|
20
22
|
from typing import Any
|
|
21
23
|
from typing import Generic
|
|
24
|
+
from typing import TypeAlias
|
|
22
25
|
from typing import TypedDict
|
|
23
26
|
from typing import TypeVar
|
|
24
27
|
from typing import cast
|
|
@@ -98,7 +101,7 @@ class BaseAgent(Generic[TTool], abc.ABC):
|
|
|
98
101
|
return get_api_base(self.api_base, deployment_id)
|
|
99
102
|
|
|
100
103
|
@abc.abstractmethod
|
|
101
|
-
async def invoke(self, completion_create_params: CompletionCreateParams) ->
|
|
104
|
+
async def invoke(self, completion_create_params: CompletionCreateParams) -> InvokeReturn:
|
|
102
105
|
raise NotImplementedError("Not implemented")
|
|
103
106
|
|
|
104
107
|
@classmethod
|
|
@@ -167,7 +170,7 @@ class UsageMetrics(TypedDict):
|
|
|
167
170
|
|
|
168
171
|
|
|
169
172
|
# Canonical return type for DRUM-compatible invoke implementations
|
|
170
|
-
InvokeReturn = (
|
|
173
|
+
InvokeReturn: TypeAlias = (
|
|
171
174
|
AsyncGenerator[tuple[str | Event, MultiTurnSample | None, UsageMetrics], None]
|
|
172
175
|
| tuple[str, MultiTurnSample | None, UsageMetrics]
|
|
173
176
|
)
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/chat/responses.py
RENAMED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
"""OpenAI-compatible response helpers for chat interactions."""
|
|
16
16
|
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
17
19
|
import asyncio
|
|
18
20
|
import queue
|
|
19
21
|
import time
|
|
@@ -24,6 +26,7 @@ from collections.abc import AsyncGenerator
|
|
|
24
26
|
from collections.abc import AsyncIterator
|
|
25
27
|
from collections.abc import Iterator
|
|
26
28
|
from concurrent.futures import ThreadPoolExecutor
|
|
29
|
+
from typing import TYPE_CHECKING
|
|
27
30
|
from typing import Any
|
|
28
31
|
from typing import TypeVar
|
|
29
32
|
|
|
@@ -38,10 +41,12 @@ from openai.types.chat import ChatCompletionMessage
|
|
|
38
41
|
from openai.types.chat.chat_completion import Choice
|
|
39
42
|
from openai.types.chat.chat_completion_chunk import Choice as ChunkChoice
|
|
40
43
|
from openai.types.chat.chat_completion_chunk import ChoiceDelta
|
|
41
|
-
from ragas import MultiTurnSample
|
|
42
44
|
|
|
43
45
|
from datarobot_genai.core.agents import default_usage_metrics
|
|
44
46
|
|
|
47
|
+
if TYPE_CHECKING:
|
|
48
|
+
from ragas import MultiTurnSample
|
|
49
|
+
|
|
45
50
|
|
|
46
51
|
class CustomModelChatResponse(ChatCompletion):
|
|
47
52
|
pipeline_interactions: str | None = None
|
|
@@ -11,15 +11,20 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from typing import TYPE_CHECKING
|
|
14
17
|
|
|
15
18
|
from crewai import LLM
|
|
16
|
-
from ragas import MultiTurnSample
|
|
17
|
-
from ragas.messages import AIMessage
|
|
18
|
-
from ragas.messages import HumanMessage
|
|
19
|
-
from ragas.messages import ToolMessage
|
|
20
19
|
|
|
21
20
|
from datarobot_genai.core.utils.urls import get_api_base
|
|
22
21
|
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from ragas import MultiTurnSample
|
|
24
|
+
from ragas.messages import AIMessage
|
|
25
|
+
from ragas.messages import HumanMessage
|
|
26
|
+
from ragas.messages import ToolMessage
|
|
27
|
+
|
|
23
28
|
|
|
24
29
|
def build_llm(
|
|
25
30
|
*,
|
|
@@ -39,4 +44,7 @@ def create_pipeline_interactions_from_messages(
|
|
|
39
44
|
) -> MultiTurnSample | None:
|
|
40
45
|
if not messages:
|
|
41
46
|
return None
|
|
47
|
+
# Lazy import to reduce memory overhead when ragas is not used
|
|
48
|
+
from ragas import MultiTurnSample
|
|
49
|
+
|
|
42
50
|
return MultiTurnSample(user_input=messages)
|
|
@@ -26,13 +26,13 @@ from __future__ import annotations
|
|
|
26
26
|
import abc
|
|
27
27
|
import asyncio
|
|
28
28
|
from collections.abc import AsyncGenerator
|
|
29
|
+
from typing import TYPE_CHECKING
|
|
29
30
|
from typing import Any
|
|
30
31
|
|
|
31
32
|
from crewai import Crew
|
|
32
33
|
from crewai.events.event_bus import CrewAIEventsBus
|
|
33
34
|
from crewai.tools import BaseTool
|
|
34
35
|
from openai.types.chat import CompletionCreateParams
|
|
35
|
-
from ragas import MultiTurnSample
|
|
36
36
|
|
|
37
37
|
from datarobot_genai.core.agents.base import BaseAgent
|
|
38
38
|
from datarobot_genai.core.agents.base import InvokeReturn
|
|
@@ -44,6 +44,9 @@ from datarobot_genai.core.agents.base import is_streaming
|
|
|
44
44
|
from .agent import create_pipeline_interactions_from_messages
|
|
45
45
|
from .mcp import mcp_tools_context
|
|
46
46
|
|
|
47
|
+
if TYPE_CHECKING:
|
|
48
|
+
from ragas import MultiTurnSample
|
|
49
|
+
|
|
47
50
|
|
|
48
51
|
class CrewAIAgent(BaseAgent[BaseTool], abc.ABC):
|
|
49
52
|
"""Abstract base agent for CrewAI workflows.
|
|
@@ -16,12 +16,13 @@ from __future__ import annotations
|
|
|
16
16
|
import importlib
|
|
17
17
|
import json
|
|
18
18
|
import logging
|
|
19
|
+
from typing import TYPE_CHECKING
|
|
19
20
|
from typing import Any
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
from ragas.messages import
|
|
23
|
-
from ragas.messages import
|
|
24
|
-
from ragas.messages import ToolMessage
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from ragas.messages import AIMessage
|
|
24
|
+
from ragas.messages import HumanMessage
|
|
25
|
+
from ragas.messages import ToolMessage
|
|
25
26
|
|
|
26
27
|
# Resolve crewai symbols at runtime to avoid mypy issues with untyped packages
|
|
27
28
|
try:
|
|
@@ -65,6 +66,12 @@ class CrewAIEventListener:
|
|
|
65
66
|
self.messages: list[HumanMessage | AIMessage | ToolMessage] = []
|
|
66
67
|
|
|
67
68
|
def setup_listeners(self, crewai_event_bus: Any) -> None:
|
|
69
|
+
# Lazy import to reduce memory overhead when ragas is not used
|
|
70
|
+
from ragas.messages import AIMessage
|
|
71
|
+
from ragas.messages import HumanMessage
|
|
72
|
+
from ragas.messages import ToolCall
|
|
73
|
+
from ragas.messages import ToolMessage
|
|
74
|
+
|
|
68
75
|
@crewai_event_bus.on(CrewKickoffStartedEvent)
|
|
69
76
|
def on_crew_execution_started(_: Any, event: Any) -> None:
|
|
70
77
|
self.messages.append(
|
|
@@ -586,6 +586,102 @@ class MicrosoftGraphClient:
|
|
|
586
586
|
f"Microsoft Graph API error {response.status_code}: {response.text}"
|
|
587
587
|
)
|
|
588
588
|
|
|
589
|
+
async def update_item_metadata(
|
|
590
|
+
self,
|
|
591
|
+
item_id: str,
|
|
592
|
+
fields_to_update: dict[str, Any],
|
|
593
|
+
site_id: str | None = None,
|
|
594
|
+
list_id: str | None = None,
|
|
595
|
+
drive_id: str | None = None,
|
|
596
|
+
) -> dict[str, Any]:
|
|
597
|
+
"""Update metadata on a SharePoint list item or OneDrive/SharePoint drive item.
|
|
598
|
+
|
|
599
|
+
For SharePoint list items: Updates custom column values via the fields endpoint.
|
|
600
|
+
For drive items: Updates properties like name and description.
|
|
601
|
+
|
|
602
|
+
Args:
|
|
603
|
+
item_id: The ID of the item to update.
|
|
604
|
+
fields_to_update: Key-value pairs of metadata fields to modify.
|
|
605
|
+
site_id: For SharePoint list items - the site ID.
|
|
606
|
+
list_id: For SharePoint list items - the list ID.
|
|
607
|
+
drive_id: For OneDrive/drive items - the drive ID.
|
|
608
|
+
|
|
609
|
+
Returns
|
|
610
|
+
-------
|
|
611
|
+
The API response containing updated item data.
|
|
612
|
+
|
|
613
|
+
Raises
|
|
614
|
+
------
|
|
615
|
+
MicrosoftGraphError: If validation fails or the API request fails.
|
|
616
|
+
"""
|
|
617
|
+
if not item_id or not item_id.strip():
|
|
618
|
+
raise MicrosoftGraphError("item_id cannot be empty")
|
|
619
|
+
if not fields_to_update:
|
|
620
|
+
raise MicrosoftGraphError("fields_to_update cannot be empty")
|
|
621
|
+
|
|
622
|
+
# Determine the endpoint based on provided parameters
|
|
623
|
+
has_sharepoint_context = site_id is not None and list_id is not None
|
|
624
|
+
has_drive_context = drive_id is not None
|
|
625
|
+
|
|
626
|
+
if has_sharepoint_context and has_drive_context:
|
|
627
|
+
raise MicrosoftGraphError(
|
|
628
|
+
"Cannot specify both SharePoint (site_id + list_id) and OneDrive "
|
|
629
|
+
"(document_library_id) context. Choose one."
|
|
630
|
+
)
|
|
631
|
+
|
|
632
|
+
if not has_sharepoint_context and not has_drive_context:
|
|
633
|
+
raise MicrosoftGraphError(
|
|
634
|
+
"Must specify either SharePoint context (site_id + list_id) or "
|
|
635
|
+
"OneDrive context (document_library_id)."
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
try:
|
|
639
|
+
if has_sharepoint_context:
|
|
640
|
+
# PATCH /sites/{site-id}/lists/{list-id}/items/{item-id}/fields
|
|
641
|
+
url = f"{GRAPH_API_BASE}/sites/{site_id}/lists/{list_id}/items/{item_id}/fields"
|
|
642
|
+
response = await self._client.patch(url, json=fields_to_update)
|
|
643
|
+
else:
|
|
644
|
+
# Drive item: PATCH /drives/{drive-id}/items/{item-id}
|
|
645
|
+
url = f"{GRAPH_API_BASE}/drives/{drive_id}/items/{item_id}"
|
|
646
|
+
response = await self._client.patch(url, json=fields_to_update)
|
|
647
|
+
|
|
648
|
+
response.raise_for_status()
|
|
649
|
+
return response.json()
|
|
650
|
+
except httpx.HTTPStatusError as e:
|
|
651
|
+
raise self._handle_update_metadata_error(e, item_id) from e
|
|
652
|
+
|
|
653
|
+
def _handle_update_metadata_error(
|
|
654
|
+
self,
|
|
655
|
+
error: httpx.HTTPStatusError,
|
|
656
|
+
item_id: str,
|
|
657
|
+
) -> MicrosoftGraphError:
|
|
658
|
+
"""Handle HTTP errors for metadata updates and return appropriate MicrosoftGraphError."""
|
|
659
|
+
status_code = error.response.status_code
|
|
660
|
+
error_msg = f"Failed to update metadata: HTTP {status_code}"
|
|
661
|
+
|
|
662
|
+
if status_code == 400:
|
|
663
|
+
try:
|
|
664
|
+
error_data = error.response.json()
|
|
665
|
+
api_message = error_data.get("error", {}).get("message", "Invalid request")
|
|
666
|
+
error_msg = f"Bad request updating metadata: {api_message}"
|
|
667
|
+
except Exception:
|
|
668
|
+
error_msg = "Bad request: invalid field names or values."
|
|
669
|
+
elif status_code == 401:
|
|
670
|
+
error_msg = "Authentication failed. Access token may be expired or invalid."
|
|
671
|
+
elif status_code == 403:
|
|
672
|
+
error_msg = (
|
|
673
|
+
f"Permission denied: you don't have permission to update item '{item_id}'. "
|
|
674
|
+
"Requires Sites.ReadWrite.All or Files.ReadWrite.All permission."
|
|
675
|
+
)
|
|
676
|
+
elif status_code == 404:
|
|
677
|
+
error_msg = f"Item '{item_id}' not found."
|
|
678
|
+
elif status_code == 409:
|
|
679
|
+
error_msg = f"Conflict: item '{item_id}' may have been modified concurrently."
|
|
680
|
+
elif status_code == 429:
|
|
681
|
+
error_msg = "Rate limit exceeded. Please try again later."
|
|
682
|
+
|
|
683
|
+
return MicrosoftGraphError(error_msg)
|
|
684
|
+
|
|
589
685
|
async def __aenter__(self) -> "MicrosoftGraphClient":
|
|
590
686
|
"""Async context manager entry."""
|
|
591
687
|
return self
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import logging
|
|
18
18
|
from typing import Annotated
|
|
19
|
+
from typing import Any
|
|
19
20
|
from typing import Literal
|
|
20
21
|
|
|
21
22
|
from fastmcp.exceptions import ToolError
|
|
@@ -23,6 +24,7 @@ from fastmcp.tools.tool import ToolResult
|
|
|
23
24
|
|
|
24
25
|
from datarobot_genai.drmcp.core.mcp_instance import dr_mcp_tool
|
|
25
26
|
from datarobot_genai.drmcp.tools.clients.microsoft_graph import MicrosoftGraphClient
|
|
27
|
+
from datarobot_genai.drmcp.tools.clients.microsoft_graph import MicrosoftGraphError
|
|
26
28
|
from datarobot_genai.drmcp.tools.clients.microsoft_graph import get_microsoft_graph_access_token
|
|
27
29
|
from datarobot_genai.drmcp.tools.clients.microsoft_graph import validate_site_url
|
|
28
30
|
|
|
@@ -261,7 +263,8 @@ async def microsoft_graph_share_item(
|
|
|
261
263
|
"create",
|
|
262
264
|
"file",
|
|
263
265
|
"write",
|
|
264
|
-
}
|
|
266
|
+
},
|
|
267
|
+
enabled=False,
|
|
265
268
|
)
|
|
266
269
|
async def microsoft_create_file(
|
|
267
270
|
*,
|
|
@@ -328,3 +331,145 @@ async def microsoft_create_file(
|
|
|
328
331
|
"parentFolderId": created_file.parent_folder_id,
|
|
329
332
|
},
|
|
330
333
|
)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
@dr_mcp_tool(
|
|
337
|
+
tags={
|
|
338
|
+
"microsoft",
|
|
339
|
+
"graph api",
|
|
340
|
+
"sharepoint",
|
|
341
|
+
"onedrive",
|
|
342
|
+
"metadata",
|
|
343
|
+
"update",
|
|
344
|
+
"fields",
|
|
345
|
+
"compliance",
|
|
346
|
+
},
|
|
347
|
+
enabled=False,
|
|
348
|
+
)
|
|
349
|
+
async def microsoft_update_metadata(
|
|
350
|
+
*,
|
|
351
|
+
item_id: Annotated[str, "The ID of the file or list item to update."],
|
|
352
|
+
fields_to_update: Annotated[
|
|
353
|
+
dict[str, Any],
|
|
354
|
+
"Key-value pairs of metadata fields to modify. "
|
|
355
|
+
"For SharePoint list items: any custom column values. "
|
|
356
|
+
"For drive items: 'name' and/or 'description'.",
|
|
357
|
+
],
|
|
358
|
+
site_id: Annotated[
|
|
359
|
+
str | None,
|
|
360
|
+
"The site ID (required for SharePoint list items, along with list_id).",
|
|
361
|
+
] = None,
|
|
362
|
+
list_id: Annotated[
|
|
363
|
+
str | None,
|
|
364
|
+
"The list ID (required for SharePoint list items, along with site_id).",
|
|
365
|
+
] = None,
|
|
366
|
+
document_library_id: Annotated[
|
|
367
|
+
str | None,
|
|
368
|
+
"The drive ID (required for OneDrive/drive item updates). "
|
|
369
|
+
"Cannot be used together with site_id and list_id.",
|
|
370
|
+
] = None,
|
|
371
|
+
) -> ToolResult | ToolError:
|
|
372
|
+
"""
|
|
373
|
+
Update metadata on a SharePoint list item or OneDrive/SharePoint drive item.
|
|
374
|
+
|
|
375
|
+
**SharePoint List Items:** Provide site_id and list_id to update custom
|
|
376
|
+
column values on a list item. All custom columns can be updated.
|
|
377
|
+
|
|
378
|
+
**OneDrive/Drive Items:** Provide document_library_id to update drive item
|
|
379
|
+
properties. Only 'name' and 'description' fields can be updated.
|
|
380
|
+
|
|
381
|
+
**Context Requirements:**
|
|
382
|
+
- For SharePoint list items: Both site_id AND list_id are required
|
|
383
|
+
- For OneDrive/drive items: document_library_id is required
|
|
384
|
+
- Cannot specify both contexts simultaneously
|
|
385
|
+
|
|
386
|
+
**Examples:**
|
|
387
|
+
- SharePoint list item: Update a 'Status' column to 'Approved'
|
|
388
|
+
- Drive item: Rename a file or update its description
|
|
389
|
+
|
|
390
|
+
**Permissions:**
|
|
391
|
+
- Requires Sites.ReadWrite.All or Files.ReadWrite.All permission
|
|
392
|
+
"""
|
|
393
|
+
if not item_id or not item_id.strip():
|
|
394
|
+
raise ToolError("Error: item_id is required.")
|
|
395
|
+
if not fields_to_update:
|
|
396
|
+
raise ToolError("Error: fields_to_update is required and cannot be empty.")
|
|
397
|
+
|
|
398
|
+
# Validate context parameters
|
|
399
|
+
has_sharepoint_context = site_id is not None and list_id is not None
|
|
400
|
+
has_partial_sharepoint_context = (site_id is not None) != (list_id is not None)
|
|
401
|
+
has_drive_context = document_library_id is not None
|
|
402
|
+
|
|
403
|
+
if has_partial_sharepoint_context:
|
|
404
|
+
raise ToolError(
|
|
405
|
+
"Error: For SharePoint list items, both site_id and list_id must be provided."
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
if has_sharepoint_context and has_drive_context:
|
|
409
|
+
raise ToolError(
|
|
410
|
+
"Error: Cannot specify both SharePoint (site_id + list_id) and OneDrive "
|
|
411
|
+
"(document_library_id) context. Choose one."
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
if not has_sharepoint_context and not has_drive_context:
|
|
415
|
+
raise ToolError(
|
|
416
|
+
"Error: Must specify either SharePoint context (site_id + list_id) or "
|
|
417
|
+
"OneDrive context (document_library_id)."
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
access_token = await get_microsoft_graph_access_token()
|
|
421
|
+
if isinstance(access_token, ToolError):
|
|
422
|
+
raise access_token
|
|
423
|
+
|
|
424
|
+
try:
|
|
425
|
+
async with MicrosoftGraphClient(access_token=access_token) as client:
|
|
426
|
+
result = await client.update_item_metadata(
|
|
427
|
+
item_id=item_id.strip(),
|
|
428
|
+
fields_to_update=fields_to_update,
|
|
429
|
+
site_id=site_id,
|
|
430
|
+
list_id=list_id,
|
|
431
|
+
drive_id=document_library_id,
|
|
432
|
+
)
|
|
433
|
+
except MicrosoftGraphError as e:
|
|
434
|
+
logger.error(f"Microsoft Graph error updating metadata: {e}")
|
|
435
|
+
raise ToolError(str(e))
|
|
436
|
+
except Exception as e:
|
|
437
|
+
logger.error(f"Unexpected error updating metadata: {e}", exc_info=True)
|
|
438
|
+
raise ToolError(f"An unexpected error occurred while updating metadata: {str(e)}")
|
|
439
|
+
|
|
440
|
+
context_type = "sharepoint_list_item" if has_sharepoint_context else "drive_item"
|
|
441
|
+
|
|
442
|
+
# Build structured content similar to microsoft_create_file pattern
|
|
443
|
+
structured: dict[str, Any] = {
|
|
444
|
+
"item_id": item_id,
|
|
445
|
+
"context_type": context_type,
|
|
446
|
+
"fields_updated": list(fields_to_update.keys()),
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
# Add context-specific IDs for traceability
|
|
450
|
+
if has_sharepoint_context:
|
|
451
|
+
structured["site_id"] = site_id
|
|
452
|
+
structured["list_id"] = list_id
|
|
453
|
+
else:
|
|
454
|
+
structured["document_library_id"] = document_library_id
|
|
455
|
+
|
|
456
|
+
# Include relevant response data
|
|
457
|
+
if isinstance(result, dict):
|
|
458
|
+
# For drive items, include key properties if present
|
|
459
|
+
if has_drive_context:
|
|
460
|
+
if "id" in result:
|
|
461
|
+
structured["id"] = result["id"]
|
|
462
|
+
if "name" in result:
|
|
463
|
+
structured["name"] = result["name"]
|
|
464
|
+
if "webUrl" in result:
|
|
465
|
+
structured["webUrl"] = result["webUrl"]
|
|
466
|
+
if "description" in result:
|
|
467
|
+
structured["description"] = result.get("description")
|
|
468
|
+
# For list items, the response is the fields object itself
|
|
469
|
+
else:
|
|
470
|
+
structured["updated_fields"] = result
|
|
471
|
+
|
|
472
|
+
return ToolResult(
|
|
473
|
+
content=f"Metadata updated successfully for item '{item_id}'.",
|
|
474
|
+
structured_content=structured,
|
|
475
|
+
)
|
|
@@ -11,9 +11,12 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
14
16
|
import abc
|
|
15
17
|
import logging
|
|
16
18
|
from collections.abc import AsyncGenerator
|
|
19
|
+
from typing import TYPE_CHECKING
|
|
17
20
|
from typing import Any
|
|
18
21
|
from typing import cast
|
|
19
22
|
|
|
@@ -34,8 +37,6 @@ from langgraph.graph import MessagesState
|
|
|
34
37
|
from langgraph.graph import StateGraph
|
|
35
38
|
from langgraph.types import Command
|
|
36
39
|
from openai.types.chat import CompletionCreateParams
|
|
37
|
-
from ragas import MultiTurnSample
|
|
38
|
-
from ragas.integrations.langgraph import convert_to_ragas_messages
|
|
39
40
|
|
|
40
41
|
from datarobot_genai.core.agents.base import BaseAgent
|
|
41
42
|
from datarobot_genai.core.agents.base import InvokeReturn
|
|
@@ -44,6 +45,9 @@ from datarobot_genai.core.agents.base import extract_user_prompt_content
|
|
|
44
45
|
from datarobot_genai.core.agents.base import is_streaming
|
|
45
46
|
from datarobot_genai.langgraph.mcp import mcp_tools_context
|
|
46
47
|
|
|
48
|
+
if TYPE_CHECKING:
|
|
49
|
+
from ragas import MultiTurnSample
|
|
50
|
+
|
|
47
51
|
logger = logging.getLogger(__name__)
|
|
48
52
|
|
|
49
53
|
|
|
@@ -337,5 +341,9 @@ class LangGraphAgent(BaseAgent[BaseTool], abc.ABC):
|
|
|
337
341
|
if v is not None:
|
|
338
342
|
messages.extend(v.get("messages", []))
|
|
339
343
|
messages = [m for m in messages if not isinstance(m, ToolMessage)]
|
|
344
|
+
# Lazy import to reduce memory overhead when ragas is not used
|
|
345
|
+
from ragas import MultiTurnSample
|
|
346
|
+
from ragas.integrations.langgraph import convert_to_ragas_messages
|
|
347
|
+
|
|
340
348
|
ragas_trace = convert_to_ragas_messages(messages)
|
|
341
349
|
return MultiTurnSample(user_input=ragas_trace)
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
from __future__ import annotations
|
|
14
15
|
|
|
16
|
+
from typing import TYPE_CHECKING
|
|
15
17
|
from typing import cast
|
|
16
18
|
|
|
17
19
|
from llama_index.core.base.llms.types import LLMMetadata
|
|
18
20
|
from llama_index.core.workflow import Event
|
|
19
21
|
from llama_index.llms.litellm import LiteLLM
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
from ragas
|
|
23
|
-
from ragas.messages import HumanMessage
|
|
24
|
-
from ragas.messages import ToolMessage
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from ragas import MultiTurnSample
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
class DataRobotLiteLLM(LiteLLM):
|
|
@@ -44,6 +44,13 @@ def create_pipeline_interactions_from_events(
|
|
|
44
44
|
) -> MultiTurnSample | None:
|
|
45
45
|
if not events:
|
|
46
46
|
return None
|
|
47
|
+
# Lazy import to reduce memory overhead when ragas is not used
|
|
48
|
+
from ragas import MultiTurnSample
|
|
49
|
+
from ragas.integrations.llama_index import convert_to_ragas_messages
|
|
50
|
+
from ragas.messages import AIMessage
|
|
51
|
+
from ragas.messages import HumanMessage
|
|
52
|
+
from ragas.messages import ToolMessage
|
|
53
|
+
|
|
47
54
|
# convert_to_ragas_messages expects a list[Event]
|
|
48
55
|
ragas_trace = convert_to_ragas_messages(list(events))
|
|
49
56
|
ragas_messages = cast(list[HumanMessage | AIMessage | ToolMessage], ragas_trace)
|
|
@@ -25,11 +25,11 @@ from __future__ import annotations
|
|
|
25
25
|
import abc
|
|
26
26
|
import inspect
|
|
27
27
|
from collections.abc import AsyncGenerator
|
|
28
|
+
from typing import TYPE_CHECKING
|
|
28
29
|
from typing import Any
|
|
29
30
|
|
|
30
31
|
from llama_index.core.tools import BaseTool
|
|
31
32
|
from openai.types.chat import CompletionCreateParams
|
|
32
|
-
from ragas import MultiTurnSample
|
|
33
33
|
|
|
34
34
|
from datarobot_genai.core.agents.base import BaseAgent
|
|
35
35
|
from datarobot_genai.core.agents.base import InvokeReturn
|
|
@@ -41,6 +41,9 @@ from datarobot_genai.core.agents.base import is_streaming
|
|
|
41
41
|
from .agent import create_pipeline_interactions_from_events
|
|
42
42
|
from .mcp import load_mcp_tools
|
|
43
43
|
|
|
44
|
+
if TYPE_CHECKING:
|
|
45
|
+
from ragas import MultiTurnSample
|
|
46
|
+
|
|
44
47
|
|
|
45
48
|
class LlamaIndexAgent(BaseAgent[BaseTool], abc.ABC):
|
|
46
49
|
"""Abstract base agent for LlamaIndex workflows."""
|
|
@@ -11,9 +11,12 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
14
16
|
import asyncio
|
|
15
17
|
import logging
|
|
16
18
|
from collections.abc import AsyncGenerator
|
|
19
|
+
from typing import TYPE_CHECKING
|
|
17
20
|
from typing import Any
|
|
18
21
|
|
|
19
22
|
from nat.builder.context import Context
|
|
@@ -23,10 +26,6 @@ from nat.data_models.intermediate_step import IntermediateStep
|
|
|
23
26
|
from nat.data_models.intermediate_step import IntermediateStepType
|
|
24
27
|
from nat.utils.type_utils import StrPath
|
|
25
28
|
from openai.types.chat import CompletionCreateParams
|
|
26
|
-
from ragas import MultiTurnSample
|
|
27
|
-
from ragas.messages import AIMessage
|
|
28
|
-
from ragas.messages import HumanMessage
|
|
29
|
-
from ragas.messages import ToolMessage
|
|
30
29
|
|
|
31
30
|
from datarobot_genai.core.agents.base import BaseAgent
|
|
32
31
|
from datarobot_genai.core.agents.base import InvokeReturn
|
|
@@ -36,13 +35,22 @@ from datarobot_genai.core.agents.base import is_streaming
|
|
|
36
35
|
from datarobot_genai.core.mcp.common import MCPConfig
|
|
37
36
|
from datarobot_genai.nat.helpers import load_workflow
|
|
38
37
|
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
from ragas import MultiTurnSample
|
|
40
|
+
from ragas.messages import AIMessage
|
|
41
|
+
from ragas.messages import HumanMessage
|
|
42
|
+
|
|
39
43
|
logger = logging.getLogger(__name__)
|
|
40
44
|
|
|
41
45
|
|
|
42
46
|
def convert_to_ragas_messages(
|
|
43
47
|
steps: list[IntermediateStep],
|
|
44
|
-
) -> list[HumanMessage | AIMessage
|
|
45
|
-
|
|
48
|
+
) -> list[HumanMessage | AIMessage]:
|
|
49
|
+
# Lazy import to reduce memory overhead when ragas is not used
|
|
50
|
+
from ragas.messages import AIMessage
|
|
51
|
+
from ragas.messages import HumanMessage
|
|
52
|
+
|
|
53
|
+
def _to_ragas(step: IntermediateStep) -> HumanMessage | AIMessage:
|
|
46
54
|
if step.event_type == IntermediateStepType.LLM_START:
|
|
47
55
|
return HumanMessage(content=_parse(step.data.input))
|
|
48
56
|
elif step.event_type == IntermediateStepType.LLM_END:
|
|
@@ -78,6 +86,9 @@ def create_pipeline_interactions_from_steps(
|
|
|
78
86
|
) -> MultiTurnSample | None:
|
|
79
87
|
if not steps:
|
|
80
88
|
return None
|
|
89
|
+
# Lazy import to reduce memory overhead when ragas is not used
|
|
90
|
+
from ragas import MultiTurnSample
|
|
91
|
+
|
|
81
92
|
ragas_trace = convert_to_ragas_messages(steps)
|
|
82
93
|
return MultiTurnSample(user_input=ragas_trace)
|
|
83
94
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/agents/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/cli/agent_environment.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/cli/agent_kernel.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/telemetry_agent.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/core/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/config_utils.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/constants.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/credentials.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/dr_mcp_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/mcp_instance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/routes_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/telemetry.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/tool_config.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/core/tool_filter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/test_utils/utils.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/gdrive.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/jira.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/clients/s3.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/gdrive/__init__.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/gdrive/tools.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/jira/__init__.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/jira/tools.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/drmcp/tools/predictive/data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/llama_index/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_auth_provider.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_llm_clients.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_llm_providers.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.41 → datarobot_genai-0.2.42}/src/datarobot_genai/nat/datarobot_mcp_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|