judgeval 0.16.0__tar.gz → 0.16.1__tar.gz

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.
Files changed (153) hide show
  1. {judgeval-0.16.0 → judgeval-0.16.1}/PKG-INFO +1 -1
  2. {judgeval-0.16.0 → judgeval-0.16.1}/pyproject.toml +1 -1
  3. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/api/api_types.py +2 -1
  4. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/judgment_types.py +2 -1
  5. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/logger.py +1 -1
  6. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/__init__.py +10 -7
  7. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/keys.py +7 -3
  8. judgeval-0.16.1/src/judgeval/tracer/llm/__init__.py +7 -0
  9. judgeval-0.16.1/src/judgeval/tracer/llm/config.py +110 -0
  10. judgeval-0.16.1/src/judgeval/tracer/llm/constants.py +10 -0
  11. judgeval-0.16.1/src/judgeval/tracer/llm/llm_anthropic/__init__.py +3 -0
  12. judgeval-0.16.1/src/judgeval/tracer/llm/llm_anthropic/wrapper.py +611 -0
  13. judgeval-0.16.1/src/judgeval/tracer/llm/llm_google/__init__.py +0 -0
  14. judgeval-0.16.1/src/judgeval/tracer/llm/llm_google/config.py +24 -0
  15. judgeval-0.16.1/src/judgeval/tracer/llm/llm_google/wrapper.py +426 -0
  16. judgeval-0.16.1/src/judgeval/tracer/llm/llm_groq/__init__.py +0 -0
  17. judgeval-0.16.1/src/judgeval/tracer/llm/llm_groq/config.py +23 -0
  18. judgeval-0.16.1/src/judgeval/tracer/llm/llm_groq/wrapper.py +477 -0
  19. judgeval-0.16.1/src/judgeval/tracer/llm/llm_openai/__init__.py +3 -0
  20. judgeval-0.16.1/src/judgeval/tracer/llm/llm_openai/wrapper.py +637 -0
  21. judgeval-0.16.1/src/judgeval/tracer/llm/llm_together/__init__.py +0 -0
  22. judgeval-0.16.1/src/judgeval/tracer/llm/llm_together/config.py +23 -0
  23. judgeval-0.16.1/src/judgeval/tracer/llm/llm_together/wrapper.py +478 -0
  24. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/llm/providers.py +5 -5
  25. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/processors/__init__.py +1 -1
  26. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/trainer/console.py +1 -1
  27. judgeval-0.16.1/src/judgeval/utils/decorators/__init__.py +0 -0
  28. judgeval-0.16.1/src/judgeval/utils/decorators/dont_throw.py +21 -0
  29. judgeval-0.16.0/src/judgeval/utils/decorators.py → judgeval-0.16.1/src/judgeval/utils/decorators/use_once.py +0 -11
  30. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/meta.py +1 -1
  31. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/version_check.py +1 -1
  32. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/version.py +1 -1
  33. judgeval-0.16.0/src/judgeval/tracer/llm/__init__.py +0 -1264
  34. judgeval-0.16.0/src/judgeval/tracer/llm/google/__init__.py +0 -21
  35. judgeval-0.16.0/src/judgeval/tracer/llm/groq/__init__.py +0 -20
  36. judgeval-0.16.0/src/judgeval/tracer/llm/together/__init__.py +0 -20
  37. {judgeval-0.16.0 → judgeval-0.16.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  38. {judgeval-0.16.0 → judgeval-0.16.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  39. {judgeval-0.16.0 → judgeval-0.16.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  40. {judgeval-0.16.0 → judgeval-0.16.1}/.github/pull_request_template.md +0 -0
  41. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/blocked-pr.yaml +0 -0
  42. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/ci.yaml +0 -0
  43. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/claude-code-review.yml +0 -0
  44. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/claude.yml +0 -0
  45. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/lint.yaml +0 -0
  46. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/merge-branch-check.yaml +0 -0
  47. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/mypy.yaml +0 -0
  48. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/pre-commit-autoupdate.yaml +0 -0
  49. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/release.yaml +0 -0
  50. {judgeval-0.16.0 → judgeval-0.16.1}/.github/workflows/validate-branch.yaml +0 -0
  51. {judgeval-0.16.0 → judgeval-0.16.1}/.gitignore +0 -0
  52. {judgeval-0.16.0 → judgeval-0.16.1}/.pre-commit-config.yaml +0 -0
  53. {judgeval-0.16.0 → judgeval-0.16.1}/CONTRIBUTING.md +0 -0
  54. {judgeval-0.16.0 → judgeval-0.16.1}/LICENSE.md +0 -0
  55. {judgeval-0.16.0 → judgeval-0.16.1}/README.md +0 -0
  56. {judgeval-0.16.0 → judgeval-0.16.1}/assets/Screenshot 2025-05-17 at 8.14.27/342/200/257PM.png" +0 -0
  57. {judgeval-0.16.0 → judgeval-0.16.1}/assets/agent.gif +0 -0
  58. {judgeval-0.16.0 → judgeval-0.16.1}/assets/agent_trace_example.png +0 -0
  59. {judgeval-0.16.0 → judgeval-0.16.1}/assets/brand/company.jpg +0 -0
  60. {judgeval-0.16.0 → judgeval-0.16.1}/assets/brand/company_banner.jpg +0 -0
  61. {judgeval-0.16.0 → judgeval-0.16.1}/assets/brand/darkmode.svg +0 -0
  62. {judgeval-0.16.0 → judgeval-0.16.1}/assets/brand/full_logo.png +0 -0
  63. {judgeval-0.16.0 → judgeval-0.16.1}/assets/brand/icon.png +0 -0
  64. {judgeval-0.16.0 → judgeval-0.16.1}/assets/brand/lightmode.svg +0 -0
  65. {judgeval-0.16.0 → judgeval-0.16.1}/assets/brand/white_background.png +0 -0
  66. {judgeval-0.16.0 → judgeval-0.16.1}/assets/custom_scorer_online_abm.png +0 -0
  67. {judgeval-0.16.0 → judgeval-0.16.1}/assets/data.gif +0 -0
  68. {judgeval-0.16.0 → judgeval-0.16.1}/assets/dataset_clustering_screenshot.png +0 -0
  69. {judgeval-0.16.0 → judgeval-0.16.1}/assets/dataset_clustering_screenshot_dm.png +0 -0
  70. {judgeval-0.16.0 → judgeval-0.16.1}/assets/datasets_preview_screenshot.png +0 -0
  71. {judgeval-0.16.0 → judgeval-0.16.1}/assets/document.gif +0 -0
  72. {judgeval-0.16.0 → judgeval-0.16.1}/assets/error_analysis_dashboard.png +0 -0
  73. {judgeval-0.16.0 → judgeval-0.16.1}/assets/errors.png +0 -0
  74. {judgeval-0.16.0 → judgeval-0.16.1}/assets/experiments_dashboard_screenshot.png +0 -0
  75. {judgeval-0.16.0 → judgeval-0.16.1}/assets/experiments_page.png +0 -0
  76. {judgeval-0.16.0 → judgeval-0.16.1}/assets/experiments_pagev2.png +0 -0
  77. {judgeval-0.16.0 → judgeval-0.16.1}/assets/logo_darkmode.svg +0 -0
  78. {judgeval-0.16.0 → judgeval-0.16.1}/assets/logo_lightmode.svg +0 -0
  79. {judgeval-0.16.0 → judgeval-0.16.1}/assets/monitoring_screenshot.png +0 -0
  80. {judgeval-0.16.0 → judgeval-0.16.1}/assets/online_eval.png +0 -0
  81. {judgeval-0.16.0 → judgeval-0.16.1}/assets/product_shot.png +0 -0
  82. {judgeval-0.16.0 → judgeval-0.16.1}/assets/quickstart_trajectory_ss.png +0 -0
  83. {judgeval-0.16.0 → judgeval-0.16.1}/assets/test.png +0 -0
  84. {judgeval-0.16.0 → judgeval-0.16.1}/assets/tests.png +0 -0
  85. {judgeval-0.16.0 → judgeval-0.16.1}/assets/trace.gif +0 -0
  86. {judgeval-0.16.0 → judgeval-0.16.1}/assets/trace_demo.png +0 -0
  87. {judgeval-0.16.0 → judgeval-0.16.1}/assets/trace_screenshot.png +0 -0
  88. {judgeval-0.16.0 → judgeval-0.16.1}/assets/trace_screenshot_old.png +0 -0
  89. {judgeval-0.16.0 → judgeval-0.16.1}/pytest.ini +0 -0
  90. {judgeval-0.16.0 → judgeval-0.16.1}/scripts/api_generator.py +0 -0
  91. {judgeval-0.16.0 → judgeval-0.16.1}/scripts/openapi_transform.py +0 -0
  92. {judgeval-0.16.0 → judgeval-0.16.1}/scripts/update_types.sh +0 -0
  93. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/__init__.py +0 -0
  94. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/api/__init__.py +0 -0
  95. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/cli.py +0 -0
  96. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/constants.py +0 -0
  97. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/__init__.py +0 -0
  98. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/evaluation_run.py +0 -0
  99. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/example.py +0 -0
  100. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/result.py +0 -0
  101. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/scorer_data.py +0 -0
  102. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/scripts/fix_default_factory.py +0 -0
  103. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/scripts/openapi_transform.py +0 -0
  104. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/data/trace.py +0 -0
  105. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/dataset/__init__.py +0 -0
  106. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/env.py +0 -0
  107. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/evaluation/__init__.py +0 -0
  108. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/exceptions.py +0 -0
  109. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/integrations/langgraph/__init__.py +0 -0
  110. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/integrations/openlit/__init__.py +0 -0
  111. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/judges/__init__.py +0 -0
  112. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/judges/base_judge.py +0 -0
  113. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/judges/litellm_judge.py +0 -0
  114. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/judges/together_judge.py +0 -0
  115. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/judges/utils.py +0 -0
  116. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/__init__.py +0 -0
  117. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/agent_scorer.py +0 -0
  118. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/api_scorer.py +0 -0
  119. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/base_scorer.py +0 -0
  120. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/example_scorer.py +0 -0
  121. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/exceptions.py +0 -0
  122. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/judgeval_scorers/__init__.py +0 -0
  123. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/judgeval_scorers/api_scorers/__init__.py +0 -0
  124. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/judgeval_scorers/api_scorers/answer_correctness.py +0 -0
  125. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/judgeval_scorers/api_scorers/answer_relevancy.py +0 -0
  126. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/judgeval_scorers/api_scorers/faithfulness.py +0 -0
  127. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/judgeval_scorers/api_scorers/instruction_adherence.py +0 -0
  128. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/judgeval_scorers/api_scorers/prompt_scorer.py +0 -0
  129. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/score.py +0 -0
  130. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/scorers/utils.py +0 -0
  131. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/constants.py +0 -0
  132. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/exporters/__init__.py +0 -0
  133. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/exporters/s3.py +0 -0
  134. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/exporters/store.py +0 -0
  135. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/exporters/utils.py +0 -0
  136. /judgeval-0.16.0/src/judgeval/tracer/llm/anthropic/__init__.py → /judgeval-0.16.1/src/judgeval/tracer/llm/llm_anthropic/config.py +0 -0
  137. /judgeval-0.16.0/src/judgeval/tracer/llm/openai/__init__.py → /judgeval-0.16.1/src/judgeval/tracer/llm/llm_openai/config.py +0 -0
  138. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/local_eval_queue.py +0 -0
  139. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/managers.py +0 -0
  140. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/tracer/utils.py +0 -0
  141. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/trainer/__init__.py +0 -0
  142. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/trainer/config.py +0 -0
  143. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/trainer/trainable_model.py +0 -0
  144. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/trainer/trainer.py +0 -0
  145. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/async_utils.py +0 -0
  146. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/file_utils.py +0 -0
  147. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/guards.py +0 -0
  148. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/serialize.py +0 -0
  149. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/testing.py +0 -0
  150. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/utils/url.py +0 -0
  151. {judgeval-0.16.0 → judgeval-0.16.1}/src/judgeval/warnings.py +0 -0
  152. {judgeval-0.16.0 → judgeval-0.16.1}/update_version.py +0 -0
  153. {judgeval-0.16.0 → judgeval-0.16.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: judgeval
3
- Version: 0.16.0
3
+ Version: 0.16.1
4
4
  Summary: Judgeval Package
5
5
  Project-URL: Homepage, https://github.com/JudgmentLabs/judgeval
6
6
  Project-URL: Issues, https://github.com/JudgmentLabs/judgeval/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "judgeval"
3
- version = "0.16.0"
3
+ version = "0.16.1"
4
4
  authors = [
5
5
  { name = "Andrew Li", email = "andrew@judgmentlabs.ai" },
6
6
  { name = "Alex Shan", email = "alex@judgmentlabs.ai" },
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: .openapi.json
3
- # timestamp: 2025-10-07T20:43:52+00:00
3
+ # timestamp: 2025-10-09T00:16:42+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
  from typing import Any, Dict, List, Literal, Optional, TypedDict, Union
@@ -94,6 +94,7 @@ class ResolveProjectNameRequest(TypedDict):
94
94
 
95
95
  class ResolveProjectNameResponse(TypedDict):
96
96
  project_id: str
97
+ project_created: bool
97
98
 
98
99
 
99
100
  class TraceIdRequest(TypedDict):
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: .openapi.json
3
- # timestamp: 2025-10-07T20:43:51+00:00
3
+ # timestamp: 2025-10-09T00:16:41+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
  from typing import Annotated, Any, Dict, List, Optional, Union
@@ -101,6 +101,7 @@ class ResolveProjectNameRequest(BaseModel):
101
101
 
102
102
  class ResolveProjectNameResponse(BaseModel):
103
103
  project_id: Annotated[str, Field(title="Project Id")]
104
+ project_created: Annotated[bool, Field(title="Project Created")]
104
105
 
105
106
 
106
107
  class TraceIdRequest(BaseModel):
@@ -2,7 +2,7 @@ import logging
2
2
  import sys
3
3
 
4
4
  from judgeval.env import JUDGMENT_NO_COLOR
5
- from judgeval.utils.decorators import use_once
5
+ from judgeval.utils.decorators.use_once import use_once
6
6
 
7
7
  RESET = "\033[0m"
8
8
  RED = "\033[31m"
@@ -55,7 +55,7 @@ from judgeval.tracer.managers import (
55
55
  sync_agent_context,
56
56
  async_agent_context,
57
57
  )
58
- from judgeval.utils.decorators import dont_throw
58
+ from judgeval.utils.decorators.dont_throw import dont_throw
59
59
  from judgeval.utils.guards import expect_api_key, expect_organization_id
60
60
  from judgeval.utils.serialize import safe_serialize
61
61
  from judgeval.utils.meta import SingletonMeta
@@ -159,11 +159,14 @@ class Tracer(metaclass=SingletonMeta):
159
159
 
160
160
  self.judgment_processor = NoOpJudgmentSpanProcessor()
161
161
  if self.enable_monitoring:
162
- project_id = Tracer._resolve_project_id(
162
+ project_id, project_created = Tracer._resolve_project_id(
163
163
  self.project_name, self.api_key, self.organization_id
164
- )
165
-
164
+ ) or (None, False)
166
165
  if project_id:
166
+ if project_created:
167
+ judgeval_logger.info(
168
+ f"Project {self.project_name} was autocreated successfully."
169
+ )
167
170
  self.judgment_processor = self.get_processor(
168
171
  tracer=self,
169
172
  project_name=self.project_name,
@@ -179,7 +182,7 @@ class Tracer(metaclass=SingletonMeta):
179
182
  set_tracer_provider(provider)
180
183
  else:
181
184
  judgeval_logger.error(
182
- f"Failed to resolve project {self.project_name}, please create it first at https://app.judgmentlabs.ai/org/{self.organization_id}/projects. Skipping Judgment export."
185
+ f"Failed to resolve or autocreate project {self.project_name}, please create it first at https://app.judgmentlabs.ai/org/{self.organization_id}/projects. Skipping Judgment export."
183
186
  )
184
187
 
185
188
  self.tracer = get_tracer_provider().get_tracer(
@@ -237,14 +240,14 @@ class Tracer(metaclass=SingletonMeta):
237
240
  @staticmethod
238
241
  def _resolve_project_id(
239
242
  project_name: str, api_key: str, organization_id: str
240
- ) -> str | None:
243
+ ) -> Tuple[str, bool]:
241
244
  """Resolve project_id from project_name using the API."""
242
245
  client = JudgmentSyncClient(
243
246
  api_key=api_key,
244
247
  organization_id=organization_id,
245
248
  )
246
249
  response = client.projects_resolve({"project_name": project_name})
247
- return response["project_id"]
250
+ return response["project_id"], response["project_created"]
248
251
 
249
252
  def get_current_span(self):
250
253
  return get_current_span()
@@ -12,6 +12,8 @@ class AttributeKeys(str, Enum):
12
12
  JUDGMENT_OFFLINE_MODE = "judgment.offline_mode"
13
13
  JUDGMENT_UPDATE_ID = "judgment.update_id"
14
14
 
15
+ JUDGMENT_USAGE_METADATA = "judgment.usage.metadata"
16
+
15
17
  JUDGMENT_CUSTOMER_ID = "judgment.customer_id"
16
18
 
17
19
  JUDGMENT_AGENT_ID = "judgment.agent_id"
@@ -31,13 +33,15 @@ class AttributeKeys(str, Enum):
31
33
  GEN_AI_SYSTEM = "gen_ai.system"
32
34
  GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens"
33
35
  GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens"
34
- GEN_AI_USAGE_COMPLETION_TOKENS = "gen_ai.usage.completion_tokens"
36
+ GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS = (
37
+ "gen_ai.usage.cache_creation_input_tokens"
38
+ )
39
+ GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = "gen_ai.usage.cache_read_input_tokens"
40
+
35
41
  GEN_AI_REQUEST_TEMPERATURE = "gen_ai.request.temperature"
36
42
  GEN_AI_REQUEST_MAX_TOKENS = "gen_ai.request.max_tokens"
37
43
  GEN_AI_RESPONSE_FINISH_REASONS = "gen_ai.response.finish_reasons"
38
44
 
39
- GEN_AI_USAGE_TOTAL_COST = "gen_ai.usage.total_cost_usd"
40
-
41
45
 
42
46
  class InternalAttributeKeys(str, Enum):
43
47
  """
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ from .config import _detect_provider, wrap_provider
5
+
6
+
7
+ __all__ = ["_detect_provider", "wrap_provider"]
@@ -0,0 +1,110 @@
1
+ from __future__ import annotations
2
+ from typing import TYPE_CHECKING
3
+ from judgeval.logger import judgeval_logger
4
+
5
+ from judgeval.tracer.llm.constants import ProviderType
6
+ from judgeval.tracer.llm.providers import (
7
+ HAS_OPENAI,
8
+ HAS_TOGETHER,
9
+ HAS_ANTHROPIC,
10
+ HAS_GOOGLE_GENAI,
11
+ HAS_GROQ,
12
+ ApiClient,
13
+ )
14
+
15
+ if TYPE_CHECKING:
16
+ from judgeval.tracer import Tracer
17
+
18
+
19
+ def _detect_provider(client: ApiClient) -> ProviderType:
20
+ if HAS_OPENAI:
21
+ from judgeval.tracer.llm.providers import openai_OpenAI, openai_AsyncOpenAI
22
+
23
+ assert openai_OpenAI is not None, "OpenAI client not found"
24
+ assert openai_AsyncOpenAI is not None, "OpenAI async client not found"
25
+ if isinstance(client, (openai_OpenAI, openai_AsyncOpenAI)):
26
+ return ProviderType.OPENAI
27
+
28
+ if HAS_ANTHROPIC:
29
+ from judgeval.tracer.llm.providers import (
30
+ anthropic_Anthropic,
31
+ anthropic_AsyncAnthropic,
32
+ )
33
+
34
+ assert anthropic_Anthropic is not None, "Anthropic client not found"
35
+ assert anthropic_AsyncAnthropic is not None, "Anthropic async client not found"
36
+ if isinstance(client, (anthropic_Anthropic, anthropic_AsyncAnthropic)):
37
+ return ProviderType.ANTHROPIC
38
+
39
+ if HAS_TOGETHER:
40
+ from judgeval.tracer.llm.providers import (
41
+ together_Together,
42
+ together_AsyncTogether,
43
+ )
44
+
45
+ assert together_Together is not None, "Together client not found"
46
+ assert together_AsyncTogether is not None, "Together async client not found"
47
+ if isinstance(client, (together_Together, together_AsyncTogether)):
48
+ return ProviderType.TOGETHER
49
+
50
+ if HAS_GOOGLE_GENAI:
51
+ from judgeval.tracer.llm.providers import (
52
+ google_genai_Client,
53
+ google_genai_AsyncClient,
54
+ )
55
+
56
+ assert google_genai_Client is not None, "Google GenAI client not found"
57
+ assert google_genai_AsyncClient is not None, (
58
+ "Google GenAI async client not found"
59
+ )
60
+ if isinstance(client, (google_genai_Client, google_genai_AsyncClient)):
61
+ return ProviderType.GOOGLE
62
+
63
+ if HAS_GROQ:
64
+ from judgeval.tracer.llm.providers import groq_Groq, groq_AsyncGroq
65
+
66
+ assert groq_Groq is not None, "Groq client not found"
67
+ assert groq_AsyncGroq is not None, "Groq async client not found"
68
+ if isinstance(client, (groq_Groq, groq_AsyncGroq)):
69
+ return ProviderType.GROQ
70
+
71
+ judgeval_logger.warning(
72
+ f"Unknown client type {type(client)}, Trying to wrap as OpenAI-compatible. "
73
+ "If this is a mistake or you think we should support this client, please file an issue at https://github.com/JudgmentLabs/judgeval/issues!"
74
+ )
75
+
76
+ return ProviderType.DEFAULT
77
+
78
+
79
+ def wrap_provider(tracer: Tracer, client: ApiClient) -> ApiClient:
80
+ """
81
+ Wraps an API client to add tracing capabilities.
82
+ Supports OpenAI, Together, Anthropic, Google GenAI, and Groq clients.
83
+ """
84
+ provider_type = _detect_provider(client)
85
+
86
+ if provider_type == ProviderType.OPENAI:
87
+ from .llm_openai.wrapper import wrap_openai_client
88
+
89
+ return wrap_openai_client(tracer, client)
90
+ elif provider_type == ProviderType.ANTHROPIC:
91
+ from .llm_anthropic.wrapper import wrap_anthropic_client
92
+
93
+ return wrap_anthropic_client(tracer, client)
94
+ elif provider_type == ProviderType.TOGETHER:
95
+ from .llm_together.wrapper import wrap_together_client
96
+
97
+ return wrap_together_client(tracer, client)
98
+ elif provider_type == ProviderType.GOOGLE:
99
+ from .llm_google.wrapper import wrap_google_client
100
+
101
+ return wrap_google_client(tracer, client)
102
+ elif provider_type == ProviderType.GROQ:
103
+ from .llm_groq.wrapper import wrap_groq_client
104
+
105
+ return wrap_groq_client(tracer, client)
106
+ else:
107
+ # Default to OpenAI-compatible wrapping for unknown clients
108
+ from .llm_openai.wrapper import wrap_openai_client
109
+
110
+ return wrap_openai_client(tracer, client)
@@ -0,0 +1,10 @@
1
+ from enum import Enum
2
+
3
+
4
+ class ProviderType(Enum):
5
+ OPENAI = "openai"
6
+ ANTHROPIC = "anthropic"
7
+ TOGETHER = "together"
8
+ GOOGLE = "google"
9
+ GROQ = "groq"
10
+ DEFAULT = "default"
@@ -0,0 +1,3 @@
1
+ from .wrapper import wrap_anthropic_client
2
+
3
+ __all__ = ["wrap_anthropic_client"]