datarobot-genai 0.2.8__tar.gz → 0.2.9__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.8 → datarobot_genai-0.2.9}/PKG-INFO +1 -1
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/pyproject.toml +1 -2
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/utils/auth.py +31 -188
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/.gitignore +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/AUTHORS +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/LICENSE +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/README.md +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/agents/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/agents/base.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/chat/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/chat/auth.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/chat/client.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/chat/responses.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/cli/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/cli/agent_environment.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/cli/agent_kernel.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/custom_model.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/mcp/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/mcp/common.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/telemetry_agent.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/utils/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/utils/urls.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/crewai/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/crewai/agent.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/crewai/base.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/crewai/events.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/crewai/mcp.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/auth.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/clients.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/config.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/config_utils.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/constants.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/credentials.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dr_mcp_server.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dr_mcp_server_logo.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_prompts/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_prompts/controllers.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_prompts/dr_lib.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_prompts/register.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_prompts/utils.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/base.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/default.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/adapters/drum.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/config.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/controllers.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/metadata.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/register.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/schemas/drum_agentic_fallback_schema.json +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/deployment/schemas/drum_prediction_fallback_schema.json +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/register.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dynamic_tools/schema.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/exceptions.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/logging.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/mcp_instance.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/mcp_server_tools.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/memory_management/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/memory_management/manager.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/memory_management/memory_tools.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/routes.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/routes_utils.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/server_life_cycle.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/telemetry.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/tool_config.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/tool_filter.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/utils.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/server.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/integration_mcp_server.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/mcp_utils_ete.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/mcp_utils_integration.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/openai_llm_mcp_client.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/tool_base_ete.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/utils.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/atlassian.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/confluence.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/jira.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/s3.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/confluence/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/confluence/tools.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/jira/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/jira/tools.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/data.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/deployment.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/deployment_info.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/model.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/predict.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/predict_realtime.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/project.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/training.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/langgraph/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/langgraph/agent.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/langgraph/mcp.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/llama_index/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/llama_index/agent.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/llama_index/base.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/llama_index/mcp.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/__init__.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/agent.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_auth_provider.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_llm_clients.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_llm_providers.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_mcp_client.py +0 -0
- {datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/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.9"
|
|
8
8
|
description = "Generic helpers for GenAI"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10, <3.13"
|
|
@@ -128,7 +128,6 @@ dev = [
|
|
|
128
128
|
"pytest-asyncio>=0.23.5",
|
|
129
129
|
"responses>=0.25.8",
|
|
130
130
|
"ipdb>=0.13.13",
|
|
131
|
-
"aioresponses>=0.7.8",
|
|
132
131
|
]
|
|
133
132
|
|
|
134
133
|
|
|
@@ -12,23 +12,17 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
import logging
|
|
15
|
-
import os
|
|
16
15
|
import warnings
|
|
17
16
|
from typing import Any
|
|
18
|
-
from typing import Protocol
|
|
19
17
|
|
|
20
|
-
import aiohttp
|
|
21
18
|
import jwt
|
|
22
|
-
from datarobot.auth.datarobot.oauth import AsyncOAuth as
|
|
23
|
-
from datarobot.auth.exceptions import OAuthProviderNotFound
|
|
24
|
-
from datarobot.auth.exceptions import OAuthValidationErr
|
|
19
|
+
from datarobot.auth.datarobot.oauth import AsyncOAuth as DatarobotAsyncOAuthClient
|
|
25
20
|
from datarobot.auth.identity import Identity
|
|
26
|
-
from datarobot.auth.oauth import
|
|
21
|
+
from datarobot.auth.oauth import AsyncOAuthComponent
|
|
27
22
|
from datarobot.auth.session import AuthCtx
|
|
28
23
|
from datarobot.core.config import DataRobotAppFrameworkBaseSettings
|
|
29
24
|
from datarobot.models.genai.agent.auth import ToolAuth
|
|
30
25
|
from datarobot.models.genai.agent.auth import get_authorization_context
|
|
31
|
-
from mypyc.ir.ops import Sequence
|
|
32
26
|
from pydantic import BaseModel
|
|
33
27
|
|
|
34
28
|
logger = logging.getLogger(__name__)
|
|
@@ -189,203 +183,52 @@ class AuthContextHeaderHandler:
|
|
|
189
183
|
return None
|
|
190
184
|
|
|
191
185
|
|
|
192
|
-
# --- OAuth Token Provider Implementation ---
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
class TokenRetriever(Protocol):
|
|
196
|
-
"""Protocol for OAuth token retrievers."""
|
|
197
|
-
|
|
198
|
-
def filter_identities(self, identities: Sequence[Identity]) -> list[Identity]:
|
|
199
|
-
"""Filter identities to only those valid for this retriever implementation."""
|
|
200
|
-
...
|
|
201
|
-
|
|
202
|
-
async def refresh_access_token(self, identity: Identity) -> OAuthToken:
|
|
203
|
-
"""Refresh the access token for the given identity ID.
|
|
204
|
-
|
|
205
|
-
Parameters
|
|
206
|
-
----------
|
|
207
|
-
identity_id : str
|
|
208
|
-
The provider identity ID to refresh the token for.
|
|
209
|
-
|
|
210
|
-
Returns
|
|
211
|
-
-------
|
|
212
|
-
OAuthToken
|
|
213
|
-
The refreshed OAuth token.
|
|
214
|
-
"""
|
|
215
|
-
...
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
class DatarobotTokenRetriever:
|
|
219
|
-
"""Retrieves OAuth tokens using the DataRobot platform."""
|
|
220
|
-
|
|
221
|
-
def __init__(self) -> None:
|
|
222
|
-
self._client = DatarobotOAuthClient()
|
|
223
|
-
|
|
224
|
-
def filter_identities(self, identities: Sequence[Identity]) -> list[Identity]:
|
|
225
|
-
"""Filter oauth2 identities to only those with provider_identity_id.
|
|
226
|
-
|
|
227
|
-
The `provider_identity_id` is required in order to identify the provider
|
|
228
|
-
and retrieve the access token from DataRobot OAuth Providers service.
|
|
229
|
-
"""
|
|
230
|
-
return [i for i in identities if i.type == "oauth2" and i.provider_identity_id]
|
|
231
|
-
|
|
232
|
-
async def refresh_access_token(self, identity: Identity) -> OAuthToken:
|
|
233
|
-
"""Refresh the access token using DataRobot's OAuth client."""
|
|
234
|
-
return await self._client.refresh_access_token(provider_id=identity.provider_identity_id)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
class AuthlibTokenRetriever:
|
|
238
|
-
"""Retrieves OAuth tokens from a generic Authlib-based endpoint."""
|
|
239
|
-
|
|
240
|
-
def __init__(self, application_endpoint: str) -> None:
|
|
241
|
-
if not application_endpoint:
|
|
242
|
-
raise ValueError("AuthlibTokenRetriever requires 'application_endpoint'.")
|
|
243
|
-
self.application_endpoint = application_endpoint.rstrip("/")
|
|
244
|
-
|
|
245
|
-
def filter_identities(self, identities: Sequence[Identity]) -> list[Identity]:
|
|
246
|
-
"""Filter identities to only OAuth2 identities."""
|
|
247
|
-
return [i for i in identities if i.type == "oauth2" and i.provider_identity_id is None]
|
|
248
|
-
|
|
249
|
-
async def refresh_access_token(self, identity: Identity) -> OAuthToken:
|
|
250
|
-
"""Retrieve an OAuth token via an HTTP POST request.
|
|
251
|
-
|
|
252
|
-
Parameters
|
|
253
|
-
----------
|
|
254
|
-
identity : Identity
|
|
255
|
-
The identity to retrieve the token for.
|
|
256
|
-
|
|
257
|
-
Returns
|
|
258
|
-
-------
|
|
259
|
-
OAuthToken
|
|
260
|
-
The retrieved OAuth token.
|
|
261
|
-
"""
|
|
262
|
-
api_token = os.environ.get("DATAROBOT_API_TOKEN")
|
|
263
|
-
if not api_token:
|
|
264
|
-
raise ValueError("DATAROBOT_API_TOKEN environment variable is required but not set.")
|
|
265
|
-
|
|
266
|
-
token_url = f"{self.application_endpoint}/oauth/token/"
|
|
267
|
-
headers = {"Authorization": f"Bearer {api_token}"}
|
|
268
|
-
payload = {"identity_id": identity.id}
|
|
269
|
-
timeout = aiohttp.ClientTimeout(total=30)
|
|
270
|
-
|
|
271
|
-
try:
|
|
272
|
-
async with aiohttp.ClientSession(timeout=timeout) as session:
|
|
273
|
-
async with session.post(token_url, headers=headers, json=payload) as response:
|
|
274
|
-
response.raise_for_status()
|
|
275
|
-
data = await response.json()
|
|
276
|
-
logger.debug(f"Retrieved access token from {token_url}")
|
|
277
|
-
return OAuthToken(**data)
|
|
278
|
-
except aiohttp.ClientError as e:
|
|
279
|
-
logger.error(f"Error retrieving token from {token_url}: {e}")
|
|
280
|
-
raise
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
class OAuthConfig(BaseModel):
|
|
284
|
-
"""Configuration extracted from AuthCtx metadata for OAuth operations."""
|
|
285
|
-
|
|
286
|
-
implementation: str = "datarobot"
|
|
287
|
-
application_endpoint: str | None = None
|
|
288
|
-
|
|
289
|
-
@classmethod
|
|
290
|
-
def from_auth_ctx(cls, auth_ctx: AuthCtx) -> "OAuthConfig":
|
|
291
|
-
metadata = auth_ctx.metadata or {}
|
|
292
|
-
return cls(
|
|
293
|
-
implementation=metadata.get("oauth_implementation", "datarobot"),
|
|
294
|
-
application_endpoint=metadata.get("application_endpoint"),
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
def create_token_retriever(config: OAuthConfig) -> TokenRetriever:
|
|
299
|
-
"""Create a token retriever based on the OAuth configuration.
|
|
300
|
-
|
|
301
|
-
Parameters
|
|
302
|
-
----------
|
|
303
|
-
config : OAuthConfig
|
|
304
|
-
The OAuth configuration specifying implementation type and endpoints.
|
|
305
|
-
|
|
306
|
-
Returns
|
|
307
|
-
-------
|
|
308
|
-
TokenRetriever
|
|
309
|
-
The configured token retriever instance.
|
|
310
|
-
"""
|
|
311
|
-
if config.implementation == "datarobot":
|
|
312
|
-
return DatarobotTokenRetriever()
|
|
313
|
-
|
|
314
|
-
if config.implementation == "authlib":
|
|
315
|
-
if not config.application_endpoint:
|
|
316
|
-
raise ValueError("Required 'application_endpoint' not found in metadata.")
|
|
317
|
-
return AuthlibTokenRetriever(config.application_endpoint)
|
|
318
|
-
|
|
319
|
-
raise ValueError(
|
|
320
|
-
f"Unsupported OAuth implementation: '{config.implementation}'. "
|
|
321
|
-
f"Supported values: datarobot, authlib."
|
|
322
|
-
)
|
|
323
|
-
|
|
324
|
-
|
|
325
186
|
class AsyncOAuthTokenProvider:
|
|
326
|
-
"""
|
|
327
|
-
|
|
328
|
-
This class manages OAuth token retrieval for users with multiple identity providers.
|
|
329
|
-
It uses either DataRobot or Authlib as the OAuth token storage and refresh backend
|
|
330
|
-
based on the auth context metadata.
|
|
331
|
-
"""
|
|
187
|
+
"""Manages OAuth access tokens using generic OAuth client."""
|
|
332
188
|
|
|
333
189
|
def __init__(self, auth_ctx: AuthCtx) -> None:
|
|
334
|
-
"""Initialize the provider with an authorization context.
|
|
335
|
-
|
|
336
|
-
Parameters
|
|
337
|
-
----------
|
|
338
|
-
auth_ctx : AuthCtx
|
|
339
|
-
The authorization context containing user identities and metadata.
|
|
340
|
-
"""
|
|
341
190
|
self.auth_ctx = auth_ctx
|
|
342
|
-
|
|
343
|
-
self._retriever = create_token_retriever(config)
|
|
191
|
+
self.oauth_client = self._create_oauth_client()
|
|
344
192
|
|
|
345
193
|
def _get_identity(self, provider_type: str | None) -> Identity:
|
|
346
|
-
"""
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
194
|
+
"""Retrieve the appropriate identity from the authentication context."""
|
|
195
|
+
identities = [x for x in self.auth_ctx.identities if x.provider_identity_id is not None]
|
|
196
|
+
|
|
197
|
+
if not identities:
|
|
198
|
+
raise ValueError("No identities found in authorization context.")
|
|
350
199
|
|
|
351
200
|
if provider_type is None:
|
|
352
|
-
if len(
|
|
353
|
-
raise
|
|
354
|
-
"Multiple
|
|
201
|
+
if len(identities) > 1:
|
|
202
|
+
raise ValueError(
|
|
203
|
+
"Multiple identities found. Please specify 'provider_type' parameter."
|
|
355
204
|
)
|
|
356
|
-
return
|
|
205
|
+
return identities[0]
|
|
206
|
+
|
|
207
|
+
identity = next((id for id in identities if id.provider_type == provider_type), None)
|
|
357
208
|
|
|
358
|
-
identity = next((i for i in oauth_identities if i.provider_type == provider_type), None)
|
|
359
209
|
if identity is None:
|
|
360
|
-
raise
|
|
210
|
+
raise ValueError(f"No identity found for provider '{provider_type}'.")
|
|
211
|
+
|
|
361
212
|
return identity
|
|
362
213
|
|
|
363
214
|
async def get_token(self, auth_type: ToolAuth, provider_type: str | None = None) -> str:
|
|
364
|
-
"""Get
|
|
365
|
-
|
|
366
|
-
Parameters
|
|
367
|
-
----------
|
|
368
|
-
auth_type : ToolAuth
|
|
369
|
-
Authentication type (only OBO is supported).
|
|
370
|
-
provider_type : str, optional
|
|
371
|
-
The specific provider to use (e.g., 'google'). Required if multiple
|
|
372
|
-
identities are available.
|
|
373
|
-
|
|
374
|
-
Returns
|
|
375
|
-
-------
|
|
376
|
-
str
|
|
377
|
-
The retrieved OAuth access token.
|
|
378
|
-
|
|
379
|
-
Raises
|
|
380
|
-
------
|
|
381
|
-
ValueError
|
|
382
|
-
If the auth type is unsupported or if a suitable identity cannot be found.
|
|
383
|
-
"""
|
|
215
|
+
"""Get OAuth access token using the specified method."""
|
|
384
216
|
if auth_type != ToolAuth.OBO:
|
|
385
217
|
raise ValueError(
|
|
386
|
-
f"Unsupported auth type: {auth_type}. Only OBO
|
|
218
|
+
f"Unsupported auth type: {auth_type}. Only {ToolAuth.OBO} is supported."
|
|
387
219
|
)
|
|
388
220
|
|
|
389
221
|
identity = self._get_identity(provider_type)
|
|
390
|
-
token_data = await self.
|
|
222
|
+
token_data = await self.oauth_client.refresh_access_token(
|
|
223
|
+
identity_id=identity.provider_identity_id
|
|
224
|
+
)
|
|
391
225
|
return token_data.access_token
|
|
226
|
+
|
|
227
|
+
def _create_oauth_client(self) -> AsyncOAuthComponent:
|
|
228
|
+
"""Create either DataRobot or Authlib OAuth client based on
|
|
229
|
+
authorization context.
|
|
230
|
+
|
|
231
|
+
Note: at the moment, only DataRobot OAuth client is supported.
|
|
232
|
+
"""
|
|
233
|
+
logger.debug("Using DataRobot OAuth client")
|
|
234
|
+
return DatarobotAsyncOAuthClient()
|
|
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.8 → datarobot_genai-0.2.9}/src/datarobot_genai/core/cli/agent_environment.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/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
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/config_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/credentials.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/dr_mcp_server.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/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
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/mcp_instance.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/mcp_server_tools.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/routes_utils.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/server_life_cycle.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/tool_config.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/core/tool_filter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/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
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/test_utils/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/__init__.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/atlassian.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/jira.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/clients/s3.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/confluence/tools.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/jira/__init__.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/jira/tools.py
RENAMED
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/drmcp/tools/predictive/data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/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.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_auth_provider.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_llm_clients.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_llm_providers.py
RENAMED
|
File without changes
|
{datarobot_genai-0.2.8 → datarobot_genai-0.2.9}/src/datarobot_genai/nat/datarobot_mcp_client.py
RENAMED
|
File without changes
|
|
File without changes
|