agenta 0.13.0__py3-none-any.whl → 0.13.0a0__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.

Files changed (98) hide show
  1. agenta/__init__.py +0 -1
  2. agenta/client/backend/client.py +50 -169
  3. agenta/client/backend/core/api_error.py +1 -3
  4. agenta/client/backend/core/datetime_utils.py +1 -3
  5. agenta/client/backend/core/jsonable_encoder.py +3 -9
  6. agenta/client/backend/resources/__init__.py +1 -12
  7. agenta/client/backend/resources/apps/__init__.py +1 -0
  8. agenta/client/backend/resources/apps/client.py +26 -88
  9. agenta/client/backend/resources/bases/__init__.py +1 -0
  10. agenta/client/backend/resources/bases/client.py +2 -8
  11. agenta/client/backend/resources/configs/__init__.py +1 -0
  12. agenta/client/backend/resources/configs/client.py +14 -58
  13. agenta/client/backend/resources/containers/client.py +14 -46
  14. agenta/client/backend/resources/environments/__init__.py +1 -0
  15. agenta/client/backend/resources/environments/client.py +6 -18
  16. agenta/client/backend/resources/evaluations/__init__.py +1 -0
  17. agenta/client/backend/resources/evaluations/client.py +26 -86
  18. agenta/client/backend/resources/evaluators/__init__.py +1 -0
  19. agenta/client/backend/resources/evaluators/client.py +17 -57
  20. agenta/client/backend/resources/observability/__init__.py +1 -0
  21. agenta/client/backend/resources/observability/client.py +30 -100
  22. agenta/client/backend/resources/testsets/__init__.py +1 -0
  23. agenta/client/backend/resources/testsets/client.py +16 -56
  24. agenta/client/backend/resources/variants/client.py +26 -92
  25. agenta/client/backend/resources/variants/types/__init__.py +1 -3
  26. agenta/client/backend/types/aggregated_result.py +2 -10
  27. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -3
  28. agenta/client/backend/types/app.py +2 -10
  29. agenta/client/backend/types/app_variant_response.py +2 -10
  30. agenta/client/backend/types/app_variant_revision.py +2 -10
  31. agenta/client/backend/types/base_output.py +2 -10
  32. agenta/client/backend/types/body_import_testset.py +2 -10
  33. agenta/client/backend/types/config_db.py +2 -10
  34. agenta/client/backend/types/create_app_output.py +2 -10
  35. agenta/client/backend/types/create_span.py +2 -11
  36. agenta/client/backend/types/create_trace_response.py +2 -10
  37. agenta/client/backend/types/docker_env_vars.py +2 -10
  38. agenta/client/backend/types/environment_output.py +2 -10
  39. agenta/client/backend/types/environment_output_extended.py +2 -10
  40. agenta/client/backend/types/environment_revision.py +2 -10
  41. agenta/client/backend/types/error.py +2 -10
  42. agenta/client/backend/types/evaluation.py +2 -10
  43. agenta/client/backend/types/evaluation_scenario.py +2 -10
  44. agenta/client/backend/types/evaluation_scenario_input.py +2 -10
  45. agenta/client/backend/types/evaluation_scenario_output.py +2 -10
  46. agenta/client/backend/types/evaluation_scenario_result.py +2 -10
  47. agenta/client/backend/types/evaluation_scenario_score_update.py +2 -10
  48. agenta/client/backend/types/evaluation_type.py +1 -3
  49. agenta/client/backend/types/evaluation_webhook.py +2 -10
  50. agenta/client/backend/types/evaluator.py +2 -10
  51. agenta/client/backend/types/evaluator_config.py +2 -10
  52. agenta/client/backend/types/feedback.py +2 -10
  53. agenta/client/backend/types/get_config_response.py +3 -10
  54. agenta/client/backend/types/http_validation_error.py +2 -10
  55. agenta/client/backend/types/human_evaluation.py +2 -10
  56. agenta/client/backend/types/human_evaluation_scenario.py +2 -10
  57. agenta/client/backend/types/human_evaluation_scenario_input.py +2 -10
  58. agenta/client/backend/types/human_evaluation_scenario_output.py +2 -10
  59. agenta/client/backend/types/human_evaluation_scenario_update.py +2 -10
  60. agenta/client/backend/types/human_evaluation_update.py +2 -10
  61. agenta/client/backend/types/image.py +2 -10
  62. agenta/client/backend/types/invite_request.py +2 -10
  63. agenta/client/backend/types/list_api_keys_response.py +2 -10
  64. agenta/client/backend/types/llm_run_rate_limit.py +2 -10
  65. agenta/client/backend/types/llm_tokens.py +2 -10
  66. agenta/client/backend/types/new_human_evaluation.py +2 -10
  67. agenta/client/backend/types/new_testset.py +2 -10
  68. agenta/client/backend/types/organization.py +2 -10
  69. agenta/client/backend/types/organization_output.py +2 -10
  70. agenta/client/backend/types/result.py +2 -10
  71. agenta/client/backend/types/simple_evaluation_output.py +2 -10
  72. agenta/client/backend/types/span.py +2 -10
  73. agenta/client/backend/types/span_detail.py +2 -10
  74. agenta/client/backend/types/span_variant.py +2 -10
  75. agenta/client/backend/types/template.py +2 -10
  76. agenta/client/backend/types/template_image_info.py +2 -10
  77. agenta/client/backend/types/test_set_output_response.py +2 -10
  78. agenta/client/backend/types/test_set_simple_response.py +2 -10
  79. agenta/client/backend/types/trace_detail.py +2 -10
  80. agenta/client/backend/types/uri.py +2 -10
  81. agenta/client/backend/types/validation_error.py +2 -10
  82. agenta/client/backend/types/variant_action.py +2 -10
  83. agenta/client/backend/types/variant_action_enum.py +1 -3
  84. agenta/client/backend/types/with_pagination.py +2 -10
  85. agenta/client/backend/types/workspace_member_response.py +2 -10
  86. agenta/client/backend/types/workspace_permission.py +2 -10
  87. agenta/client/backend/types/workspace_response.py +2 -10
  88. agenta/client/backend/types/workspace_role_response.py +2 -10
  89. agenta/sdk/__init__.py +0 -1
  90. agenta/sdk/agenta_decorator.py +3 -11
  91. agenta/sdk/agenta_init.py +1 -3
  92. agenta/sdk/tracing/llm_tracing.py +18 -35
  93. agenta/sdk/types.py +0 -38
  94. {agenta-0.13.0.dist-info → agenta-0.13.0a0.dist-info}/METADATA +96 -46
  95. agenta-0.13.0a0.dist-info/RECORD +161 -0
  96. agenta-0.13.0.dist-info/RECORD +0 -161
  97. {agenta-0.13.0.dist-info → agenta-0.13.0a0.dist-info}/WHEEL +0 -0
  98. {agenta-0.13.0.dist-info → agenta-0.13.0a0.dist-info}/entry_points.txt +0 -0
@@ -18,19 +18,11 @@ class Result(pydantic.BaseModel):
18
18
  error: typing.Optional[Error]
19
19
 
20
20
  def json(self, **kwargs: typing.Any) -> str:
21
- kwargs_with_defaults: typing.Any = {
22
- "by_alias": True,
23
- "exclude_unset": True,
24
- **kwargs,
25
- }
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
22
  return super().json(**kwargs_with_defaults)
27
23
 
28
24
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
29
- kwargs_with_defaults: typing.Any = {
30
- "by_alias": True,
31
- "exclude_unset": True,
32
- **kwargs,
33
- }
25
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
34
26
  return super().dict(**kwargs_with_defaults)
35
27
 
36
28
  class Config:
@@ -20,19 +20,11 @@ class SimpleEvaluationOutput(pydantic.BaseModel):
20
20
  evaluation_type: EvaluationType
21
21
 
22
22
  def json(self, **kwargs: typing.Any) -> str:
23
- kwargs_with_defaults: typing.Any = {
24
- "by_alias": True,
25
- "exclude_unset": True,
26
- **kwargs,
27
- }
23
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
28
24
  return super().json(**kwargs_with_defaults)
29
25
 
30
26
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
31
- kwargs_with_defaults: typing.Any = {
32
- "by_alias": True,
33
- "exclude_unset": True,
34
- **kwargs,
35
- }
27
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
36
28
  return super().dict(**kwargs_with_defaults)
37
29
 
38
30
  class Config:
@@ -30,19 +30,11 @@ class Span(pydantic.BaseModel):
30
30
  children: typing.Optional[typing.List[Span]]
31
31
 
32
32
  def json(self, **kwargs: typing.Any) -> str:
33
- kwargs_with_defaults: typing.Any = {
34
- "by_alias": True,
35
- "exclude_unset": True,
36
- **kwargs,
37
- }
33
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
38
34
  return super().json(**kwargs_with_defaults)
39
35
 
40
36
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
41
- kwargs_with_defaults: typing.Any = {
42
- "by_alias": True,
43
- "exclude_unset": True,
44
- **kwargs,
45
- }
37
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
46
38
  return super().dict(**kwargs_with_defaults)
47
39
 
48
40
  class Config:
@@ -31,19 +31,11 @@ class SpanDetail(pydantic.BaseModel):
31
31
  config: typing.Optional[typing.Dict[str, typing.Any]]
32
32
 
33
33
  def json(self, **kwargs: typing.Any) -> str:
34
- kwargs_with_defaults: typing.Any = {
35
- "by_alias": True,
36
- "exclude_unset": True,
37
- **kwargs,
38
- }
34
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
39
35
  return super().json(**kwargs_with_defaults)
40
36
 
41
37
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
42
- kwargs_with_defaults: typing.Any = {
43
- "by_alias": True,
44
- "exclude_unset": True,
45
- **kwargs,
46
- }
38
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
47
39
  return super().dict(**kwargs_with_defaults)
48
40
 
49
41
  class Config:
@@ -17,19 +17,11 @@ class SpanVariant(pydantic.BaseModel):
17
17
  revision: int
18
18
 
19
19
  def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
21
  return super().json(**kwargs_with_defaults)
26
22
 
27
23
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
24
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
33
25
  return super().dict(**kwargs_with_defaults)
34
26
 
35
27
  class Config:
@@ -17,19 +17,11 @@ class Template(pydantic.BaseModel):
17
17
  image: TemplateImageInfo
18
18
 
19
19
  def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
21
  return super().json(**kwargs_with_defaults)
26
22
 
27
23
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
24
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
33
25
  return super().dict(**kwargs_with_defaults)
34
26
 
35
27
  class Config:
@@ -22,19 +22,11 @@ class TemplateImageInfo(pydantic.BaseModel):
22
22
  template_uri: typing.Optional[str]
23
23
 
24
24
  def json(self, **kwargs: typing.Any) -> str:
25
- kwargs_with_defaults: typing.Any = {
26
- "by_alias": True,
27
- "exclude_unset": True,
28
- **kwargs,
29
- }
25
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
30
26
  return super().json(**kwargs_with_defaults)
31
27
 
32
28
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
33
- kwargs_with_defaults: typing.Any = {
34
- "by_alias": True,
35
- "exclude_unset": True,
36
- **kwargs,
37
- }
29
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
38
30
  return super().dict(**kwargs_with_defaults)
39
31
 
40
32
  class Config:
@@ -17,19 +17,11 @@ class TestSetOutputResponse(pydantic.BaseModel):
17
17
  created_at: dt.datetime
18
18
 
19
19
  def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
21
  return super().json(**kwargs_with_defaults)
26
22
 
27
23
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
24
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
33
25
  return super().dict(**kwargs_with_defaults)
34
26
 
35
27
  class Config:
@@ -17,19 +17,11 @@ class TestSetSimpleResponse(pydantic.BaseModel):
17
17
  created_at: str
18
18
 
19
19
  def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
21
  return super().json(**kwargs_with_defaults)
26
22
 
27
23
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
24
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
33
25
  return super().dict(**kwargs_with_defaults)
34
26
 
35
27
  class Config:
@@ -31,19 +31,11 @@ class TraceDetail(pydantic.BaseModel):
31
31
  config: typing.Dict[str, typing.Any]
32
32
 
33
33
  def json(self, **kwargs: typing.Any) -> str:
34
- kwargs_with_defaults: typing.Any = {
35
- "by_alias": True,
36
- "exclude_unset": True,
37
- **kwargs,
38
- }
34
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
39
35
  return super().json(**kwargs_with_defaults)
40
36
 
41
37
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
42
- kwargs_with_defaults: typing.Any = {
43
- "by_alias": True,
44
- "exclude_unset": True,
45
- **kwargs,
46
- }
38
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
47
39
  return super().dict(**kwargs_with_defaults)
48
40
 
49
41
  class Config:
@@ -15,19 +15,11 @@ class Uri(pydantic.BaseModel):
15
15
  uri: str
16
16
 
17
17
  def json(self, **kwargs: typing.Any) -> str:
18
- kwargs_with_defaults: typing.Any = {
19
- "by_alias": True,
20
- "exclude_unset": True,
21
- **kwargs,
22
- }
18
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
23
19
  return super().json(**kwargs_with_defaults)
24
20
 
25
21
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
26
- kwargs_with_defaults: typing.Any = {
27
- "by_alias": True,
28
- "exclude_unset": True,
29
- **kwargs,
30
- }
22
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
31
23
  return super().dict(**kwargs_with_defaults)
32
24
 
33
25
  class Config:
@@ -18,19 +18,11 @@ class ValidationError(pydantic.BaseModel):
18
18
  type: str
19
19
 
20
20
  def json(self, **kwargs: typing.Any) -> str:
21
- kwargs_with_defaults: typing.Any = {
22
- "by_alias": True,
23
- "exclude_unset": True,
24
- **kwargs,
25
- }
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
22
  return super().json(**kwargs_with_defaults)
27
23
 
28
24
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
29
- kwargs_with_defaults: typing.Any = {
30
- "by_alias": True,
31
- "exclude_unset": True,
32
- **kwargs,
33
- }
25
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
34
26
  return super().dict(**kwargs_with_defaults)
35
27
 
36
28
  class Config:
@@ -16,19 +16,11 @@ class VariantAction(pydantic.BaseModel):
16
16
  action: VariantActionEnum
17
17
 
18
18
  def json(self, **kwargs: typing.Any) -> str:
19
- kwargs_with_defaults: typing.Any = {
20
- "by_alias": True,
21
- "exclude_unset": True,
22
- **kwargs,
23
- }
19
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
24
20
  return super().json(**kwargs_with_defaults)
25
21
 
26
22
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
27
- kwargs_with_defaults: typing.Any = {
28
- "by_alias": True,
29
- "exclude_unset": True,
30
- **kwargs,
31
- }
23
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
32
24
  return super().dict(**kwargs_with_defaults)
33
25
 
34
26
  class Config:
@@ -14,9 +14,7 @@ class VariantActionEnum(str, enum.Enum):
14
14
  START = "START"
15
15
  STOP = "STOP"
16
16
 
17
- def visit(
18
- self, start: typing.Callable[[], T_Result], stop: typing.Callable[[], T_Result]
19
- ) -> T_Result:
17
+ def visit(self, start: typing.Callable[[], T_Result], stop: typing.Callable[[], T_Result]) -> T_Result:
20
18
  if self is VariantActionEnum.START:
21
19
  return start()
22
20
  if self is VariantActionEnum.STOP:
@@ -18,19 +18,11 @@ class WithPagination(pydantic.BaseModel):
18
18
  page_size: int = pydantic.Field(alias="pageSize")
19
19
 
20
20
  def json(self, **kwargs: typing.Any) -> str:
21
- kwargs_with_defaults: typing.Any = {
22
- "by_alias": True,
23
- "exclude_unset": True,
24
- **kwargs,
25
- }
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
22
  return super().json(**kwargs_with_defaults)
27
23
 
28
24
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
29
- kwargs_with_defaults: typing.Any = {
30
- "by_alias": True,
31
- "exclude_unset": True,
32
- **kwargs,
33
- }
25
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
34
26
  return super().dict(**kwargs_with_defaults)
35
27
 
36
28
  class Config:
@@ -17,19 +17,11 @@ class WorkspaceMemberResponse(pydantic.BaseModel):
17
17
  roles: typing.List[WorkspacePermission]
18
18
 
19
19
  def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
21
  return super().json(**kwargs_with_defaults)
26
22
 
27
23
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
24
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
33
25
  return super().dict(**kwargs_with_defaults)
34
26
 
35
27
  class Config:
@@ -19,19 +19,11 @@ class WorkspacePermission(pydantic.BaseModel):
19
19
  permissions: typing.Optional[typing.List[Permission]]
20
20
 
21
21
  def json(self, **kwargs: typing.Any) -> str:
22
- kwargs_with_defaults: typing.Any = {
23
- "by_alias": True,
24
- "exclude_unset": True,
25
- **kwargs,
26
- }
22
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
27
23
  return super().json(**kwargs_with_defaults)
28
24
 
29
25
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
30
- kwargs_with_defaults: typing.Any = {
31
- "by_alias": True,
32
- "exclude_unset": True,
33
- **kwargs,
34
- }
26
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
35
27
  return super().dict(**kwargs_with_defaults)
36
28
 
37
29
  class Config:
@@ -23,19 +23,11 @@ class WorkspaceResponse(pydantic.BaseModel):
23
23
  members: typing.Optional[typing.List[WorkspaceMemberResponse]]
24
24
 
25
25
  def json(self, **kwargs: typing.Any) -> str:
26
- kwargs_with_defaults: typing.Any = {
27
- "by_alias": True,
28
- "exclude_unset": True,
29
- **kwargs,
30
- }
26
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
31
27
  return super().json(**kwargs_with_defaults)
32
28
 
33
29
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
34
- kwargs_with_defaults: typing.Any = {
35
- "by_alias": True,
36
- "exclude_unset": True,
37
- **kwargs,
38
- }
30
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
39
31
  return super().dict(**kwargs_with_defaults)
40
32
 
41
33
  class Config:
@@ -17,19 +17,11 @@ class WorkspaceRoleResponse(pydantic.BaseModel):
17
17
  role_description: typing.Optional[str]
18
18
 
19
19
  def json(self, **kwargs: typing.Any) -> str:
20
- kwargs_with_defaults: typing.Any = {
21
- "by_alias": True,
22
- "exclude_unset": True,
23
- **kwargs,
24
- }
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
25
21
  return super().json(**kwargs_with_defaults)
26
22
 
27
23
  def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
28
- kwargs_with_defaults: typing.Any = {
29
- "by_alias": True,
30
- "exclude_unset": True,
31
- **kwargs,
32
- }
24
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
33
25
  return super().dict(**kwargs_with_defaults)
34
26
 
35
27
  class Config:
agenta/sdk/__init__.py CHANGED
@@ -9,7 +9,6 @@ from .types import (
9
9
  InFile,
10
10
  IntParam,
11
11
  MultipleChoiceParam,
12
- GroupedMultipleChoiceParam,
13
12
  TextParam,
14
13
  MessagesInput,
15
14
  FileInputURL,
@@ -25,7 +25,6 @@ from .types import (
25
25
  InFile,
26
26
  IntParam,
27
27
  MultipleChoiceParam,
28
- GroupedMultipleChoiceParam,
29
28
  TextParam,
30
29
  MessagesInput,
31
30
  FileInputURL,
@@ -84,8 +83,7 @@ def entrypoint(func: Callable[..., Any]) -> Callable[..., Any]:
84
83
  tracing.start_parent_span(
85
84
  name=func.__name__,
86
85
  inputs=func_params,
87
- config=config_params,
88
- environment="playground", # type: ignore #NOTE: wrapper is only called in playground
86
+ config=api_config_params,
89
87
  )
90
88
 
91
89
  # Ingest files, prepare configurations and run llm app
@@ -99,6 +97,7 @@ def entrypoint(func: Callable[..., Any]) -> Callable[..., Any]:
99
97
  tracing.end_recording(
100
98
  outputs=llm_result.dict(),
101
99
  span=tracing.active_trace,
100
+ environment="playground", # type: ignore #NOTE: wrapper is only called in playground
102
101
  )
103
102
  return llm_result
104
103
 
@@ -121,7 +120,6 @@ def entrypoint(func: Callable[..., Any]) -> Callable[..., Any]:
121
120
  name=func.__name__,
122
121
  inputs=func_params,
123
122
  config=config,
124
- environment=kwargs["environment"], # type: ignore #NOTE: wrapper is only called in playground
125
123
  )
126
124
 
127
125
  llm_result = await execute_function(
@@ -132,6 +130,7 @@ def entrypoint(func: Callable[..., Any]) -> Callable[..., Any]:
132
130
  tracing.end_recording(
133
131
  outputs=llm_result.dict(),
134
132
  span=tracing.active_trace,
133
+ environment="playground", # type: ignore #NOTE: wrapper is only called in playground
135
134
  )
136
135
  return llm_result
137
136
 
@@ -447,13 +446,6 @@ def override_schema(openapi_schema: dict, func_name: str, endpoint: str, params:
447
446
  f"Body_{func_name}_{endpoint}_post"
448
447
  ]["properties"]
449
448
  for param_name, param_val in params.items():
450
- if isinstance(param_val, GroupedMultipleChoiceParam):
451
- subschema = find_in_schema(schema_to_override, param_name, "grouped_choice")
452
- assert (
453
- subschema
454
- ), f"GroupedMultipleChoiceParam '{param_name}' is in the parameters but could not be found in the openapi.json"
455
- subschema["choices"] = param_val.choices
456
- subschema["default"] = param_val.default
457
449
  if isinstance(param_val, MultipleChoiceParam):
458
450
  subschema = find_in_schema(schema_to_override, param_name, "choice")
459
451
  default = str(param_val)
agenta/sdk/agenta_init.py CHANGED
@@ -90,7 +90,6 @@ class AgentaSingleton:
90
90
  self.host = host
91
91
  self.app_id = os.environ.get("AGENTA_APP_ID") if app_id is None else app_id
92
92
  self.variant_id = os.environ.get("AGENTA_VARIANT_ID")
93
- self.variant_name = os.environ.get("AGENTA_VARIANT_NAME")
94
93
  self.api_key = api_key
95
94
  self.config = Config(base_id=base_id, host=host)
96
95
 
@@ -194,7 +193,7 @@ class Config:
194
193
  + str(ex)
195
194
  )
196
195
  try:
197
- self.set(**{"current_version": config.current_version, **config.parameters})
196
+ self.set(**config.parameters)
198
197
  except Exception as ex:
199
198
  logger.warning("Failed to set the configuration with error: " + str(ex))
200
199
 
@@ -238,7 +237,6 @@ def llm_tracing(max_workers: Optional[int] = None) -> Tracing:
238
237
  base_url=singleton.host,
239
238
  app_id=singleton.app_id, # type: ignore
240
239
  variant_id=singleton.variant_id, # type: ignore
241
- variant_name=singleton.variant_name,
242
240
  api_key=singleton.api_key,
243
241
  max_workers=max_workers,
244
242
  )
@@ -36,7 +36,6 @@ class Tracing(object):
36
36
  base_url: str,
37
37
  app_id: str,
38
38
  variant_id: str,
39
- variant_name: Optional[str] = None,
40
39
  api_key: Optional[str] = None,
41
40
  max_workers: Optional[int] = None,
42
41
  ):
@@ -45,7 +44,6 @@ class Tracing(object):
45
44
  self.llm_logger = llm_logger
46
45
  self.app_id = app_id
47
46
  self.variant_id = variant_id
48
- self.variant_name = variant_name
49
47
  self.tasks_manager = TaskQueue(
50
48
  max_workers if max_workers else 4, logger=llm_logger
51
49
  )
@@ -94,7 +92,7 @@ class Tracing(object):
94
92
  self.tags.extend(tags)
95
93
 
96
94
  def start_parent_span(
97
- self, name: str, inputs: Dict[str, Any], config: Dict[str, Any], **kwargs
95
+ self, name: str, inputs: Dict[str, Any], config: Dict[str, Any]
98
96
  ):
99
97
  trace_id = self._create_trace_id()
100
98
  span_id = self._create_span_id()
@@ -103,11 +101,9 @@ class Tracing(object):
103
101
  id=span_id,
104
102
  app_id=self.app_id,
105
103
  variant_id=self.variant_id,
106
- variant_name=self.variant_name,
107
104
  inputs=inputs,
108
105
  name=name,
109
106
  config=config,
110
- environment=kwargs.get("environment"),
111
107
  spankind=SpanKind.WORKFLOW.value,
112
108
  status=SpanStatusCode.UNSET.value,
113
109
  start_time=datetime.now(timezone.utc),
@@ -115,9 +111,7 @@ class Tracing(object):
115
111
  self.active_trace = span
116
112
  self.recording_trace_id = trace_id
117
113
  self.parent_span_id = span.id
118
- self.llm_logger.info(
119
- f"Recorded active_trace and setting parent_span_id: {span.id}"
120
- )
114
+ self.llm_logger.info(f"Recorded active_trace and parent_span_id: {span.id}")
121
115
 
122
116
  def start_span(
123
117
  self,
@@ -132,11 +126,7 @@ class Tracing(object):
132
126
  id=span_id,
133
127
  inputs=input,
134
128
  name=name,
135
- app_id=self.app_id,
136
- variant_id=self.variant_id,
137
- variant_name=self.variant_name,
138
129
  config=config,
139
- environment=self.active_trace.environment,
140
130
  parent_span_id=self.parent_span_id,
141
131
  spankind=spankind.upper(),
142
132
  attributes={},
@@ -147,9 +137,7 @@ class Tracing(object):
147
137
  self.active_span = span
148
138
  self.span_dict[span.id] = span
149
139
  self.parent_span_id = span.id
150
- self.llm_logger.info(
151
- f"Recorded active_span and setting parent_span_id: {span.id}"
152
- )
140
+ self.llm_logger.info(f"Recorded active_span and parent_span_id: {span.id}")
153
141
  return span
154
142
 
155
143
  def update_span_status(self, span: CreateSpan, value: str):
@@ -162,34 +150,39 @@ class Tracing(object):
162
150
  end_time=datetime.now(timezone.utc),
163
151
  outputs=[outputs["message"]],
164
152
  cost=outputs.get("cost", None),
153
+ environment=kwargs.get("environment"),
165
154
  tokens=outputs.get("usage"),
166
155
  )
167
156
 
168
157
  # Push span to list of recorded spans
169
158
  self.recorded_spans.append(updated_span)
170
- self.llm_logger.info(
171
- f"Pushed {updated_span.spankind} span {updated_span.id} to recorded spans."
172
- )
159
+ self.llm_logger.info(f"Pushed {updated_span.spankind} span {updated_span.id} to recorded spans.")
173
160
 
174
161
  def end_recording(self, outputs: Dict[str, Any], span: CreateSpan, **kwargs):
175
- self.end_span(outputs=outputs, span=span, **kwargs)
176
- if self.api_key == "":
177
- return
178
-
162
+ updated_span = CreateSpan(
163
+ **span.dict(),
164
+ end_time=datetime.now(timezone.utc),
165
+ outputs=[outputs["message"]],
166
+ cost=outputs.get("cost", None),
167
+ environment=kwargs.get("environment"),
168
+ tokens=outputs.get("usage"),
169
+ )
170
+ self.recorded_spans.append(updated_span)
171
+ self.llm_logger.info(
172
+ f"Pushed workflow span {updated_span.id} to recorded spans."
173
+ )
179
174
  self.llm_logger.info(f"Preparing to send recorded spans for processing.")
180
- self.llm_logger.info(f"Recorded spans => {len(self.recorded_spans)}")
181
175
  self.tasks_manager.add_task(
182
176
  self.active_trace.id,
183
177
  "trace",
184
178
  self.client.create_traces(
185
- trace=self.recording_trace_id, spans=self.recorded_spans # type: ignore
179
+ trace=self.recording_trace_id, spans=self.recorded_spans
186
180
  ),
187
181
  self.client,
188
182
  )
189
183
  self.llm_logger.info(
190
184
  f"Tracing for {span.id} recorded successfully and sent for processing."
191
185
  )
192
- self._clear_recorded_spans()
193
186
 
194
187
  def _create_trace_id(self) -> str:
195
188
  """Creates a unique mongo id for the trace object.
@@ -208,13 +201,3 @@ class Tracing(object):
208
201
  """
209
202
 
210
203
  return str(ObjectId())
211
-
212
- def _clear_recorded_spans(self) -> None:
213
- """
214
- Clear the list of recorded spans to prepare for next batch processing.
215
- """
216
-
217
- self.recorded_spans = []
218
- self.llm_logger.info(
219
- f"Cleared all recorded spans from batch: {self.recorded_spans}"
220
- )