agenta 0.32.0a1__py3-none-any.whl → 0.33.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.
- agenta/__init__.py +2 -0
- agenta/client/backend/__init__.py +39 -31
- agenta/client/backend/admin/__init__.py +1 -0
- agenta/client/backend/admin/client.py +576 -0
- agenta/client/backend/apps/client.py +450 -68
- agenta/client/backend/bases/client.py +10 -10
- agenta/client/backend/client.py +112 -122
- agenta/client/backend/containers/client.py +70 -28
- agenta/client/backend/core/http_client.py +3 -3
- agenta/client/backend/environments/client.py +8 -8
- agenta/client/backend/evaluations/client.py +46 -52
- agenta/client/backend/evaluators/client.py +32 -32
- agenta/client/backend/human_evaluations/__init__.py +1 -0
- agenta/client/backend/human_evaluations/client.py +1692 -0
- agenta/client/backend/observability/__init__.py +4 -0
- agenta/client/backend/observability/client.py +221 -744
- agenta/client/backend/testsets/client.py +38 -202
- agenta/client/backend/types/__init__.py +34 -28
- agenta/client/backend/types/account_response.py +24 -0
- agenta/client/backend/types/app_variant_revision.py +2 -1
- agenta/client/backend/types/{create_trace_response.py → delete_evaluation.py} +2 -3
- agenta/client/backend/types/{evaluation_scenario_score_update.py → legacy_scope_request.py} +2 -2
- agenta/client/backend/types/legacy_scopes_response.py +29 -0
- agenta/client/backend/types/{human_evaluation_update.py → legacy_user_request.py} +4 -4
- agenta/client/backend/types/{span_variant.py → legacy_user_response.py} +2 -4
- agenta/client/backend/types/organization_membership_request.py +25 -0
- agenta/client/backend/types/organization_request.py +23 -0
- agenta/client/backend/types/permission.py +4 -0
- agenta/client/backend/types/{llm_tokens.py → project_membership_request.py} +8 -5
- agenta/client/backend/types/project_request.py +26 -0
- agenta/client/backend/types/project_scope.py +29 -0
- agenta/client/backend/types/provider_kind.py +1 -1
- agenta/client/backend/types/reference.py +22 -0
- agenta/client/backend/types/role.py +15 -0
- agenta/client/backend/types/scopes_response_model.py +22 -0
- agenta/client/backend/types/score.py +1 -1
- agenta/client/backend/types/secret_response_dto.py +2 -2
- agenta/client/backend/types/user_request.py +22 -0
- agenta/client/backend/types/workspace_membership_request.py +26 -0
- agenta/client/backend/types/workspace_request.py +25 -0
- agenta/client/backend/variants/client.py +208 -42
- agenta/client/backend/vault/client.py +11 -9
- agenta/sdk/__init__.py +3 -0
- agenta/sdk/agenta_init.py +3 -1
- agenta/sdk/assets.py +4 -4
- agenta/sdk/decorators/routing.py +129 -23
- agenta/sdk/decorators/tracing.py +16 -4
- agenta/sdk/litellm/litellm.py +44 -8
- agenta/sdk/litellm/mockllm.py +2 -2
- agenta/sdk/litellm/mocks/__init__.py +9 -3
- agenta/sdk/managers/apps.py +64 -0
- agenta/sdk/managers/shared.py +2 -2
- agenta/sdk/middleware/auth.py +156 -53
- agenta/sdk/middleware/config.py +28 -16
- agenta/sdk/middleware/inline.py +1 -1
- agenta/sdk/middleware/mock.py +1 -1
- agenta/sdk/middleware/otel.py +1 -1
- agenta/sdk/middleware/vault.py +1 -1
- agenta/sdk/tracing/exporters.py +0 -1
- agenta/sdk/tracing/inline.py +26 -30
- agenta/sdk/types.py +12 -9
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/METADATA +23 -20
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/RECORD +69 -63
- agenta/client/backend/observability_v_1/__init__.py +0 -5
- agenta/client/backend/observability_v_1/client.py +0 -763
- agenta/client/backend/types/create_span.py +0 -45
- agenta/client/backend/types/human_evaluation_scenario_update.py +0 -30
- agenta/client/backend/types/new_human_evaluation.py +0 -27
- agenta/client/backend/types/outputs.py +0 -5
- agenta/client/backend/types/span.py +0 -42
- agenta/client/backend/types/span_detail.py +0 -44
- agenta/client/backend/types/span_status_code.py +0 -5
- agenta/client/backend/types/trace_detail.py +0 -44
- agenta/client/backend/types/with_pagination.py +0 -26
- /agenta/client/backend/{observability_v_1 → observability}/types/__init__.py +0 -0
- /agenta/client/backend/{observability_v_1 → observability}/types/format.py +0 -0
- /agenta/client/backend/{observability_v_1 → observability}/types/query_analytics_response.py +0 -0
- /agenta/client/backend/{observability_v_1 → observability}/types/query_traces_response.py +0 -0
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/WHEEL +0 -0
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/entry_points.txt +0 -0
|
@@ -46,14 +46,14 @@ class VariantsClient:
|
|
|
46
46
|
Same as POST /config
|
|
47
47
|
|
|
48
48
|
Args:
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
|
|
50
|
+
stoken_session (SessionContainer, optional): Session container. Defaults to result of verify_session().
|
|
51
51
|
|
|
52
52
|
Raises:
|
|
53
|
-
|
|
53
|
+
HTTPException: Raised if the variant could not be added or accessed.
|
|
54
54
|
|
|
55
55
|
Returns:
|
|
56
|
-
|
|
56
|
+
Union[AppVariantResponse, Any]: New variant details or exception.
|
|
57
57
|
|
|
58
58
|
Parameters
|
|
59
59
|
----------
|
|
@@ -199,16 +199,16 @@ class VariantsClient:
|
|
|
199
199
|
Start a variant of an app.
|
|
200
200
|
|
|
201
201
|
Args:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
variant_id (str): The ID of the variant to start.
|
|
203
|
+
action (VariantAction): The action to perform on the variant (start).
|
|
204
|
+
env_vars (Optional[DockerEnvVars], optional): The environment variables to inject to the Docker container. Defaults to None.
|
|
205
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
206
206
|
|
|
207
207
|
Returns:
|
|
208
|
-
|
|
208
|
+
URI: The URL of the started variant.
|
|
209
209
|
|
|
210
210
|
Raises:
|
|
211
|
-
|
|
211
|
+
HTTPException: If the app container cannot be started.
|
|
212
212
|
|
|
213
213
|
Parameters
|
|
214
214
|
----------
|
|
@@ -293,10 +293,10 @@ class VariantsClient:
|
|
|
293
293
|
In the case it's the last variant using the image, stop the container and remove the image.
|
|
294
294
|
|
|
295
295
|
Arguments:
|
|
296
|
-
|
|
296
|
+
app_variant -- AppVariant to remove
|
|
297
297
|
|
|
298
298
|
Raises:
|
|
299
|
-
|
|
299
|
+
HTTPException: If there is a problem removing the app variant
|
|
300
300
|
|
|
301
301
|
Parameters
|
|
302
302
|
----------
|
|
@@ -362,15 +362,15 @@ class VariantsClient:
|
|
|
362
362
|
Updates the parameters for an app variant.
|
|
363
363
|
|
|
364
364
|
Args:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
variant_id (str): The ID of the app variant to update.
|
|
366
|
+
payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
|
|
367
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
368
368
|
|
|
369
369
|
Raises:
|
|
370
|
-
|
|
370
|
+
HTTPException: If there is an error while trying to update the app variant.
|
|
371
371
|
|
|
372
372
|
Returns:
|
|
373
|
-
|
|
373
|
+
JSONResponse: A JSON response containing the updated app variant parameters.
|
|
374
374
|
|
|
375
375
|
Parameters
|
|
376
376
|
----------
|
|
@@ -450,14 +450,14 @@ class VariantsClient:
|
|
|
450
450
|
Updates the image used in an app variant.
|
|
451
451
|
|
|
452
452
|
Args:
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
variant_id (str): The ID of the app variant to update.
|
|
454
|
+
image (Image): The image information to update.
|
|
455
455
|
|
|
456
456
|
Raises:
|
|
457
|
-
|
|
457
|
+
HTTPException: If an error occurs while trying to update the app variant.
|
|
458
458
|
|
|
459
459
|
Returns:
|
|
460
|
-
|
|
460
|
+
JSONResponse: A JSON response indicating whether the update was successful or not.
|
|
461
461
|
|
|
462
462
|
Parameters
|
|
463
463
|
----------
|
|
@@ -532,6 +532,85 @@ class VariantsClient:
|
|
|
532
532
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
533
533
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
534
534
|
|
|
535
|
+
def update_variant_url(
|
|
536
|
+
self,
|
|
537
|
+
variant_id: str,
|
|
538
|
+
*,
|
|
539
|
+
url: str,
|
|
540
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
541
|
+
) -> typing.Optional[typing.Any]:
|
|
542
|
+
"""
|
|
543
|
+
Updates the URL used in an app variant.
|
|
544
|
+
|
|
545
|
+
Args:
|
|
546
|
+
variant_id (str): The ID of the app variant to update.
|
|
547
|
+
url (str): The URL to update.
|
|
548
|
+
|
|
549
|
+
Raises:
|
|
550
|
+
HTTPException: If an error occurs while trying to update the app variant.
|
|
551
|
+
|
|
552
|
+
Returns:
|
|
553
|
+
JSONResponse: A JSON response indicating whether the update was successful or not.
|
|
554
|
+
|
|
555
|
+
Parameters
|
|
556
|
+
----------
|
|
557
|
+
variant_id : str
|
|
558
|
+
|
|
559
|
+
url : str
|
|
560
|
+
|
|
561
|
+
request_options : typing.Optional[RequestOptions]
|
|
562
|
+
Request-specific configuration.
|
|
563
|
+
|
|
564
|
+
Returns
|
|
565
|
+
-------
|
|
566
|
+
typing.Optional[typing.Any]
|
|
567
|
+
Successful Response
|
|
568
|
+
|
|
569
|
+
Examples
|
|
570
|
+
--------
|
|
571
|
+
from agenta import AgentaApi
|
|
572
|
+
|
|
573
|
+
client = AgentaApi(
|
|
574
|
+
api_key="YOUR_API_KEY",
|
|
575
|
+
base_url="https://yourhost.com/path/to/api",
|
|
576
|
+
)
|
|
577
|
+
client.variants.update_variant_url(
|
|
578
|
+
variant_id="variant_id",
|
|
579
|
+
url="url",
|
|
580
|
+
)
|
|
581
|
+
"""
|
|
582
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
583
|
+
f"variants/{jsonable_encoder(variant_id)}/service",
|
|
584
|
+
method="PUT",
|
|
585
|
+
params={
|
|
586
|
+
"url": url,
|
|
587
|
+
},
|
|
588
|
+
request_options=request_options,
|
|
589
|
+
)
|
|
590
|
+
try:
|
|
591
|
+
if 200 <= _response.status_code < 300:
|
|
592
|
+
return typing.cast(
|
|
593
|
+
typing.Optional[typing.Any],
|
|
594
|
+
parse_obj_as(
|
|
595
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
596
|
+
object_=_response.json(),
|
|
597
|
+
),
|
|
598
|
+
)
|
|
599
|
+
if _response.status_code == 422:
|
|
600
|
+
raise UnprocessableEntityError(
|
|
601
|
+
typing.cast(
|
|
602
|
+
HttpValidationError,
|
|
603
|
+
parse_obj_as(
|
|
604
|
+
type_=HttpValidationError, # type: ignore
|
|
605
|
+
object_=_response.json(),
|
|
606
|
+
),
|
|
607
|
+
)
|
|
608
|
+
)
|
|
609
|
+
_response_json = _response.json()
|
|
610
|
+
except JSONDecodeError:
|
|
611
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
612
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
613
|
+
|
|
535
614
|
def retrieve_variant_logs(
|
|
536
615
|
self,
|
|
537
616
|
variant_id: str,
|
|
@@ -1371,14 +1450,14 @@ class AsyncVariantsClient:
|
|
|
1371
1450
|
Same as POST /config
|
|
1372
1451
|
|
|
1373
1452
|
Args:
|
|
1374
|
-
|
|
1375
|
-
|
|
1453
|
+
payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
|
|
1454
|
+
stoken_session (SessionContainer, optional): Session container. Defaults to result of verify_session().
|
|
1376
1455
|
|
|
1377
1456
|
Raises:
|
|
1378
|
-
|
|
1457
|
+
HTTPException: Raised if the variant could not be added or accessed.
|
|
1379
1458
|
|
|
1380
1459
|
Returns:
|
|
1381
|
-
|
|
1460
|
+
Union[AppVariantResponse, Any]: New variant details or exception.
|
|
1382
1461
|
|
|
1383
1462
|
Parameters
|
|
1384
1463
|
----------
|
|
@@ -1540,16 +1619,16 @@ class AsyncVariantsClient:
|
|
|
1540
1619
|
Start a variant of an app.
|
|
1541
1620
|
|
|
1542
1621
|
Args:
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1622
|
+
variant_id (str): The ID of the variant to start.
|
|
1623
|
+
action (VariantAction): The action to perform on the variant (start).
|
|
1624
|
+
env_vars (Optional[DockerEnvVars], optional): The environment variables to inject to the Docker container. Defaults to None.
|
|
1625
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
1547
1626
|
|
|
1548
1627
|
Returns:
|
|
1549
|
-
|
|
1628
|
+
URI: The URL of the started variant.
|
|
1550
1629
|
|
|
1551
1630
|
Raises:
|
|
1552
|
-
|
|
1631
|
+
HTTPException: If the app container cannot be started.
|
|
1553
1632
|
|
|
1554
1633
|
Parameters
|
|
1555
1634
|
----------
|
|
@@ -1642,10 +1721,10 @@ class AsyncVariantsClient:
|
|
|
1642
1721
|
In the case it's the last variant using the image, stop the container and remove the image.
|
|
1643
1722
|
|
|
1644
1723
|
Arguments:
|
|
1645
|
-
|
|
1724
|
+
app_variant -- AppVariant to remove
|
|
1646
1725
|
|
|
1647
1726
|
Raises:
|
|
1648
|
-
|
|
1727
|
+
HTTPException: If there is a problem removing the app variant
|
|
1649
1728
|
|
|
1650
1729
|
Parameters
|
|
1651
1730
|
----------
|
|
@@ -1719,15 +1798,15 @@ class AsyncVariantsClient:
|
|
|
1719
1798
|
Updates the parameters for an app variant.
|
|
1720
1799
|
|
|
1721
1800
|
Args:
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1801
|
+
variant_id (str): The ID of the app variant to update.
|
|
1802
|
+
payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
|
|
1803
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
1725
1804
|
|
|
1726
1805
|
Raises:
|
|
1727
|
-
|
|
1806
|
+
HTTPException: If there is an error while trying to update the app variant.
|
|
1728
1807
|
|
|
1729
1808
|
Returns:
|
|
1730
|
-
|
|
1809
|
+
JSONResponse: A JSON response containing the updated app variant parameters.
|
|
1731
1810
|
|
|
1732
1811
|
Parameters
|
|
1733
1812
|
----------
|
|
@@ -1815,14 +1894,14 @@ class AsyncVariantsClient:
|
|
|
1815
1894
|
Updates the image used in an app variant.
|
|
1816
1895
|
|
|
1817
1896
|
Args:
|
|
1818
|
-
|
|
1819
|
-
|
|
1897
|
+
variant_id (str): The ID of the app variant to update.
|
|
1898
|
+
image (Image): The image information to update.
|
|
1820
1899
|
|
|
1821
1900
|
Raises:
|
|
1822
|
-
|
|
1901
|
+
HTTPException: If an error occurs while trying to update the app variant.
|
|
1823
1902
|
|
|
1824
1903
|
Returns:
|
|
1825
|
-
|
|
1904
|
+
JSONResponse: A JSON response indicating whether the update was successful or not.
|
|
1826
1905
|
|
|
1827
1906
|
Parameters
|
|
1828
1907
|
----------
|
|
@@ -1905,6 +1984,93 @@ class AsyncVariantsClient:
|
|
|
1905
1984
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1906
1985
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1907
1986
|
|
|
1987
|
+
async def update_variant_url(
|
|
1988
|
+
self,
|
|
1989
|
+
variant_id: str,
|
|
1990
|
+
*,
|
|
1991
|
+
url: str,
|
|
1992
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1993
|
+
) -> typing.Optional[typing.Any]:
|
|
1994
|
+
"""
|
|
1995
|
+
Updates the URL used in an app variant.
|
|
1996
|
+
|
|
1997
|
+
Args:
|
|
1998
|
+
variant_id (str): The ID of the app variant to update.
|
|
1999
|
+
url (str): The URL to update.
|
|
2000
|
+
|
|
2001
|
+
Raises:
|
|
2002
|
+
HTTPException: If an error occurs while trying to update the app variant.
|
|
2003
|
+
|
|
2004
|
+
Returns:
|
|
2005
|
+
JSONResponse: A JSON response indicating whether the update was successful or not.
|
|
2006
|
+
|
|
2007
|
+
Parameters
|
|
2008
|
+
----------
|
|
2009
|
+
variant_id : str
|
|
2010
|
+
|
|
2011
|
+
url : str
|
|
2012
|
+
|
|
2013
|
+
request_options : typing.Optional[RequestOptions]
|
|
2014
|
+
Request-specific configuration.
|
|
2015
|
+
|
|
2016
|
+
Returns
|
|
2017
|
+
-------
|
|
2018
|
+
typing.Optional[typing.Any]
|
|
2019
|
+
Successful Response
|
|
2020
|
+
|
|
2021
|
+
Examples
|
|
2022
|
+
--------
|
|
2023
|
+
import asyncio
|
|
2024
|
+
|
|
2025
|
+
from agenta import AsyncAgentaApi
|
|
2026
|
+
|
|
2027
|
+
client = AsyncAgentaApi(
|
|
2028
|
+
api_key="YOUR_API_KEY",
|
|
2029
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2030
|
+
)
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
async def main() -> None:
|
|
2034
|
+
await client.variants.update_variant_url(
|
|
2035
|
+
variant_id="variant_id",
|
|
2036
|
+
url="url",
|
|
2037
|
+
)
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
asyncio.run(main())
|
|
2041
|
+
"""
|
|
2042
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2043
|
+
f"variants/{jsonable_encoder(variant_id)}/service",
|
|
2044
|
+
method="PUT",
|
|
2045
|
+
params={
|
|
2046
|
+
"url": url,
|
|
2047
|
+
},
|
|
2048
|
+
request_options=request_options,
|
|
2049
|
+
)
|
|
2050
|
+
try:
|
|
2051
|
+
if 200 <= _response.status_code < 300:
|
|
2052
|
+
return typing.cast(
|
|
2053
|
+
typing.Optional[typing.Any],
|
|
2054
|
+
parse_obj_as(
|
|
2055
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2056
|
+
object_=_response.json(),
|
|
2057
|
+
),
|
|
2058
|
+
)
|
|
2059
|
+
if _response.status_code == 422:
|
|
2060
|
+
raise UnprocessableEntityError(
|
|
2061
|
+
typing.cast(
|
|
2062
|
+
HttpValidationError,
|
|
2063
|
+
parse_obj_as(
|
|
2064
|
+
type_=HttpValidationError, # type: ignore
|
|
2065
|
+
object_=_response.json(),
|
|
2066
|
+
),
|
|
2067
|
+
)
|
|
2068
|
+
)
|
|
2069
|
+
_response_json = _response.json()
|
|
2070
|
+
except JSONDecodeError:
|
|
2071
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2072
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2073
|
+
|
|
1908
2074
|
async def retrieve_variant_logs(
|
|
1909
2075
|
self,
|
|
1910
2076
|
variant_id: str,
|
|
@@ -7,8 +7,8 @@ from ..types.secret_response_dto import SecretResponseDto
|
|
|
7
7
|
from ..core.pydantic_utilities import parse_obj_as
|
|
8
8
|
from json.decoder import JSONDecodeError
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
|
-
from ..types.secret_dto import SecretDto
|
|
11
10
|
from ..types.header_dto import HeaderDto
|
|
11
|
+
from ..types.secret_dto import SecretDto
|
|
12
12
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
13
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
14
14
|
from ..types.http_validation_error import HttpValidationError
|
|
@@ -69,16 +69,16 @@ class VaultClient:
|
|
|
69
69
|
def create_secret(
|
|
70
70
|
self,
|
|
71
71
|
*,
|
|
72
|
+
header: HeaderDto,
|
|
72
73
|
secret: SecretDto,
|
|
73
|
-
header: typing.Optional[HeaderDto] = OMIT,
|
|
74
74
|
request_options: typing.Optional[RequestOptions] = None,
|
|
75
75
|
) -> SecretResponseDto:
|
|
76
76
|
"""
|
|
77
77
|
Parameters
|
|
78
78
|
----------
|
|
79
|
-
|
|
79
|
+
header : HeaderDto
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
secret : SecretDto
|
|
82
82
|
|
|
83
83
|
request_options : typing.Optional[RequestOptions]
|
|
84
84
|
Request-specific configuration.
|
|
@@ -90,13 +90,14 @@ class VaultClient:
|
|
|
90
90
|
|
|
91
91
|
Examples
|
|
92
92
|
--------
|
|
93
|
-
from agenta import AgentaApi, ProviderKeyDto, SecretDto
|
|
93
|
+
from agenta import AgentaApi, HeaderDto, ProviderKeyDto, SecretDto
|
|
94
94
|
|
|
95
95
|
client = AgentaApi(
|
|
96
96
|
api_key="YOUR_API_KEY",
|
|
97
97
|
base_url="https://yourhost.com/path/to/api",
|
|
98
98
|
)
|
|
99
99
|
client.vault.create_secret(
|
|
100
|
+
header=HeaderDto(),
|
|
100
101
|
secret=SecretDto(
|
|
101
102
|
data=ProviderKeyDto(
|
|
102
103
|
provider="openai",
|
|
@@ -390,16 +391,16 @@ class AsyncVaultClient:
|
|
|
390
391
|
async def create_secret(
|
|
391
392
|
self,
|
|
392
393
|
*,
|
|
394
|
+
header: HeaderDto,
|
|
393
395
|
secret: SecretDto,
|
|
394
|
-
header: typing.Optional[HeaderDto] = OMIT,
|
|
395
396
|
request_options: typing.Optional[RequestOptions] = None,
|
|
396
397
|
) -> SecretResponseDto:
|
|
397
398
|
"""
|
|
398
399
|
Parameters
|
|
399
400
|
----------
|
|
400
|
-
|
|
401
|
+
header : HeaderDto
|
|
401
402
|
|
|
402
|
-
|
|
403
|
+
secret : SecretDto
|
|
403
404
|
|
|
404
405
|
request_options : typing.Optional[RequestOptions]
|
|
405
406
|
Request-specific configuration.
|
|
@@ -413,7 +414,7 @@ class AsyncVaultClient:
|
|
|
413
414
|
--------
|
|
414
415
|
import asyncio
|
|
415
416
|
|
|
416
|
-
from agenta import AsyncAgentaApi, ProviderKeyDto, SecretDto
|
|
417
|
+
from agenta import AsyncAgentaApi, HeaderDto, ProviderKeyDto, SecretDto
|
|
417
418
|
|
|
418
419
|
client = AsyncAgentaApi(
|
|
419
420
|
api_key="YOUR_API_KEY",
|
|
@@ -423,6 +424,7 @@ class AsyncVaultClient:
|
|
|
423
424
|
|
|
424
425
|
async def main() -> None:
|
|
425
426
|
await client.vault.create_secret(
|
|
427
|
+
header=HeaderDto(),
|
|
426
428
|
secret=SecretDto(
|
|
427
429
|
data=ProviderKeyDto(
|
|
428
430
|
provider="openai",
|
agenta/sdk/__init__.py
CHANGED
|
@@ -26,11 +26,14 @@ from .tracing.conventions import Reference
|
|
|
26
26
|
from .decorators.routing import entrypoint, app, route
|
|
27
27
|
from .agenta_init import Config, AgentaSingleton, init as _init
|
|
28
28
|
from .utils.costs import calculate_token_usage
|
|
29
|
+
from .managers.apps import AppManager
|
|
29
30
|
from .managers.vault import VaultManager
|
|
30
31
|
from .managers.secrets import SecretsManager
|
|
31
32
|
from .managers.config import ConfigManager
|
|
32
33
|
from .managers.variant import VariantManager
|
|
33
34
|
from .managers.deployment import DeploymentManager
|
|
35
|
+
from ..client.exceptions import APIRequestError
|
|
36
|
+
|
|
34
37
|
|
|
35
38
|
config = PreInitObject("agenta.config", Config)
|
|
36
39
|
DEFAULT_AGENTA_SINGLETON_INSTANCE = AgentaSingleton()
|
agenta/sdk/agenta_init.py
CHANGED
|
@@ -74,6 +74,8 @@ class AgentaSingleton:
|
|
|
74
74
|
or "https://cloud.agenta.ai"
|
|
75
75
|
)
|
|
76
76
|
|
|
77
|
+
log.info("Agenta - host: %s", self.host)
|
|
78
|
+
|
|
77
79
|
self.app_id = app_id or config.get("app_id") or getenv("AGENTA_APP_ID")
|
|
78
80
|
# if not self.app_id:
|
|
79
81
|
# raise ValueError(
|
|
@@ -87,7 +89,7 @@ class AgentaSingleton:
|
|
|
87
89
|
|
|
88
90
|
self.base_id = getenv("AGENTA_BASE_ID")
|
|
89
91
|
|
|
90
|
-
self.service_id = getenv("AGENTA_SERVICE_ID") or self.base_id
|
|
92
|
+
self.service_id = getenv("AGENTA_SERVICE_ID") or self.base_id or None
|
|
91
93
|
|
|
92
94
|
log.info("Agenta - Service ID: %s", self.service_id)
|
|
93
95
|
log.info("Agenta - Application ID: %s", self.app_id)
|
agenta/sdk/assets.py
CHANGED
|
@@ -66,10 +66,10 @@ supported_llm_models = {
|
|
|
66
66
|
"openrouter/meta-llama/llama-2-70b-chat",
|
|
67
67
|
],
|
|
68
68
|
"Perplexity AI": [
|
|
69
|
-
"perplexity/
|
|
70
|
-
"perplexity/
|
|
71
|
-
"perplexity/
|
|
72
|
-
"perplexity/
|
|
69
|
+
"perplexity/sonar",
|
|
70
|
+
"perplexity/sonar-pro",
|
|
71
|
+
"perplexity/sonar-reasoning",
|
|
72
|
+
"perplexity/sonar-reasoning-pro",
|
|
73
73
|
],
|
|
74
74
|
"Together AI": [
|
|
75
75
|
"together_ai/togethercomputer/llama-2-70b-chat",
|