agenta 0.50.6__py3-none-any.whl → 0.51.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- agenta/__init__.py +8 -5
- agenta/sdk/__init__.py +2 -1
- agenta/sdk/agenta_init.py +2 -2
- agenta/sdk/context/running.py +39 -0
- agenta/sdk/context/{routing.py → serving.py} +4 -4
- agenta/sdk/context/tracing.py +27 -1
- agenta/sdk/decorators/running.py +134 -0
- agenta/sdk/decorators/{routing.py → serving.py} +5 -5
- agenta/sdk/decorators/tracing.py +7 -1
- agenta/sdk/litellm/mockllm.py +55 -2
- agenta/sdk/managers/config.py +2 -2
- agenta/sdk/managers/secrets.py +2 -2
- agenta/sdk/managers/vault.py +2 -2
- agenta/sdk/middleware/adapt.py +253 -0
- agenta/sdk/middleware/auth.py +179 -3
- agenta/sdk/middleware/base.py +40 -0
- agenta/sdk/middleware/flags.py +40 -0
- agenta/sdk/tracing/exporters.py +9 -9
- agenta/sdk/tracing/inline.py +1 -0
- agenta/sdk/tracing/tracing.py +0 -8
- agenta/sdk/utils/cache.py +3 -3
- agenta/sdk/workflows/__init__.py +0 -0
- agenta/sdk/workflows/registry.py +32 -0
- agenta/sdk/workflows/types.py +470 -0
- agenta/sdk/workflows/utils.py +17 -0
- {agenta-0.50.6.dist-info → agenta-0.51.0.dist-info}/METADATA +4 -2
- {agenta-0.50.6.dist-info → agenta-0.51.0.dist-info}/RECORD +28 -20
- agenta/sdk/context/exporting.py +0 -25
- {agenta-0.50.6.dist-info → agenta-0.51.0.dist-info}/WHEEL +0 -0
agenta/__init__.py
CHANGED
|
@@ -21,13 +21,15 @@ from .sdk.types import (
|
|
|
21
21
|
PromptTemplate,
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
+
from .sdk.agenta_init import Config, AgentaSingleton, init as _init
|
|
24
25
|
from .sdk.utils.logging import get_module_logger
|
|
26
|
+
from .sdk.utils.costs import calculate_token_usage
|
|
25
27
|
from .sdk.tracing import Tracing, get_tracer
|
|
26
|
-
from .sdk.decorators.tracing import instrument
|
|
27
28
|
from .sdk.tracing.conventions import Reference
|
|
28
|
-
from .sdk.decorators.
|
|
29
|
-
from .sdk.
|
|
30
|
-
from .sdk.
|
|
29
|
+
from .sdk.decorators.tracing import instrument
|
|
30
|
+
from .sdk.decorators.running import workflow, workflows
|
|
31
|
+
from .sdk.decorators.serving import entrypoint, app, route
|
|
32
|
+
from .sdk.context.running import workflow_mode_enabled
|
|
31
33
|
from .sdk.litellm import litellm as callbacks
|
|
32
34
|
from .sdk.managers.apps import AppManager
|
|
33
35
|
from .sdk.managers.vault import VaultManager
|
|
@@ -52,6 +54,7 @@ tracer = get_tracer(tracing)
|
|
|
52
54
|
|
|
53
55
|
def init(
|
|
54
56
|
host: Optional[str] = None,
|
|
57
|
+
api_url: Optional[str] = None,
|
|
55
58
|
api_key: Optional[str] = None,
|
|
56
59
|
config_fname: Optional[str] = None,
|
|
57
60
|
redact: Optional[Callable[..., Any]] = None,
|
|
@@ -62,7 +65,7 @@ def init(
|
|
|
62
65
|
global api, async_api, tracing, tracer # pylint: disable=global-statement
|
|
63
66
|
|
|
64
67
|
_init(
|
|
65
|
-
host=host,
|
|
68
|
+
host=host or api_url,
|
|
66
69
|
api_key=api_key,
|
|
67
70
|
config_fname=config_fname,
|
|
68
71
|
redact=redact,
|
agenta/sdk/__init__.py
CHANGED
|
@@ -22,8 +22,9 @@ from .types import (
|
|
|
22
22
|
|
|
23
23
|
from .tracing import Tracing, get_tracer
|
|
24
24
|
from .decorators.tracing import instrument
|
|
25
|
+
from .decorators.running import workflow, workflows
|
|
26
|
+
from .decorators.serving import entrypoint, app, route
|
|
25
27
|
from .tracing.conventions import Reference
|
|
26
|
-
from .decorators.routing import entrypoint, app, route
|
|
27
28
|
from .agenta_init import Config, AgentaSingleton, init as _init
|
|
28
29
|
from .utils.costs import calculate_token_usage
|
|
29
30
|
from .managers.apps import AppManager
|
agenta/sdk/agenta_init.py
CHANGED
|
@@ -9,7 +9,7 @@ from agenta.sdk.utils.logging import get_module_logger
|
|
|
9
9
|
from agenta.client.client import AgentaApi, AsyncAgentaApi
|
|
10
10
|
|
|
11
11
|
from agenta.sdk.tracing import Tracing
|
|
12
|
-
from agenta.sdk.context.
|
|
12
|
+
from agenta.sdk.context.serving import serving_context
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
log = get_module_logger(__name__)
|
|
@@ -149,7 +149,7 @@ class Config:
|
|
|
149
149
|
return self.default_parameters
|
|
150
150
|
|
|
151
151
|
def __getattr__(self, key):
|
|
152
|
-
context =
|
|
152
|
+
context = serving_context.get()
|
|
153
153
|
|
|
154
154
|
parameters = context.parameters
|
|
155
155
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from typing import Dict, Any, Optional
|
|
2
|
+
from contextvars import ContextVar
|
|
3
|
+
from contextlib import contextmanager
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel
|
|
6
|
+
|
|
7
|
+
workflow_mode_enabled_context: ContextVar[bool] = ContextVar(
|
|
8
|
+
"ag.workflow_context_enabled",
|
|
9
|
+
default=False,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@contextmanager
|
|
14
|
+
def workflow_mode_enabled():
|
|
15
|
+
token = workflow_mode_enabled_context.set(True)
|
|
16
|
+
try:
|
|
17
|
+
yield
|
|
18
|
+
finally:
|
|
19
|
+
workflow_mode_enabled_context.reset(token)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@contextmanager
|
|
23
|
+
async def async_workflow_mode_enabled():
|
|
24
|
+
token = workflow_mode_enabled_context.set(True)
|
|
25
|
+
try:
|
|
26
|
+
yield
|
|
27
|
+
finally:
|
|
28
|
+
workflow_mode_enabled_context.reset(token)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class WorkflowRegistryContext(BaseModel):
|
|
32
|
+
version: Optional[str] = None
|
|
33
|
+
handlers: Dict[str, Any] = {}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
workflow_registry_context: ContextVar[WorkflowRegistryContext] = ContextVar(
|
|
37
|
+
"ag.workflow_registry",
|
|
38
|
+
default=WorkflowRegistryContext(),
|
|
39
|
+
)
|
|
@@ -12,16 +12,16 @@ class RoutingContext(BaseModel):
|
|
|
12
12
|
mock: Optional[str] = None
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
serving_context = ContextVar("serving_context", default=RoutingContext())
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
@contextmanager
|
|
19
|
-
def
|
|
19
|
+
def serving_context_manager(
|
|
20
20
|
*,
|
|
21
21
|
context: Optional[RoutingContext] = None,
|
|
22
22
|
):
|
|
23
|
-
token =
|
|
23
|
+
token = serving_context.set(context)
|
|
24
24
|
try:
|
|
25
25
|
yield
|
|
26
26
|
finally:
|
|
27
|
-
|
|
27
|
+
serving_context.reset(token)
|
agenta/sdk/context/tracing.py
CHANGED
|
@@ -13,9 +13,13 @@ class TracingContext(BaseModel):
|
|
|
13
13
|
parameters: Optional[Dict[str, Any]] = None
|
|
14
14
|
references: Optional[Dict[str, Any]] = None
|
|
15
15
|
link: Optional[Dict[str, Any]] = None
|
|
16
|
+
type: Optional[str] = None
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
tracing_context = ContextVar(
|
|
19
|
+
tracing_context = ContextVar(
|
|
20
|
+
"ag.tracing_context",
|
|
21
|
+
default=TracingContext(),
|
|
22
|
+
)
|
|
19
23
|
|
|
20
24
|
|
|
21
25
|
@contextmanager
|
|
@@ -28,3 +32,25 @@ def tracing_context_manager(
|
|
|
28
32
|
yield
|
|
29
33
|
finally:
|
|
30
34
|
tracing_context.reset(token)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class TracingExporterContext(BaseModel):
|
|
38
|
+
credentials: Optional[str] = None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
tracing_exporter_context = ContextVar(
|
|
42
|
+
"ag.tracing_exporter_context",
|
|
43
|
+
default=TracingExporterContext(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@contextmanager
|
|
48
|
+
def tracing_exporter_context_manager(
|
|
49
|
+
*,
|
|
50
|
+
context: Optional[TracingExporterContext] = None,
|
|
51
|
+
):
|
|
52
|
+
token = tracing_exporter_context.set(context)
|
|
53
|
+
try:
|
|
54
|
+
yield
|
|
55
|
+
finally:
|
|
56
|
+
tracing_exporter_context.reset(token)
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
from typing import Any, Callable, List, Awaitable, Dict, Optional
|
|
2
|
+
import asyncio
|
|
3
|
+
from functools import wraps
|
|
4
|
+
from inspect import iscoroutinefunction
|
|
5
|
+
from copy import deepcopy
|
|
6
|
+
|
|
7
|
+
from decorator import decorator
|
|
8
|
+
|
|
9
|
+
from agenta.sdk.context.running import (
|
|
10
|
+
workflow_mode_enabled_context,
|
|
11
|
+
workflow_registry_context,
|
|
12
|
+
WorkflowRegistryContext,
|
|
13
|
+
)
|
|
14
|
+
from agenta.sdk.workflows.types import (
|
|
15
|
+
WorkflowServiceRequest,
|
|
16
|
+
WorkflowServiceResponse,
|
|
17
|
+
WorkflowServiceInterface,
|
|
18
|
+
WorkflowRevision,
|
|
19
|
+
Schema,
|
|
20
|
+
)
|
|
21
|
+
from agenta.sdk.middleware.base import WorkflowMiddlewareDecorator
|
|
22
|
+
|
|
23
|
+
from agenta.sdk.middleware.auth import AuthMiddleware
|
|
24
|
+
from agenta.sdk.middleware.flags import FlagsMiddleware
|
|
25
|
+
from agenta.sdk.middleware.adapt import AdaptMiddleware
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
LATEST_VERSION = "2025.07.14"
|
|
29
|
+
DEFAULT_SCHEMAS = lambda: {} # pylint: disable=unnecessary-lambda-assignment
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class workflows:
|
|
33
|
+
@classmethod
|
|
34
|
+
def get_registry(cls) -> WorkflowRegistryContext:
|
|
35
|
+
return deepcopy(workflow_registry_context.get())
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class workflow: # pylint: disable=invalid-name
|
|
39
|
+
def __init__(
|
|
40
|
+
self,
|
|
41
|
+
version: Optional[str] = None,
|
|
42
|
+
schemas: Optional[Dict[str, Schema]] = None,
|
|
43
|
+
):
|
|
44
|
+
self.middleware: List[WorkflowMiddlewareDecorator] = [
|
|
45
|
+
AuthMiddleware,
|
|
46
|
+
FlagsMiddleware,
|
|
47
|
+
AdaptMiddleware,
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
self.version = version or LATEST_VERSION
|
|
51
|
+
self.schemas = schemas or DEFAULT_SCHEMAS()
|
|
52
|
+
|
|
53
|
+
def __call__(self, func: Callable[..., Any]) -> Callable[..., Any]:
|
|
54
|
+
is_async = iscoroutinefunction(func)
|
|
55
|
+
|
|
56
|
+
workflow_registry = workflow_registry_context.get()
|
|
57
|
+
|
|
58
|
+
workflow_registry.version = workflow_registry.version or self.version
|
|
59
|
+
|
|
60
|
+
if is_async:
|
|
61
|
+
|
|
62
|
+
@wraps(func)
|
|
63
|
+
async def async_wrapper(*args, **kwargs):
|
|
64
|
+
if workflow_mode_enabled_context.get():
|
|
65
|
+
return await self._wrapped_async(func)(*args, **kwargs)
|
|
66
|
+
return await func(*args, **kwargs)
|
|
67
|
+
|
|
68
|
+
workflow_registry.handlers = {
|
|
69
|
+
"invoke": async_wrapper,
|
|
70
|
+
"inspect": self.make_interface_wrapper(self.version, self.schemas),
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return async_wrapper
|
|
74
|
+
|
|
75
|
+
else:
|
|
76
|
+
|
|
77
|
+
@wraps(func)
|
|
78
|
+
def sync_wrapper(*args, **kwargs):
|
|
79
|
+
if workflow_mode_enabled_context.get():
|
|
80
|
+
return self._wrapped_async(func)(*args, **kwargs)
|
|
81
|
+
return func(*args, **kwargs)
|
|
82
|
+
|
|
83
|
+
return sync_wrapper
|
|
84
|
+
|
|
85
|
+
def _wrapped_async(
|
|
86
|
+
self,
|
|
87
|
+
func: Callable[..., Any],
|
|
88
|
+
) -> Callable[..., Awaitable[WorkflowServiceResponse]]:
|
|
89
|
+
@decorator
|
|
90
|
+
async def async_wrapper(func, *args, **kwargs):
|
|
91
|
+
result = (
|
|
92
|
+
await func(*args, **kwargs)
|
|
93
|
+
if iscoroutinefunction(func)
|
|
94
|
+
else await asyncio.to_thread(func, *args, **kwargs)
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
return result
|
|
98
|
+
|
|
99
|
+
@wraps(func)
|
|
100
|
+
async def wrapper(*args, **kwargs):
|
|
101
|
+
handler = async_wrapper(func, *args, **kwargs)
|
|
102
|
+
request: WorkflowServiceRequest = (
|
|
103
|
+
kwargs.pop("request")
|
|
104
|
+
if "request" in kwargs
|
|
105
|
+
else args[0]
|
|
106
|
+
if len(args) > 0
|
|
107
|
+
else None
|
|
108
|
+
)
|
|
109
|
+
revision: WorkflowRevision = (
|
|
110
|
+
kwargs.pop("revision")
|
|
111
|
+
if "revision" in kwargs
|
|
112
|
+
else args[1]
|
|
113
|
+
if len(args) > 1
|
|
114
|
+
else None
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
_handler = handler
|
|
118
|
+
for middleware in reversed(self.middleware):
|
|
119
|
+
_handler = middleware(_handler)
|
|
120
|
+
|
|
121
|
+
return await _handler(
|
|
122
|
+
request=request,
|
|
123
|
+
revision=revision,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
return wrapper
|
|
127
|
+
|
|
128
|
+
def make_interface_wrapper(self, path, schemas):
|
|
129
|
+
async def interface_wrapper() -> WorkflowServiceResponse:
|
|
130
|
+
return WorkflowServiceInterface(
|
|
131
|
+
schemas={path: schemas},
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
return interface_wrapper
|
|
@@ -14,11 +14,11 @@ from agenta.sdk.middleware.inline import InlineMiddleware
|
|
|
14
14
|
from agenta.sdk.middleware.vault import VaultMiddleware
|
|
15
15
|
from agenta.sdk.middleware.config import ConfigMiddleware
|
|
16
16
|
from agenta.sdk.middleware.otel import OTelMiddleware
|
|
17
|
-
from agenta.sdk.middleware.auth import
|
|
17
|
+
from agenta.sdk.middleware.auth import AuthHTTPMiddleware
|
|
18
18
|
from agenta.sdk.middleware.cors import CORSMiddleware
|
|
19
19
|
|
|
20
|
-
from agenta.sdk.context.
|
|
21
|
-
|
|
20
|
+
from agenta.sdk.context.serving import (
|
|
21
|
+
serving_context_manager,
|
|
22
22
|
RoutingContext,
|
|
23
23
|
)
|
|
24
24
|
from agenta.sdk.context.tracing import (
|
|
@@ -145,7 +145,7 @@ class entrypoint:
|
|
|
145
145
|
app.add_middleware(InlineMiddleware)
|
|
146
146
|
app.add_middleware(VaultMiddleware)
|
|
147
147
|
app.add_middleware(ConfigMiddleware)
|
|
148
|
-
app.add_middleware(
|
|
148
|
+
app.add_middleware(AuthHTTPMiddleware)
|
|
149
149
|
app.add_middleware(OTelMiddleware)
|
|
150
150
|
app.add_middleware(CORSMiddleware)
|
|
151
151
|
### ------------------ #
|
|
@@ -326,7 +326,7 @@ class entrypoint:
|
|
|
326
326
|
inline = state.inline
|
|
327
327
|
mock = state.mock
|
|
328
328
|
|
|
329
|
-
with
|
|
329
|
+
with serving_context_manager(
|
|
330
330
|
context=RoutingContext(
|
|
331
331
|
parameters=parameters,
|
|
332
332
|
secrets=secrets,
|
agenta/sdk/decorators/tracing.py
CHANGED
|
@@ -169,8 +169,14 @@ class instrument: # pylint: disable=invalid-name
|
|
|
169
169
|
|
|
170
170
|
ag.tracing.credentials.put(trace_id, context.credentials)
|
|
171
171
|
|
|
172
|
+
trace_type = context.type or "invocation"
|
|
173
|
+
span_type = self.type or "task"
|
|
174
|
+
|
|
172
175
|
span.set_attributes(
|
|
173
|
-
attributes={
|
|
176
|
+
attributes={
|
|
177
|
+
"node": span_type,
|
|
178
|
+
"tree": trace_type,
|
|
179
|
+
},
|
|
174
180
|
namespace="type",
|
|
175
181
|
)
|
|
176
182
|
|
agenta/sdk/litellm/mockllm.py
CHANGED
|
@@ -1,16 +1,69 @@
|
|
|
1
1
|
from typing import Optional, Protocol, Any
|
|
2
2
|
from os import environ
|
|
3
|
+
from contextlib import contextmanager
|
|
3
4
|
|
|
4
5
|
from agenta.sdk.utils.logging import get_module_logger
|
|
5
6
|
|
|
6
7
|
from agenta.sdk.litellm.mocks import MOCKS
|
|
7
|
-
from agenta.sdk.context.
|
|
8
|
+
from agenta.sdk.context.serving import serving_context
|
|
8
9
|
|
|
9
10
|
AGENTA_LITELLM_MOCK = environ.get("AGENTA_LITELLM_MOCK") or None
|
|
10
11
|
|
|
11
12
|
log = get_module_logger(__name__)
|
|
12
13
|
|
|
13
14
|
|
|
15
|
+
ENV_KEYS_TO_CLEAR = [
|
|
16
|
+
# anything that could inject Lambda/ECS role creds
|
|
17
|
+
"AWS_SESSION_TOKEN",
|
|
18
|
+
"AWS_SECURITY_TOKEN",
|
|
19
|
+
"AWS_WEB_IDENTITY_TOKEN_FILE",
|
|
20
|
+
"AWS_ROLE_ARN",
|
|
21
|
+
"AWS_CONTAINER_CREDENTIALS_FULL_URI",
|
|
22
|
+
"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",
|
|
23
|
+
"AWS_ECS_CONTAINER_AUTHORIZATION_TOKEN",
|
|
24
|
+
"AWS_PROFILE",
|
|
25
|
+
"AWS_SHARED_CREDENTIALS_FILE",
|
|
26
|
+
"AWS_CONFIG_FILE",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
ENV_KEYS_FROM_USER = [
|
|
30
|
+
"AWS_ACCESS_KEY_ID",
|
|
31
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
32
|
+
"AWS_SESSION_TOKEN",
|
|
33
|
+
"AWS_REGION",
|
|
34
|
+
"AWS_DEFAULT_REGION",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@contextmanager
|
|
39
|
+
def user_aws_credentials_from(ps: dict):
|
|
40
|
+
old = {}
|
|
41
|
+
try:
|
|
42
|
+
# Save original state of ALL keys we'll modify
|
|
43
|
+
for k in ENV_KEYS_TO_CLEAR + ENV_KEYS_FROM_USER:
|
|
44
|
+
if k in environ:
|
|
45
|
+
old[k] = environ[k]
|
|
46
|
+
|
|
47
|
+
# Clear AWS role credentials
|
|
48
|
+
for k in ENV_KEYS_TO_CLEAR:
|
|
49
|
+
environ.pop(k, None)
|
|
50
|
+
|
|
51
|
+
# Set user credentials
|
|
52
|
+
for k in ENV_KEYS_FROM_USER:
|
|
53
|
+
if ps.get(k.upper()) is None:
|
|
54
|
+
environ.pop(k, None)
|
|
55
|
+
else:
|
|
56
|
+
environ[k] = ps[k.upper()]
|
|
57
|
+
yield
|
|
58
|
+
finally:
|
|
59
|
+
# Restore all environment variables to original state
|
|
60
|
+
for k in ENV_KEYS_TO_CLEAR + ENV_KEYS_FROM_USER:
|
|
61
|
+
if k in old:
|
|
62
|
+
environ[k] = old[k]
|
|
63
|
+
else:
|
|
64
|
+
environ.pop(k, None)
|
|
65
|
+
|
|
66
|
+
|
|
14
67
|
class LitellmProtocol(Protocol):
|
|
15
68
|
async def acompletion(self, *args: Any, **kwargs: Any) -> Any:
|
|
16
69
|
...
|
|
@@ -20,7 +73,7 @@ litellm: Optional[LitellmProtocol] = None # pylint: disable=invalid-name
|
|
|
20
73
|
|
|
21
74
|
|
|
22
75
|
async def acompletion(*args, **kwargs):
|
|
23
|
-
mock = AGENTA_LITELLM_MOCK or
|
|
76
|
+
mock = AGENTA_LITELLM_MOCK or serving_context.get().mock
|
|
24
77
|
|
|
25
78
|
if mock:
|
|
26
79
|
log.debug("Mocking litellm: %s.", mock)
|
agenta/sdk/managers/config.py
CHANGED
|
@@ -7,7 +7,7 @@ from pydantic import BaseModel
|
|
|
7
7
|
|
|
8
8
|
from agenta.sdk.utils.logging import get_module_logger
|
|
9
9
|
from agenta.sdk.managers.shared import SharedManager
|
|
10
|
-
from agenta.sdk.context.
|
|
10
|
+
from agenta.sdk.context.serving import serving_context
|
|
11
11
|
|
|
12
12
|
T = TypeVar("T", bound=BaseModel)
|
|
13
13
|
|
|
@@ -45,7 +45,7 @@ class ConfigManager:
|
|
|
45
45
|
Only one of these should be provided.
|
|
46
46
|
"""
|
|
47
47
|
|
|
48
|
-
context =
|
|
48
|
+
context = serving_context.get()
|
|
49
49
|
|
|
50
50
|
parameters = context.parameters
|
|
51
51
|
|
agenta/sdk/managers/secrets.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from typing import Optional, Dict, Any, List
|
|
3
3
|
|
|
4
|
-
from agenta.sdk.context.
|
|
4
|
+
from agenta.sdk.context.serving import serving_context
|
|
5
5
|
from agenta.sdk.assets import model_to_provider_mapping as _standard_providers
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class SecretsManager:
|
|
9
9
|
@staticmethod
|
|
10
10
|
def get_from_route() -> Optional[List[Dict[str, Any]]]:
|
|
11
|
-
context =
|
|
11
|
+
context = serving_context.get()
|
|
12
12
|
|
|
13
13
|
secrets = context.secrets
|
|
14
14
|
|
agenta/sdk/managers/vault.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from typing import Optional, Dict, Any
|
|
2
2
|
|
|
3
|
-
from agenta.sdk.context.
|
|
3
|
+
from agenta.sdk.context.serving import serving_context
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class VaultManager:
|
|
7
7
|
@staticmethod
|
|
8
8
|
def get_from_route() -> Optional[Dict[str, Any]]:
|
|
9
|
-
context =
|
|
9
|
+
context = serving_context.get()
|
|
10
10
|
|
|
11
11
|
secrets = context.secrets
|
|
12
12
|
|