agenta 0.33.0a1__py3-none-any.whl → 0.33.0a3__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 +2 -0
- agenta/client/backend/__init__.py +35 -23
- agenta/client/backend/admin/__init__.py +1 -0
- agenta/client/backend/admin/client.py +576 -0
- agenta/client/backend/apps/client.py +384 -2
- agenta/client/backend/client.py +22 -40
- agenta/client/backend/core/http_client.py +3 -3
- agenta/client/backend/evaluations/client.py +0 -6
- agenta/client/backend/human_evaluations/client.py +2 -6
- agenta/client/backend/observability/__init__.py +4 -0
- agenta/client/backend/observability/client.py +221 -744
- agenta/client/backend/testsets/client.py +16 -180
- agenta/client/backend/types/__init__.py +32 -22
- 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 → legacy_scope_request.py} +3 -4
- agenta/client/backend/types/legacy_scopes_response.py +29 -0
- agenta/client/backend/types/{span_variant.py → legacy_user_request.py} +4 -5
- agenta/client/backend/types/{llm_tokens.py → legacy_user_response.py} +2 -4
- agenta/client/backend/types/{with_pagination.py → organization_membership_request.py} +6 -7
- agenta/client/backend/types/organization_request.py +23 -0
- agenta/client/backend/types/permission.py +4 -0
- agenta/client/backend/types/project_membership_request.py +26 -0
- 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 +166 -12
- agenta/client/backend/vault/client.py +11 -9
- agenta/sdk/__init__.py +3 -0
- agenta/sdk/agenta_init.py +3 -1
- agenta/sdk/decorators/routing.py +97 -13
- agenta/sdk/managers/apps.py +64 -0
- agenta/sdk/managers/shared.py +2 -2
- agenta/sdk/middleware/auth.py +156 -57
- agenta/sdk/middleware/config.py +18 -14
- 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-0.33.0a1.dist-info → agenta-0.33.0a3.dist-info}/METADATA +19 -14
- {agenta-0.33.0a1.dist-info → agenta-0.33.0a3.dist-info}/RECORD +55 -48
- 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/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/{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.33.0a1.dist-info → agenta-0.33.0a3.dist-info}/WHEEL +0 -0
- {agenta-0.33.0a1.dist-info → agenta-0.33.0a3.dist-info}/entry_points.txt +0 -0
|
@@ -249,6 +249,7 @@ class AppsClient:
|
|
|
249
249
|
self,
|
|
250
250
|
*,
|
|
251
251
|
app_name: str,
|
|
252
|
+
template_key: typing.Optional[str] = OMIT,
|
|
252
253
|
project_id: typing.Optional[str] = OMIT,
|
|
253
254
|
workspace_id: typing.Optional[str] = OMIT,
|
|
254
255
|
organization_id: typing.Optional[str] = OMIT,
|
|
@@ -271,6 +272,8 @@ class AppsClient:
|
|
|
271
272
|
----------
|
|
272
273
|
app_name : str
|
|
273
274
|
|
|
275
|
+
template_key : typing.Optional[str]
|
|
276
|
+
|
|
274
277
|
project_id : typing.Optional[str]
|
|
275
278
|
|
|
276
279
|
workspace_id : typing.Optional[str]
|
|
@@ -302,6 +305,7 @@ class AppsClient:
|
|
|
302
305
|
method="POST",
|
|
303
306
|
json={
|
|
304
307
|
"app_name": app_name,
|
|
308
|
+
"template_key": template_key,
|
|
305
309
|
"project_id": project_id,
|
|
306
310
|
"workspace_id": workspace_id,
|
|
307
311
|
"organization_id": organization_id,
|
|
@@ -499,7 +503,6 @@ class AppsClient:
|
|
|
499
503
|
Args:
|
|
500
504
|
app_id (str): The ID of the app to add the variant to.
|
|
501
505
|
payload (AddVariantFromImagePayload): The payload containing information about the variant to add.
|
|
502
|
-
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
503
506
|
|
|
504
507
|
Raises:
|
|
505
508
|
HTTPException: If the feature flag is set to "demo" or if the image does not have a tag starting with the registry name (agenta-server) or if the image is not found or if the user does not have access to the app.
|
|
@@ -584,6 +587,186 @@ class AppsClient:
|
|
|
584
587
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
585
588
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
586
589
|
|
|
590
|
+
def add_variant_from_url(
|
|
591
|
+
self,
|
|
592
|
+
app_id: str,
|
|
593
|
+
*,
|
|
594
|
+
variant_name: str,
|
|
595
|
+
url: str,
|
|
596
|
+
base_name: typing.Optional[str] = OMIT,
|
|
597
|
+
config_name: typing.Optional[str] = OMIT,
|
|
598
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
599
|
+
) -> typing.Optional[typing.Any]:
|
|
600
|
+
"""
|
|
601
|
+
Add a new variant to an app based on a URL.
|
|
602
|
+
|
|
603
|
+
Args:
|
|
604
|
+
app_id (str): The ID of the app to add the variant to.
|
|
605
|
+
payload (AddVariantFromURLPayload): The payload containing information about the variant to add.
|
|
606
|
+
|
|
607
|
+
Raises:
|
|
608
|
+
HTTPException: If the user does not have access to the app or if there is an error adding the variant.
|
|
609
|
+
|
|
610
|
+
Returns:
|
|
611
|
+
dict: The newly added variant.
|
|
612
|
+
|
|
613
|
+
Parameters
|
|
614
|
+
----------
|
|
615
|
+
app_id : str
|
|
616
|
+
|
|
617
|
+
variant_name : str
|
|
618
|
+
|
|
619
|
+
url : str
|
|
620
|
+
|
|
621
|
+
base_name : typing.Optional[str]
|
|
622
|
+
|
|
623
|
+
config_name : typing.Optional[str]
|
|
624
|
+
|
|
625
|
+
request_options : typing.Optional[RequestOptions]
|
|
626
|
+
Request-specific configuration.
|
|
627
|
+
|
|
628
|
+
Returns
|
|
629
|
+
-------
|
|
630
|
+
typing.Optional[typing.Any]
|
|
631
|
+
Successful Response
|
|
632
|
+
|
|
633
|
+
Examples
|
|
634
|
+
--------
|
|
635
|
+
from agenta import AgentaApi
|
|
636
|
+
|
|
637
|
+
client = AgentaApi(
|
|
638
|
+
api_key="YOUR_API_KEY",
|
|
639
|
+
base_url="https://yourhost.com/path/to/api",
|
|
640
|
+
)
|
|
641
|
+
client.apps.add_variant_from_url(
|
|
642
|
+
app_id="app_id",
|
|
643
|
+
variant_name="variant_name",
|
|
644
|
+
url="url",
|
|
645
|
+
)
|
|
646
|
+
"""
|
|
647
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
648
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-service",
|
|
649
|
+
method="POST",
|
|
650
|
+
json={
|
|
651
|
+
"variant_name": variant_name,
|
|
652
|
+
"url": url,
|
|
653
|
+
"base_name": base_name,
|
|
654
|
+
"config_name": config_name,
|
|
655
|
+
},
|
|
656
|
+
headers={
|
|
657
|
+
"content-type": "application/json",
|
|
658
|
+
},
|
|
659
|
+
request_options=request_options,
|
|
660
|
+
omit=OMIT,
|
|
661
|
+
)
|
|
662
|
+
try:
|
|
663
|
+
if 200 <= _response.status_code < 300:
|
|
664
|
+
return typing.cast(
|
|
665
|
+
typing.Optional[typing.Any],
|
|
666
|
+
parse_obj_as(
|
|
667
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
668
|
+
object_=_response.json(),
|
|
669
|
+
),
|
|
670
|
+
)
|
|
671
|
+
if _response.status_code == 422:
|
|
672
|
+
raise UnprocessableEntityError(
|
|
673
|
+
typing.cast(
|
|
674
|
+
HttpValidationError,
|
|
675
|
+
parse_obj_as(
|
|
676
|
+
type_=HttpValidationError, # type: ignore
|
|
677
|
+
object_=_response.json(),
|
|
678
|
+
),
|
|
679
|
+
)
|
|
680
|
+
)
|
|
681
|
+
_response_json = _response.json()
|
|
682
|
+
except JSONDecodeError:
|
|
683
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
684
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
685
|
+
|
|
686
|
+
def add_variant_from_key(
|
|
687
|
+
self,
|
|
688
|
+
app_id: str,
|
|
689
|
+
*,
|
|
690
|
+
variant_name: str,
|
|
691
|
+
key: str,
|
|
692
|
+
base_name: typing.Optional[str] = OMIT,
|
|
693
|
+
config_name: typing.Optional[str] = OMIT,
|
|
694
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
695
|
+
) -> typing.Optional[typing.Any]:
|
|
696
|
+
"""
|
|
697
|
+
Parameters
|
|
698
|
+
----------
|
|
699
|
+
app_id : str
|
|
700
|
+
|
|
701
|
+
variant_name : str
|
|
702
|
+
|
|
703
|
+
key : str
|
|
704
|
+
|
|
705
|
+
base_name : typing.Optional[str]
|
|
706
|
+
|
|
707
|
+
config_name : typing.Optional[str]
|
|
708
|
+
|
|
709
|
+
request_options : typing.Optional[RequestOptions]
|
|
710
|
+
Request-specific configuration.
|
|
711
|
+
|
|
712
|
+
Returns
|
|
713
|
+
-------
|
|
714
|
+
typing.Optional[typing.Any]
|
|
715
|
+
Successful Response
|
|
716
|
+
|
|
717
|
+
Examples
|
|
718
|
+
--------
|
|
719
|
+
from agenta import AgentaApi
|
|
720
|
+
|
|
721
|
+
client = AgentaApi(
|
|
722
|
+
api_key="YOUR_API_KEY",
|
|
723
|
+
base_url="https://yourhost.com/path/to/api",
|
|
724
|
+
)
|
|
725
|
+
client.apps.add_variant_from_key(
|
|
726
|
+
app_id="app_id",
|
|
727
|
+
variant_name="variant_name",
|
|
728
|
+
key="key",
|
|
729
|
+
)
|
|
730
|
+
"""
|
|
731
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
732
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-template",
|
|
733
|
+
method="POST",
|
|
734
|
+
json={
|
|
735
|
+
"variant_name": variant_name,
|
|
736
|
+
"key": key,
|
|
737
|
+
"base_name": base_name,
|
|
738
|
+
"config_name": config_name,
|
|
739
|
+
},
|
|
740
|
+
headers={
|
|
741
|
+
"content-type": "application/json",
|
|
742
|
+
},
|
|
743
|
+
request_options=request_options,
|
|
744
|
+
omit=OMIT,
|
|
745
|
+
)
|
|
746
|
+
try:
|
|
747
|
+
if 200 <= _response.status_code < 300:
|
|
748
|
+
return typing.cast(
|
|
749
|
+
typing.Optional[typing.Any],
|
|
750
|
+
parse_obj_as(
|
|
751
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
752
|
+
object_=_response.json(),
|
|
753
|
+
),
|
|
754
|
+
)
|
|
755
|
+
if _response.status_code == 422:
|
|
756
|
+
raise UnprocessableEntityError(
|
|
757
|
+
typing.cast(
|
|
758
|
+
HttpValidationError,
|
|
759
|
+
parse_obj_as(
|
|
760
|
+
type_=HttpValidationError, # type: ignore
|
|
761
|
+
object_=_response.json(),
|
|
762
|
+
),
|
|
763
|
+
)
|
|
764
|
+
)
|
|
765
|
+
_response_json = _response.json()
|
|
766
|
+
except JSONDecodeError:
|
|
767
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
768
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
769
|
+
|
|
587
770
|
def create_app_and_variant_from_template(
|
|
588
771
|
self,
|
|
589
772
|
*,
|
|
@@ -1068,6 +1251,7 @@ class AsyncAppsClient:
|
|
|
1068
1251
|
self,
|
|
1069
1252
|
*,
|
|
1070
1253
|
app_name: str,
|
|
1254
|
+
template_key: typing.Optional[str] = OMIT,
|
|
1071
1255
|
project_id: typing.Optional[str] = OMIT,
|
|
1072
1256
|
workspace_id: typing.Optional[str] = OMIT,
|
|
1073
1257
|
organization_id: typing.Optional[str] = OMIT,
|
|
@@ -1090,6 +1274,8 @@ class AsyncAppsClient:
|
|
|
1090
1274
|
----------
|
|
1091
1275
|
app_name : str
|
|
1092
1276
|
|
|
1277
|
+
template_key : typing.Optional[str]
|
|
1278
|
+
|
|
1093
1279
|
project_id : typing.Optional[str]
|
|
1094
1280
|
|
|
1095
1281
|
workspace_id : typing.Optional[str]
|
|
@@ -1129,6 +1315,7 @@ class AsyncAppsClient:
|
|
|
1129
1315
|
method="POST",
|
|
1130
1316
|
json={
|
|
1131
1317
|
"app_name": app_name,
|
|
1318
|
+
"template_key": template_key,
|
|
1132
1319
|
"project_id": project_id,
|
|
1133
1320
|
"workspace_id": workspace_id,
|
|
1134
1321
|
"organization_id": organization_id,
|
|
@@ -1342,7 +1529,6 @@ class AsyncAppsClient:
|
|
|
1342
1529
|
Args:
|
|
1343
1530
|
app_id (str): The ID of the app to add the variant to.
|
|
1344
1531
|
payload (AddVariantFromImagePayload): The payload containing information about the variant to add.
|
|
1345
|
-
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
1346
1532
|
|
|
1347
1533
|
Raises:
|
|
1348
1534
|
HTTPException: If the feature flag is set to "demo" or if the image does not have a tag starting with the registry name (agenta-server) or if the image is not found or if the user does not have access to the app.
|
|
@@ -1435,6 +1621,202 @@ class AsyncAppsClient:
|
|
|
1435
1621
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1436
1622
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1437
1623
|
|
|
1624
|
+
async def add_variant_from_url(
|
|
1625
|
+
self,
|
|
1626
|
+
app_id: str,
|
|
1627
|
+
*,
|
|
1628
|
+
variant_name: str,
|
|
1629
|
+
url: str,
|
|
1630
|
+
base_name: typing.Optional[str] = OMIT,
|
|
1631
|
+
config_name: typing.Optional[str] = OMIT,
|
|
1632
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1633
|
+
) -> typing.Optional[typing.Any]:
|
|
1634
|
+
"""
|
|
1635
|
+
Add a new variant to an app based on a URL.
|
|
1636
|
+
|
|
1637
|
+
Args:
|
|
1638
|
+
app_id (str): The ID of the app to add the variant to.
|
|
1639
|
+
payload (AddVariantFromURLPayload): The payload containing information about the variant to add.
|
|
1640
|
+
|
|
1641
|
+
Raises:
|
|
1642
|
+
HTTPException: If the user does not have access to the app or if there is an error adding the variant.
|
|
1643
|
+
|
|
1644
|
+
Returns:
|
|
1645
|
+
dict: The newly added variant.
|
|
1646
|
+
|
|
1647
|
+
Parameters
|
|
1648
|
+
----------
|
|
1649
|
+
app_id : str
|
|
1650
|
+
|
|
1651
|
+
variant_name : str
|
|
1652
|
+
|
|
1653
|
+
url : str
|
|
1654
|
+
|
|
1655
|
+
base_name : typing.Optional[str]
|
|
1656
|
+
|
|
1657
|
+
config_name : typing.Optional[str]
|
|
1658
|
+
|
|
1659
|
+
request_options : typing.Optional[RequestOptions]
|
|
1660
|
+
Request-specific configuration.
|
|
1661
|
+
|
|
1662
|
+
Returns
|
|
1663
|
+
-------
|
|
1664
|
+
typing.Optional[typing.Any]
|
|
1665
|
+
Successful Response
|
|
1666
|
+
|
|
1667
|
+
Examples
|
|
1668
|
+
--------
|
|
1669
|
+
import asyncio
|
|
1670
|
+
|
|
1671
|
+
from agenta import AsyncAgentaApi
|
|
1672
|
+
|
|
1673
|
+
client = AsyncAgentaApi(
|
|
1674
|
+
api_key="YOUR_API_KEY",
|
|
1675
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1676
|
+
)
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
async def main() -> None:
|
|
1680
|
+
await client.apps.add_variant_from_url(
|
|
1681
|
+
app_id="app_id",
|
|
1682
|
+
variant_name="variant_name",
|
|
1683
|
+
url="url",
|
|
1684
|
+
)
|
|
1685
|
+
|
|
1686
|
+
|
|
1687
|
+
asyncio.run(main())
|
|
1688
|
+
"""
|
|
1689
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1690
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-service",
|
|
1691
|
+
method="POST",
|
|
1692
|
+
json={
|
|
1693
|
+
"variant_name": variant_name,
|
|
1694
|
+
"url": url,
|
|
1695
|
+
"base_name": base_name,
|
|
1696
|
+
"config_name": config_name,
|
|
1697
|
+
},
|
|
1698
|
+
headers={
|
|
1699
|
+
"content-type": "application/json",
|
|
1700
|
+
},
|
|
1701
|
+
request_options=request_options,
|
|
1702
|
+
omit=OMIT,
|
|
1703
|
+
)
|
|
1704
|
+
try:
|
|
1705
|
+
if 200 <= _response.status_code < 300:
|
|
1706
|
+
return typing.cast(
|
|
1707
|
+
typing.Optional[typing.Any],
|
|
1708
|
+
parse_obj_as(
|
|
1709
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1710
|
+
object_=_response.json(),
|
|
1711
|
+
),
|
|
1712
|
+
)
|
|
1713
|
+
if _response.status_code == 422:
|
|
1714
|
+
raise UnprocessableEntityError(
|
|
1715
|
+
typing.cast(
|
|
1716
|
+
HttpValidationError,
|
|
1717
|
+
parse_obj_as(
|
|
1718
|
+
type_=HttpValidationError, # type: ignore
|
|
1719
|
+
object_=_response.json(),
|
|
1720
|
+
),
|
|
1721
|
+
)
|
|
1722
|
+
)
|
|
1723
|
+
_response_json = _response.json()
|
|
1724
|
+
except JSONDecodeError:
|
|
1725
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1726
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1727
|
+
|
|
1728
|
+
async def add_variant_from_key(
|
|
1729
|
+
self,
|
|
1730
|
+
app_id: str,
|
|
1731
|
+
*,
|
|
1732
|
+
variant_name: str,
|
|
1733
|
+
key: str,
|
|
1734
|
+
base_name: typing.Optional[str] = OMIT,
|
|
1735
|
+
config_name: typing.Optional[str] = OMIT,
|
|
1736
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1737
|
+
) -> typing.Optional[typing.Any]:
|
|
1738
|
+
"""
|
|
1739
|
+
Parameters
|
|
1740
|
+
----------
|
|
1741
|
+
app_id : str
|
|
1742
|
+
|
|
1743
|
+
variant_name : str
|
|
1744
|
+
|
|
1745
|
+
key : str
|
|
1746
|
+
|
|
1747
|
+
base_name : typing.Optional[str]
|
|
1748
|
+
|
|
1749
|
+
config_name : typing.Optional[str]
|
|
1750
|
+
|
|
1751
|
+
request_options : typing.Optional[RequestOptions]
|
|
1752
|
+
Request-specific configuration.
|
|
1753
|
+
|
|
1754
|
+
Returns
|
|
1755
|
+
-------
|
|
1756
|
+
typing.Optional[typing.Any]
|
|
1757
|
+
Successful Response
|
|
1758
|
+
|
|
1759
|
+
Examples
|
|
1760
|
+
--------
|
|
1761
|
+
import asyncio
|
|
1762
|
+
|
|
1763
|
+
from agenta import AsyncAgentaApi
|
|
1764
|
+
|
|
1765
|
+
client = AsyncAgentaApi(
|
|
1766
|
+
api_key="YOUR_API_KEY",
|
|
1767
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1768
|
+
)
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
async def main() -> None:
|
|
1772
|
+
await client.apps.add_variant_from_key(
|
|
1773
|
+
app_id="app_id",
|
|
1774
|
+
variant_name="variant_name",
|
|
1775
|
+
key="key",
|
|
1776
|
+
)
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
asyncio.run(main())
|
|
1780
|
+
"""
|
|
1781
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1782
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-template",
|
|
1783
|
+
method="POST",
|
|
1784
|
+
json={
|
|
1785
|
+
"variant_name": variant_name,
|
|
1786
|
+
"key": key,
|
|
1787
|
+
"base_name": base_name,
|
|
1788
|
+
"config_name": config_name,
|
|
1789
|
+
},
|
|
1790
|
+
headers={
|
|
1791
|
+
"content-type": "application/json",
|
|
1792
|
+
},
|
|
1793
|
+
request_options=request_options,
|
|
1794
|
+
omit=OMIT,
|
|
1795
|
+
)
|
|
1796
|
+
try:
|
|
1797
|
+
if 200 <= _response.status_code < 300:
|
|
1798
|
+
return typing.cast(
|
|
1799
|
+
typing.Optional[typing.Any],
|
|
1800
|
+
parse_obj_as(
|
|
1801
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1802
|
+
object_=_response.json(),
|
|
1803
|
+
),
|
|
1804
|
+
)
|
|
1805
|
+
if _response.status_code == 422:
|
|
1806
|
+
raise UnprocessableEntityError(
|
|
1807
|
+
typing.cast(
|
|
1808
|
+
HttpValidationError,
|
|
1809
|
+
parse_obj_as(
|
|
1810
|
+
type_=HttpValidationError, # type: ignore
|
|
1811
|
+
object_=_response.json(),
|
|
1812
|
+
),
|
|
1813
|
+
)
|
|
1814
|
+
)
|
|
1815
|
+
_response_json = _response.json()
|
|
1816
|
+
except JSONDecodeError:
|
|
1817
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1818
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1819
|
+
|
|
1438
1820
|
async def create_app_and_variant_from_template(
|
|
1439
1821
|
self,
|
|
1440
1822
|
*,
|
agenta/client/backend/client.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
import httpx
|
|
5
5
|
from .core.client_wrapper import SyncClientWrapper
|
|
6
|
-
from .
|
|
6
|
+
from .admin.client import AdminClient
|
|
7
7
|
from .vault.client import VaultClient
|
|
8
8
|
from .access_control.client import AccessControlClient
|
|
9
9
|
from .scopes.client import ScopesClient
|
|
@@ -17,7 +17,7 @@ from .containers.client import ContainersClient
|
|
|
17
17
|
from .environments.client import EnvironmentsClient
|
|
18
18
|
from .bases.client import BasesClient
|
|
19
19
|
from .configs.client import ConfigsClient
|
|
20
|
-
from .
|
|
20
|
+
from .observability.client import ObservabilityClient
|
|
21
21
|
from .core.request_options import RequestOptions
|
|
22
22
|
from .types.list_api_keys_response import ListApiKeysResponse
|
|
23
23
|
from .core.pydantic_utilities import parse_obj_as
|
|
@@ -35,7 +35,7 @@ import datetime as dt
|
|
|
35
35
|
from .types.workspace_role_response import WorkspaceRoleResponse
|
|
36
36
|
from .types.permission import Permission
|
|
37
37
|
from .core.client_wrapper import AsyncClientWrapper
|
|
38
|
-
from .
|
|
38
|
+
from .admin.client import AsyncAdminClient
|
|
39
39
|
from .vault.client import AsyncVaultClient
|
|
40
40
|
from .access_control.client import AsyncAccessControlClient
|
|
41
41
|
from .scopes.client import AsyncScopesClient
|
|
@@ -49,7 +49,7 @@ from .containers.client import AsyncContainersClient
|
|
|
49
49
|
from .environments.client import AsyncEnvironmentsClient
|
|
50
50
|
from .bases.client import AsyncBasesClient
|
|
51
51
|
from .configs.client import AsyncConfigsClient
|
|
52
|
-
from .
|
|
52
|
+
from .observability.client import AsyncObservabilityClient
|
|
53
53
|
|
|
54
54
|
# this is used as the default value for optional parameters
|
|
55
55
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -99,20 +99,16 @@ 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
|
-
|
|
109
|
-
if follow_redirects is not None
|
|
110
|
-
else httpx.Client(timeout=_defaulted_timeout)
|
|
111
|
-
)
|
|
112
|
-
),
|
|
102
|
+
httpx_client=httpx_client
|
|
103
|
+
if httpx_client is not None
|
|
104
|
+
else httpx.Client(
|
|
105
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
106
|
+
)
|
|
107
|
+
if follow_redirects is not None
|
|
108
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
113
109
|
timeout=_defaulted_timeout,
|
|
114
110
|
)
|
|
115
|
-
self.
|
|
111
|
+
self.admin = AdminClient(client_wrapper=self._client_wrapper)
|
|
116
112
|
self.vault = VaultClient(client_wrapper=self._client_wrapper)
|
|
117
113
|
self.access_control = AccessControlClient(client_wrapper=self._client_wrapper)
|
|
118
114
|
self.scopes = ScopesClient(client_wrapper=self._client_wrapper)
|
|
@@ -128,9 +124,7 @@ class AgentaApi:
|
|
|
128
124
|
self.environments = EnvironmentsClient(client_wrapper=self._client_wrapper)
|
|
129
125
|
self.bases = BasesClient(client_wrapper=self._client_wrapper)
|
|
130
126
|
self.configs = ConfigsClient(client_wrapper=self._client_wrapper)
|
|
131
|
-
self.
|
|
132
|
-
client_wrapper=self._client_wrapper
|
|
133
|
-
)
|
|
127
|
+
self.observability = ObservabilityClient(client_wrapper=self._client_wrapper)
|
|
134
128
|
|
|
135
129
|
def list_api_keys(
|
|
136
130
|
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
@@ -315,9 +309,6 @@ class AgentaApi:
|
|
|
315
309
|
"""
|
|
316
310
|
This Function is called by the CLI and is used to validate an API key provided by a user in agenta init setup.
|
|
317
311
|
Returns:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
312
|
bool: True. If the request reaches this point, the API key is valid.
|
|
322
313
|
|
|
323
314
|
Parameters
|
|
@@ -1639,22 +1630,16 @@ class AsyncAgentaApi:
|
|
|
1639
1630
|
self._client_wrapper = AsyncClientWrapper(
|
|
1640
1631
|
base_url=base_url,
|
|
1641
1632
|
api_key=api_key,
|
|
1642
|
-
httpx_client=
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
if follow_redirects is not None
|
|
1650
|
-
else httpx.AsyncClient(timeout=_defaulted_timeout)
|
|
1651
|
-
)
|
|
1652
|
-
),
|
|
1633
|
+
httpx_client=httpx_client
|
|
1634
|
+
if httpx_client is not None
|
|
1635
|
+
else httpx.AsyncClient(
|
|
1636
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
1637
|
+
)
|
|
1638
|
+
if follow_redirects is not None
|
|
1639
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
1653
1640
|
timeout=_defaulted_timeout,
|
|
1654
1641
|
)
|
|
1655
|
-
self.
|
|
1656
|
-
client_wrapper=self._client_wrapper
|
|
1657
|
-
)
|
|
1642
|
+
self.admin = AsyncAdminClient(client_wrapper=self._client_wrapper)
|
|
1658
1643
|
self.vault = AsyncVaultClient(client_wrapper=self._client_wrapper)
|
|
1659
1644
|
self.access_control = AsyncAccessControlClient(
|
|
1660
1645
|
client_wrapper=self._client_wrapper
|
|
@@ -1672,7 +1657,7 @@ class AsyncAgentaApi:
|
|
|
1672
1657
|
self.environments = AsyncEnvironmentsClient(client_wrapper=self._client_wrapper)
|
|
1673
1658
|
self.bases = AsyncBasesClient(client_wrapper=self._client_wrapper)
|
|
1674
1659
|
self.configs = AsyncConfigsClient(client_wrapper=self._client_wrapper)
|
|
1675
|
-
self.
|
|
1660
|
+
self.observability = AsyncObservabilityClient(
|
|
1676
1661
|
client_wrapper=self._client_wrapper
|
|
1677
1662
|
)
|
|
1678
1663
|
|
|
@@ -1883,9 +1868,6 @@ class AsyncAgentaApi:
|
|
|
1883
1868
|
"""
|
|
1884
1869
|
This Function is called by the CLI and is used to validate an API key provided by a user in agenta init setup.
|
|
1885
1870
|
Returns:
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
1871
|
bool: True. If the request reaches this point, the API key is valid.
|
|
1890
1872
|
|
|
1891
1873
|
Parameters
|
|
@@ -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 (
|
|
152
|
+
json_body if json_body != {} else None
|
|
153
|
+
), data_body if data_body != {} else None
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
class HttpClient:
|
|
@@ -326,9 +326,6 @@ class EvaluationsClient:
|
|
|
326
326
|
json={
|
|
327
327
|
"evaluations_ids": evaluations_ids,
|
|
328
328
|
},
|
|
329
|
-
headers={
|
|
330
|
-
"content-type": "application/json",
|
|
331
|
-
},
|
|
332
329
|
request_options=request_options,
|
|
333
330
|
omit=OMIT,
|
|
334
331
|
)
|
|
@@ -1047,9 +1044,6 @@ class AsyncEvaluationsClient:
|
|
|
1047
1044
|
json={
|
|
1048
1045
|
"evaluations_ids": evaluations_ids,
|
|
1049
1046
|
},
|
|
1050
|
-
headers={
|
|
1051
|
-
"content-type": "application/json",
|
|
1052
|
-
},
|
|
1053
1047
|
request_options=request_options,
|
|
1054
1048
|
omit=OMIT,
|
|
1055
1049
|
)
|
|
@@ -556,9 +556,7 @@ class HumanEvaluationsClient:
|
|
|
556
556
|
method="PUT",
|
|
557
557
|
json={
|
|
558
558
|
"vote": vote,
|
|
559
|
-
"score":
|
|
560
|
-
object_=score, annotation=Score, direction="write"
|
|
561
|
-
),
|
|
559
|
+
"score": score,
|
|
562
560
|
"correct_answer": correct_answer,
|
|
563
561
|
"outputs": convert_and_respect_annotation_metadata(
|
|
564
562
|
object_=outputs,
|
|
@@ -1408,9 +1406,7 @@ class AsyncHumanEvaluationsClient:
|
|
|
1408
1406
|
method="PUT",
|
|
1409
1407
|
json={
|
|
1410
1408
|
"vote": vote,
|
|
1411
|
-
"score":
|
|
1412
|
-
object_=score, annotation=Score, direction="write"
|
|
1413
|
-
),
|
|
1409
|
+
"score": score,
|
|
1414
1410
|
"correct_answer": correct_answer,
|
|
1415
1411
|
"outputs": convert_and_respect_annotation_metadata(
|
|
1416
1412
|
object_=outputs,
|