datarobot-genai 0.2.0__tar.gz → 0.2.1__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.0 → datarobot_genai-0.2.1}/PKG-INFO +2 -2
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/pyproject.toml +2 -2
- datarobot_genai-0.2.1/src/datarobot_genai/drmcp/core/dynamic_prompts/dr_lib.py +70 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_prompts/register.py +4 -5
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/mcp_instance.py +5 -1
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/routes.py +4 -1
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/mcp_utils_ete.py +29 -0
- datarobot_genai-0.2.0/src/datarobot_genai/drmcp/core/dynamic_prompts/dr_lib.py +0 -128
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/.gitignore +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/AUTHORS +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/LICENSE +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/README.md +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/agents/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/agents/base.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/chat/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/chat/auth.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/chat/client.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/chat/responses.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/cli/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/cli/agent_environment.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/cli/agent_kernel.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/custom_model.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/mcp/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/mcp/common.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/telemetry_agent.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/utils/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/utils/auth.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/utils/urls.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/crewai/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/crewai/agent.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/crewai/base.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/crewai/events.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/crewai/mcp.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/auth.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/clients.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/config.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/config_utils.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/constants.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/credentials.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dr_mcp_server.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dr_mcp_server_logo.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_prompts/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_prompts/controllers.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_prompts/utils.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/base.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/default.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/drum.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/config.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/controllers.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/metadata.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/register.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/schemas/drum_agentic_fallback_schema.json +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/schemas/drum_prediction_fallback_schema.json +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/register.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dynamic_tools/schema.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/exceptions.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/logging.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/mcp_server_tools.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/memory_management/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/memory_management/manager.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/memory_management/memory_tools.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/routes_utils.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/server_life_cycle.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/telemetry.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/tool_filter.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/utils.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/server.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/integration_mcp_server.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/mcp_utils_integration.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/openai_llm_mcp_client.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/tool_base_ete.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/utils.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/data.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/deployment.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/deployment_info.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/model.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/predict.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/predict_realtime.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/project.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/training.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/langgraph/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/langgraph/agent.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/langgraph/mcp.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/llama_index/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/llama_index/agent.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/llama_index/base.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/llama_index/mcp.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/nat/__init__.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/nat/agent.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/nat/datarobot_llm_clients.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/nat/datarobot_llm_providers.py +0 -0
- {datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datarobot-genai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Generic helpers for GenAI
|
|
5
5
|
Project-URL: Homepage, https://github.com/datarobot-oss/datarobot-genai
|
|
6
6
|
Author: DataRobot, Inc.
|
|
@@ -11,7 +11,7 @@ Requires-Python: <3.13,>=3.10
|
|
|
11
11
|
Requires-Dist: ag-ui-protocol<0.2.0,>=0.1.9
|
|
12
12
|
Requires-Dist: datarobot-drum<2.0.0,>=1.17.5
|
|
13
13
|
Requires-Dist: datarobot-predict<2.0.0,>=1.13.2
|
|
14
|
-
Requires-Dist: datarobot<4.0.0,>=3.
|
|
14
|
+
Requires-Dist: datarobot<4.0.0,>=3.10.0
|
|
15
15
|
Requires-Dist: openai<2.0.0,>=1.76.2
|
|
16
16
|
Requires-Dist: opentelemetry-instrumentation-aiohttp-client<1.0.0,>=0.43b0
|
|
17
17
|
Requires-Dist: opentelemetry-instrumentation-httpx<1.0.0,>=0.43b0
|
|
@@ -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.1"
|
|
8
8
|
description = "Generic helpers for GenAI"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10, <3.13"
|
|
@@ -12,7 +12,7 @@ license = { text = "Apache-2.0" }
|
|
|
12
12
|
authors = [{ name = "DataRobot, Inc." }]
|
|
13
13
|
dependencies = [
|
|
14
14
|
"requests>=2.32.4,<3.0.0",
|
|
15
|
-
"datarobot>=3.
|
|
15
|
+
"datarobot>=3.10.0,<4.0.0",
|
|
16
16
|
"datarobot-predict>=1.13.2,<2.0.0",
|
|
17
17
|
"openai>=1.76.2,<2.0.0",
|
|
18
18
|
"pandas>=2.2.3,<3.0.0",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Copyright 2025 DataRobot, Inc.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
from collections import defaultdict
|
|
15
|
+
|
|
16
|
+
import datarobot as dr
|
|
17
|
+
|
|
18
|
+
from datarobot_genai.drmcp.core.clients import get_api_client
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_datarobot_prompt_templates() -> list[dr.genai.PromptTemplate]:
|
|
22
|
+
try:
|
|
23
|
+
return dr.genai.PromptTemplate.list()
|
|
24
|
+
except Exception:
|
|
25
|
+
return []
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get_datarobot_prompt_template_versions(
|
|
29
|
+
prompt_template_ids: list[str],
|
|
30
|
+
) -> dict[str, list[dr.genai.PromptTemplateVersion]]:
|
|
31
|
+
# Still missing in SDK
|
|
32
|
+
prompt_template_versions_data = dr.utils.pagination.unpaginate(
|
|
33
|
+
initial_url="genai/promptTemplates/versions/",
|
|
34
|
+
initial_params={
|
|
35
|
+
"promptTemplateIds": prompt_template_ids,
|
|
36
|
+
},
|
|
37
|
+
client=get_api_client(),
|
|
38
|
+
)
|
|
39
|
+
prompt_template_versions = defaultdict(list)
|
|
40
|
+
for prompt_template_version in prompt_template_versions_data:
|
|
41
|
+
prompt_template_versions[prompt_template_version["promptTemplateId"]].append(
|
|
42
|
+
dr.genai.PromptTemplateVersion(
|
|
43
|
+
id=prompt_template_version["id"],
|
|
44
|
+
prompt_template_id=prompt_template_version["promptTemplateId"],
|
|
45
|
+
prompt_text=prompt_template_version["promptText"],
|
|
46
|
+
commit_comment=prompt_template_version["commitComment"],
|
|
47
|
+
version=prompt_template_version["version"],
|
|
48
|
+
variables=prompt_template_version["variables"],
|
|
49
|
+
creation_date=prompt_template_version["creationDate"],
|
|
50
|
+
creation_user_id=prompt_template_version["creationUserId"],
|
|
51
|
+
user_name=prompt_template_version["userName"],
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
return prompt_template_versions
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_datarobot_prompt_template(prompt_template_id: str) -> dr.genai.PromptTemplate | None:
|
|
58
|
+
try:
|
|
59
|
+
return dr.genai.PromptTemplate.get(prompt_template_id)
|
|
60
|
+
except Exception:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def get_datarobot_prompt_template_version(
|
|
65
|
+
prompt_template_id: str, prompt_template_version_id: str
|
|
66
|
+
) -> dr.genai.PromptTemplateVersion | None:
|
|
67
|
+
try:
|
|
68
|
+
return dr.genai.PromptTemplateVersion.get(prompt_template_id, prompt_template_version_id)
|
|
69
|
+
except Exception:
|
|
70
|
+
return None
|
|
@@ -18,15 +18,13 @@ from collections.abc import Callable
|
|
|
18
18
|
from inspect import Parameter
|
|
19
19
|
from inspect import Signature
|
|
20
20
|
|
|
21
|
+
import datarobot as dr
|
|
21
22
|
from fastmcp.prompts.prompt import Prompt
|
|
22
23
|
from pydantic import Field
|
|
23
24
|
|
|
24
25
|
from datarobot_genai.drmcp.core.exceptions import DynamicPromptRegistrationError
|
|
25
26
|
from datarobot_genai.drmcp.core.mcp_instance import register_prompt
|
|
26
27
|
|
|
27
|
-
from .dr_lib import DrPrompt
|
|
28
|
-
from .dr_lib import DrPromptVersion
|
|
29
|
-
from .dr_lib import DrVariable
|
|
30
28
|
from .dr_lib import get_datarobot_prompt_template_versions
|
|
31
29
|
from .dr_lib import get_datarobot_prompt_templates
|
|
32
30
|
|
|
@@ -57,7 +55,8 @@ async def register_prompts_from_datarobot_prompt_management() -> None:
|
|
|
57
55
|
|
|
58
56
|
|
|
59
57
|
async def register_prompt_from_datarobot_prompt_management(
|
|
60
|
-
prompt_template:
|
|
58
|
+
prompt_template: dr.genai.PromptTemplate,
|
|
59
|
+
prompt_template_version: dr.genai.PromptTemplateVersion | None = None,
|
|
61
60
|
) -> Prompt:
|
|
62
61
|
"""Register a single prompt.
|
|
63
62
|
|
|
@@ -173,7 +172,7 @@ def to_valid_mcp_prompt_name(s: str) -> str:
|
|
|
173
172
|
|
|
174
173
|
|
|
175
174
|
def make_prompt_function(
|
|
176
|
-
name: str, description: str, prompt_text: str, variables: list[
|
|
175
|
+
name: str, description: str, prompt_text: str, variables: list[dr.genai.Variable]
|
|
177
176
|
) -> Callable:
|
|
178
177
|
params = []
|
|
179
178
|
for v in variables:
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/mcp_instance.py
RENAMED
|
@@ -286,6 +286,9 @@ class TaggedFastMCP(FastMCP):
|
|
|
286
286
|
f"already mapped to {existing_prompt_template_version_id}. "
|
|
287
287
|
f"Updating to version id = {prompt_template_version_id} and name = {prompt_name}"
|
|
288
288
|
)
|
|
289
|
+
await self.remove_prompt_mapping(
|
|
290
|
+
prompt_template_id, existing_prompt_template_version_id
|
|
291
|
+
)
|
|
289
292
|
|
|
290
293
|
self._prompts_map[prompt_template_id] = (prompt_template_version_id, prompt_name)
|
|
291
294
|
|
|
@@ -526,13 +529,14 @@ async def register_prompt(
|
|
|
526
529
|
)
|
|
527
530
|
|
|
528
531
|
# Register the prompt
|
|
529
|
-
registered_prompt = mcp.add_prompt(prompt)
|
|
530
532
|
if prompt_template:
|
|
531
533
|
prompt_template_id, prompt_template_version_id = prompt_template
|
|
532
534
|
await mcp.set_prompt_mapping(
|
|
533
535
|
prompt_template_id, prompt_template_version_id, prompt_name_no_duplicate
|
|
534
536
|
)
|
|
535
537
|
|
|
538
|
+
registered_prompt = mcp.add_prompt(prompt)
|
|
539
|
+
|
|
536
540
|
# Verify prompt is registered
|
|
537
541
|
prompts = await mcp.get_prompts()
|
|
538
542
|
if not any(prompt.name == prompt_name_no_duplicate for prompt in prompts.values()):
|
|
@@ -428,7 +428,10 @@ def register_routes(mcp: TaggedFastMCP) -> None:
|
|
|
428
428
|
"""Refresh prompt templates."""
|
|
429
429
|
try:
|
|
430
430
|
await refresh_registered_prompt_template()
|
|
431
|
-
return JSONResponse(
|
|
431
|
+
return JSONResponse(
|
|
432
|
+
status_code=HTTPStatus.OK,
|
|
433
|
+
content={"message": "Prompts refreshed successfully"},
|
|
434
|
+
)
|
|
432
435
|
except Exception as e:
|
|
433
436
|
return JSONResponse(
|
|
434
437
|
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
|
|
@@ -16,6 +16,8 @@ import os
|
|
|
16
16
|
from collections.abc import AsyncGenerator
|
|
17
17
|
from contextlib import asynccontextmanager
|
|
18
18
|
|
|
19
|
+
import aiohttp
|
|
20
|
+
from aiohttp import ClientSession as HttpClientSession
|
|
19
21
|
from mcp import ClientSession
|
|
20
22
|
from mcp.client.streamable_http import streamablehttp_client
|
|
21
23
|
|
|
@@ -29,6 +31,11 @@ def get_dr_mcp_server_url() -> str | None:
|
|
|
29
31
|
return os.environ.get("DR_MCP_SERVER_URL")
|
|
30
32
|
|
|
31
33
|
|
|
34
|
+
def get_dr_mcp_server_http_url() -> str | None:
|
|
35
|
+
"""Get DataRobot MCP server http URL."""
|
|
36
|
+
return os.environ.get("DR_MCP_SERVER_HTTP_URL")
|
|
37
|
+
|
|
38
|
+
|
|
32
39
|
def get_openai_llm_client_config() -> dict[str, str]:
|
|
33
40
|
"""Get OpenAI LLM client configuration."""
|
|
34
41
|
openai_api_key = os.environ.get("OPENAI_API_KEY")
|
|
@@ -94,3 +101,25 @@ async def ete_test_mcp_session(
|
|
|
94
101
|
yield session
|
|
95
102
|
except asyncio.TimeoutError:
|
|
96
103
|
raise TimeoutError(f"Check if the MCP server is running at {get_dr_mcp_server_url()}")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@asynccontextmanager
|
|
107
|
+
async def ete_test_http_session(
|
|
108
|
+
additional_headers: dict[str, str] | None = None,
|
|
109
|
+
) -> AsyncGenerator[HttpClientSession, None]:
|
|
110
|
+
"""Create an HTTP session for each test that can connect to MCP custom http routes.
|
|
111
|
+
|
|
112
|
+
Parameters
|
|
113
|
+
----------
|
|
114
|
+
additional_headers : dict[str, str], optional
|
|
115
|
+
Additional headers to include in the HTTP session (e.g., auth headers for testing).
|
|
116
|
+
"""
|
|
117
|
+
headers = get_headers()
|
|
118
|
+
if additional_headers:
|
|
119
|
+
headers.update(additional_headers)
|
|
120
|
+
|
|
121
|
+
async with ete_test_mcp_session(additional_headers=additional_headers):
|
|
122
|
+
async with aiohttp.ClientSession(
|
|
123
|
+
base_url=get_dr_mcp_server_http_url(), headers=headers
|
|
124
|
+
) as client:
|
|
125
|
+
yield client
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# Copyright 2025 DataRobot, Inc.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
from collections import defaultdict
|
|
15
|
-
from dataclasses import dataclass
|
|
16
|
-
|
|
17
|
-
import datarobot as dr
|
|
18
|
-
|
|
19
|
-
from datarobot_genai.drmcp.core.clients import get_api_client
|
|
20
|
-
|
|
21
|
-
# Needed SDK version (3.10.0) is not published yet. We'll reimplement simplified version of it.
|
|
22
|
-
# get_datarobot_prompt_templates = dr.genai.PromptTemplate.list()
|
|
23
|
-
# DrPrompt = dr.genai.PromptTemplate
|
|
24
|
-
# DrPromptVersion = dr.genai.PromptTemplateVersion
|
|
25
|
-
# DrVariable = dr.genai.Variable
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@dataclass
|
|
29
|
-
class DrVariable:
|
|
30
|
-
name: str
|
|
31
|
-
description: str
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
@dataclass
|
|
35
|
-
class DrPromptVersion:
|
|
36
|
-
id: str
|
|
37
|
-
prompt_template_id: str
|
|
38
|
-
version: int
|
|
39
|
-
prompt_text: str
|
|
40
|
-
variables: list[DrVariable]
|
|
41
|
-
|
|
42
|
-
@classmethod
|
|
43
|
-
def from_dict(cls, d: dict) -> "DrPromptVersion":
|
|
44
|
-
variables = [
|
|
45
|
-
DrVariable(name=v["name"], description=v["description"]) for v in d["variables"]
|
|
46
|
-
]
|
|
47
|
-
return cls(
|
|
48
|
-
id=d["id"],
|
|
49
|
-
prompt_template_id=d["promptTemplateId"],
|
|
50
|
-
version=d["version"],
|
|
51
|
-
prompt_text=d["promptText"],
|
|
52
|
-
variables=variables,
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@dataclass
|
|
57
|
-
class DrPrompt:
|
|
58
|
-
id: str
|
|
59
|
-
name: str
|
|
60
|
-
description: str
|
|
61
|
-
|
|
62
|
-
def get_latest_version(self) -> DrPromptVersion | None:
|
|
63
|
-
all_prompt_template_versions = get_datarobot_prompt_template_versions([self.id])
|
|
64
|
-
prompt_template_versions = all_prompt_template_versions.get(self.id)
|
|
65
|
-
|
|
66
|
-
if not prompt_template_versions:
|
|
67
|
-
return None
|
|
68
|
-
latest_version = max(prompt_template_versions, key=lambda v: v.version)
|
|
69
|
-
return latest_version
|
|
70
|
-
|
|
71
|
-
@classmethod
|
|
72
|
-
def from_dict(cls, d: dict) -> "DrPrompt":
|
|
73
|
-
return cls(id=d["id"], name=d["name"], description=d["description"])
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def get_datarobot_prompt_templates() -> list[DrPrompt]:
|
|
77
|
-
prompt_templates_data = dr.utils.pagination.unpaginate(
|
|
78
|
-
initial_url="genai/promptTemplates/", initial_params={}, client=get_api_client()
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
return [DrPrompt.from_dict(prompt_template) for prompt_template in prompt_templates_data]
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def get_datarobot_prompt_template_versions(
|
|
85
|
-
prompt_template_ids: list[str],
|
|
86
|
-
) -> dict[str, list[DrPromptVersion]]:
|
|
87
|
-
prompt_template_versions_data = dr.utils.pagination.unpaginate(
|
|
88
|
-
initial_url="genai/promptTemplates/versions/",
|
|
89
|
-
initial_params={
|
|
90
|
-
"promptTemplateIds": prompt_template_ids,
|
|
91
|
-
},
|
|
92
|
-
client=get_api_client(),
|
|
93
|
-
)
|
|
94
|
-
prompt_template_versions = defaultdict(list)
|
|
95
|
-
for prompt_template_version in prompt_template_versions_data:
|
|
96
|
-
prompt_template_versions[prompt_template_version["promptTemplateId"]].append(
|
|
97
|
-
DrPromptVersion.from_dict(prompt_template_version)
|
|
98
|
-
)
|
|
99
|
-
return prompt_template_versions
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def get_datarobot_prompt_template(prompt_template_id: str) -> DrPrompt | None:
|
|
103
|
-
api_client = get_api_client()
|
|
104
|
-
try:
|
|
105
|
-
prompt_template_response = api_client.get(
|
|
106
|
-
f"genai/promptTemplates/{prompt_template_id}/", join_endpoint=True
|
|
107
|
-
)
|
|
108
|
-
prompt_template_json = prompt_template_response.json()
|
|
109
|
-
except Exception:
|
|
110
|
-
return None
|
|
111
|
-
|
|
112
|
-
return DrPrompt.from_dict(prompt_template_json)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def get_datarobot_prompt_template_version(
|
|
116
|
-
prompt_template_id: str, prompt_template_version_id: str
|
|
117
|
-
) -> DrPromptVersion | None:
|
|
118
|
-
api_client = get_api_client()
|
|
119
|
-
try:
|
|
120
|
-
prompt_template_version_response = api_client.get(
|
|
121
|
-
f"genai/promptTemplates/{prompt_template_id}/versions/{prompt_template_version_id}/",
|
|
122
|
-
join_endpoint=True,
|
|
123
|
-
)
|
|
124
|
-
prompt_template_version_json = prompt_template_version_response.json()
|
|
125
|
-
except Exception:
|
|
126
|
-
return None
|
|
127
|
-
|
|
128
|
-
return DrPromptVersion.from_dict(prompt_template_version_json)
|
|
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.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/cli/agent_environment.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/core/cli/agent_kernel.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
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/config_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/credentials.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dr_mcp_server.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/dr_mcp_server_logo.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
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/mcp_server_tools.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/routes_utils.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/server_life_cycle.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/core/tool_filter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/test_utils/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/drmcp/tools/predictive/model.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
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/nat/datarobot_llm_clients.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.0 → datarobot_genai-0.2.1}/src/datarobot_genai/nat/datarobot_llm_providers.py
RENAMED
|
File without changes
|
|
File without changes
|