agenta 0.32.0__py3-none-any.whl → 0.32.0a2__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 +3 -1
- agenta/client/backend/client.py +22 -14
- agenta/client/backend/core/http_client.py +3 -3
- agenta/sdk/__init__.py +1 -1
- agenta/sdk/context/routing.py +1 -0
- agenta/sdk/decorators/routing.py +164 -476
- agenta/sdk/decorators/tracing.py +16 -4
- agenta/sdk/litellm/litellm.py +44 -8
- agenta/sdk/litellm/mockllm.py +27 -0
- agenta/sdk/litellm/mocks/__init__.py +32 -0
- agenta/sdk/managers/vault.py +16 -0
- agenta/sdk/middleware/auth.py +5 -1
- agenta/sdk/middleware/config.py +16 -7
- agenta/sdk/middleware/inline.py +38 -0
- agenta/sdk/middleware/mock.py +33 -0
- agenta/sdk/middleware/vault.py +6 -19
- agenta/sdk/tracing/exporters.py +0 -1
- agenta/sdk/tracing/inline.py +23 -29
- agenta/sdk/types.py +334 -4
- {agenta-0.32.0.dist-info → agenta-0.32.0a2.dist-info}/METADATA +1 -1
- {agenta-0.32.0.dist-info → agenta-0.32.0a2.dist-info}/RECORD +23 -18
- {agenta-0.32.0.dist-info → agenta-0.32.0a2.dist-info}/WHEEL +0 -0
- {agenta-0.32.0.dist-info → agenta-0.32.0a2.dist-info}/entry_points.txt +0 -0
agenta/__init__.py
CHANGED
|
@@ -5,10 +5,10 @@ from .sdk.utils.preinit import PreInitObject
|
|
|
5
5
|
import agenta.client.backend.types as client_types # pylint: disable=wrong-import-order
|
|
6
6
|
|
|
7
7
|
from .sdk.types import (
|
|
8
|
+
MCField,
|
|
8
9
|
DictInput,
|
|
9
10
|
MultipleChoice,
|
|
10
11
|
FloatParam,
|
|
11
|
-
InFile,
|
|
12
12
|
IntParam,
|
|
13
13
|
MultipleChoiceParam,
|
|
14
14
|
GroupedMultipleChoiceParam,
|
|
@@ -17,6 +17,7 @@ from .sdk.types import (
|
|
|
17
17
|
FileInputURL,
|
|
18
18
|
BinaryParam,
|
|
19
19
|
Prompt,
|
|
20
|
+
PromptTemplate,
|
|
20
21
|
)
|
|
21
22
|
|
|
22
23
|
from .sdk.utils.logging import log as logging
|
|
@@ -28,6 +29,7 @@ from .sdk.agenta_init import Config, AgentaSingleton, init as _init
|
|
|
28
29
|
from .sdk.utils.costs import calculate_token_usage
|
|
29
30
|
from .sdk.client import Agenta
|
|
30
31
|
from .sdk.litellm import litellm as callbacks
|
|
32
|
+
from .sdk.managers.vault import VaultManager
|
|
31
33
|
from .sdk.managers.secrets import SecretsManager
|
|
32
34
|
from .sdk.managers.config import ConfigManager
|
|
33
35
|
from .sdk.managers.variant import VariantManager
|
agenta/client/backend/client.py
CHANGED
|
@@ -99,13 +99,17 @@ class AgentaApi:
|
|
|
99
99
|
self._client_wrapper = SyncClientWrapper(
|
|
100
100
|
base_url=base_url,
|
|
101
101
|
api_key=api_key,
|
|
102
|
-
httpx_client=
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
httpx_client=(
|
|
103
|
+
httpx_client
|
|
104
|
+
if httpx_client is not None
|
|
105
|
+
else (
|
|
106
|
+
httpx.Client(
|
|
107
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
108
|
+
)
|
|
109
|
+
if follow_redirects is not None
|
|
110
|
+
else httpx.Client(timeout=_defaulted_timeout)
|
|
111
|
+
)
|
|
112
|
+
),
|
|
109
113
|
timeout=_defaulted_timeout,
|
|
110
114
|
)
|
|
111
115
|
self.observability = ObservabilityClient(client_wrapper=self._client_wrapper)
|
|
@@ -1635,13 +1639,17 @@ class AsyncAgentaApi:
|
|
|
1635
1639
|
self._client_wrapper = AsyncClientWrapper(
|
|
1636
1640
|
base_url=base_url,
|
|
1637
1641
|
api_key=api_key,
|
|
1638
|
-
httpx_client=
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1642
|
+
httpx_client=(
|
|
1643
|
+
httpx_client
|
|
1644
|
+
if httpx_client is not None
|
|
1645
|
+
else (
|
|
1646
|
+
httpx.AsyncClient(
|
|
1647
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
1648
|
+
)
|
|
1649
|
+
if follow_redirects is not None
|
|
1650
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout)
|
|
1651
|
+
)
|
|
1652
|
+
),
|
|
1645
1653
|
timeout=_defaulted_timeout,
|
|
1646
1654
|
)
|
|
1647
1655
|
self.observability = AsyncObservabilityClient(
|
|
@@ -148,9 +148,9 @@ def get_request_body(
|
|
|
148
148
|
json_body = maybe_filter_request_body(json, request_options, omit)
|
|
149
149
|
|
|
150
150
|
# If you have an empty JSON body, you should just send None
|
|
151
|
-
return (
|
|
152
|
-
|
|
153
|
-
)
|
|
151
|
+
return (json_body if json_body != {} else None), (
|
|
152
|
+
data_body if data_body != {} else None
|
|
153
|
+
)
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
class HttpClient:
|
agenta/sdk/__init__.py
CHANGED
|
@@ -8,7 +8,6 @@ from .types import (
|
|
|
8
8
|
DictInput,
|
|
9
9
|
MultipleChoice,
|
|
10
10
|
FloatParam,
|
|
11
|
-
InFile,
|
|
12
11
|
IntParam,
|
|
13
12
|
MultipleChoiceParam,
|
|
14
13
|
GroupedMultipleChoiceParam,
|
|
@@ -27,6 +26,7 @@ from .tracing.conventions import Reference
|
|
|
27
26
|
from .decorators.routing import entrypoint, app, route
|
|
28
27
|
from .agenta_init import Config, AgentaSingleton, init as _init
|
|
29
28
|
from .utils.costs import calculate_token_usage
|
|
29
|
+
from .managers.vault import VaultManager
|
|
30
30
|
from .managers.secrets import SecretsManager
|
|
31
31
|
from .managers.config import ConfigManager
|
|
32
32
|
from .managers.variant import VariantManager
|
agenta/sdk/context/routing.py
CHANGED