deeprails 1.4.1__tar.gz → 1.6.0__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 (86) hide show
  1. deeprails-1.6.0/.release-please-manifest.json +3 -0
  2. {deeprails-1.4.1 → deeprails-1.6.0}/CHANGELOG.md +16 -0
  3. {deeprails-1.4.1 → deeprails-1.6.0}/PKG-INFO +9 -9
  4. {deeprails-1.4.1 → deeprails-1.6.0}/README.md +8 -8
  5. {deeprails-1.4.1 → deeprails-1.6.0}/pyproject.toml +1 -1
  6. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_version.py +1 -1
  7. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/resources/defend.py +6 -6
  8. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/resources/evaluate.py +6 -6
  9. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/resources/monitor.py +6 -6
  10. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/defend_submit_event_params.py +10 -9
  11. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/evaluate_create_params.py +11 -9
  12. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/evaluation.py +9 -18
  13. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/monitor_submit_event_params.py +11 -9
  14. {deeprails-1.4.1 → deeprails-1.6.0}/tests/api_resources/test_defend.py +12 -10
  15. {deeprails-1.4.1 → deeprails-1.6.0}/tests/api_resources/test_evaluate.py +10 -8
  16. {deeprails-1.4.1 → deeprails-1.6.0}/tests/api_resources/test_monitor.py +12 -10
  17. deeprails-1.4.1/.release-please-manifest.json +0 -3
  18. {deeprails-1.4.1 → deeprails-1.6.0}/.gitignore +0 -0
  19. {deeprails-1.4.1 → deeprails-1.6.0}/CONTRIBUTING.md +0 -0
  20. {deeprails-1.4.1 → deeprails-1.6.0}/LICENSE +0 -0
  21. {deeprails-1.4.1 → deeprails-1.6.0}/SECURITY.md +0 -0
  22. {deeprails-1.4.1 → deeprails-1.6.0}/api.md +0 -0
  23. {deeprails-1.4.1 → deeprails-1.6.0}/bin/check-release-environment +0 -0
  24. {deeprails-1.4.1 → deeprails-1.6.0}/bin/publish-pypi +0 -0
  25. {deeprails-1.4.1 → deeprails-1.6.0}/examples/.keep +0 -0
  26. {deeprails-1.4.1 → deeprails-1.6.0}/noxfile.py +0 -0
  27. {deeprails-1.4.1 → deeprails-1.6.0}/release-please-config.json +0 -0
  28. {deeprails-1.4.1 → deeprails-1.6.0}/requirements-dev.lock +0 -0
  29. {deeprails-1.4.1 → deeprails-1.6.0}/requirements.lock +0 -0
  30. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/__init__.py +0 -0
  31. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_base_client.py +0 -0
  32. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_client.py +0 -0
  33. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_compat.py +0 -0
  34. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_constants.py +0 -0
  35. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_exceptions.py +0 -0
  36. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_files.py +0 -0
  37. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_models.py +0 -0
  38. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_qs.py +0 -0
  39. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_resource.py +0 -0
  40. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_response.py +0 -0
  41. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_streaming.py +0 -0
  42. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_types.py +0 -0
  43. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/__init__.py +0 -0
  44. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_compat.py +0 -0
  45. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_datetime_parse.py +0 -0
  46. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_logs.py +0 -0
  47. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_proxy.py +0 -0
  48. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_reflection.py +0 -0
  49. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_resources_proxy.py +0 -0
  50. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_streams.py +0 -0
  51. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_sync.py +0 -0
  52. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_transform.py +0 -0
  53. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_typing.py +0 -0
  54. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/_utils/_utils.py +0 -0
  55. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/lib/.keep +0 -0
  56. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/py.typed +0 -0
  57. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/resources/__init__.py +0 -0
  58. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/__init__.py +0 -0
  59. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/api_response.py +0 -0
  60. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/defend_create_workflow_params.py +0 -0
  61. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/defend_response.py +0 -0
  62. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/defend_update_workflow_params.py +0 -0
  63. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/monitor_create_params.py +0 -0
  64. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/monitor_retrieve_params.py +0 -0
  65. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/monitor_retrieve_response.py +0 -0
  66. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/monitor_submit_event_response.py +0 -0
  67. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/monitor_update_params.py +0 -0
  68. {deeprails-1.4.1 → deeprails-1.6.0}/src/deeprails/types/workflow_event_response.py +0 -0
  69. {deeprails-1.4.1 → deeprails-1.6.0}/tests/__init__.py +0 -0
  70. {deeprails-1.4.1 → deeprails-1.6.0}/tests/api_resources/__init__.py +0 -0
  71. {deeprails-1.4.1 → deeprails-1.6.0}/tests/conftest.py +0 -0
  72. {deeprails-1.4.1 → deeprails-1.6.0}/tests/sample_file.txt +0 -0
  73. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_client.py +0 -0
  74. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_deepcopy.py +0 -0
  75. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_extract_files.py +0 -0
  76. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_files.py +0 -0
  77. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_models.py +0 -0
  78. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_qs.py +0 -0
  79. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_required_args.py +0 -0
  80. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_response.py +0 -0
  81. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_streaming.py +0 -0
  82. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_transform.py +0 -0
  83. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_utils/test_datetime_parse.py +0 -0
  84. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_utils/test_proxy.py +0 -0
  85. {deeprails-1.4.1 → deeprails-1.6.0}/tests/test_utils/test_typing.py +0 -0
  86. {deeprails-1.4.1 → deeprails-1.6.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.6.0"
3
+ }
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0 (2025-10-20)
4
+
5
+ Full Changelog: [v1.5.0...v1.6.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.5.0...v1.6.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** readme example update ([412839e](https://github.com/deeprails/deeprails-sdk-python/commit/412839e484bcc4b216b88ea3f22849dc9355b643))
10
+
11
+ ## 1.5.0 (2025-10-16)
12
+
13
+ Full Changelog: [v1.4.1...v1.5.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.4.1...v1.5.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** adding support for system_prompt and ground_truth ([be4cd74](https://github.com/deeprails/deeprails-sdk-python/commit/be4cd74a118dc1e4b1ef90f25f311a0862807176))
18
+
3
19
  ## 1.4.1 (2025-10-11)
4
20
 
5
21
  Full Changelog: [v1.4.0...v1.4.1](https://github.com/deeprails/deeprails-sdk-python/compare/v1.4.0...v1.4.1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: deeprails
3
- Version: 1.4.1
3
+ Version: 1.6.0
4
4
  Summary: The official Python library for the deeprails API
5
5
  Project-URL: Homepage, https://docs.deeprails.com/
6
6
  Project-URL: Repository, https://github.com/deeprails/deeprails-sdk-python
@@ -68,7 +68,7 @@ client = Deeprails(
68
68
  defend_response = client.defend.create_workflow(
69
69
  improvement_action="fixit",
70
70
  metrics={
71
- "completeness": 0.8,
71
+ "completeness": 0.7,
72
72
  "instruction_adherence": 0.75,
73
73
  },
74
74
  name="Push Alert Workflow",
@@ -100,7 +100,7 @@ async def main() -> None:
100
100
  defend_response = await client.defend.create_workflow(
101
101
  improvement_action="fixit",
102
102
  metrics={
103
- "completeness": 0.8,
103
+ "completeness": 0.7,
104
104
  "instruction_adherence": 0.75,
105
105
  },
106
106
  name="Push Alert Workflow",
@@ -141,7 +141,7 @@ async def main() -> None:
141
141
  defend_response = await client.defend.create_workflow(
142
142
  improvement_action="fixit",
143
143
  metrics={
144
- "completeness": 0.8,
144
+ "completeness": 0.7,
145
145
  "instruction_adherence": 0.75,
146
146
  },
147
147
  name="Push Alert Workflow",
@@ -200,7 +200,7 @@ try:
200
200
  client.defend.create_workflow(
201
201
  improvement_action="fixit",
202
202
  metrics={
203
- "completeness": 0.8,
203
+ "completeness": 0.7,
204
204
  "instruction_adherence": 0.75,
205
205
  },
206
206
  name="Push Alert Workflow",
@@ -251,7 +251,7 @@ client = Deeprails(
251
251
  client.with_options(max_retries=5).defend.create_workflow(
252
252
  improvement_action="fixit",
253
253
  metrics={
254
- "completeness": 0.8,
254
+ "completeness": 0.7,
255
255
  "instruction_adherence": 0.75,
256
256
  },
257
257
  name="Push Alert Workflow",
@@ -282,7 +282,7 @@ client = Deeprails(
282
282
  client.with_options(timeout=5.0).defend.create_workflow(
283
283
  improvement_action="fixit",
284
284
  metrics={
285
- "completeness": 0.8,
285
+ "completeness": 0.7,
286
286
  "instruction_adherence": 0.75,
287
287
  },
288
288
  name="Push Alert Workflow",
@@ -331,7 +331,7 @@ client = Deeprails()
331
331
  response = client.defend.with_raw_response.create_workflow(
332
332
  improvement_action="fixit",
333
333
  metrics={
334
- "completeness": 0.8,
334
+ "completeness": 0.7,
335
335
  "instruction_adherence": 0.75,
336
336
  },
337
337
  name="Push Alert Workflow",
@@ -357,7 +357,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
357
357
  with client.defend.with_streaming_response.create_workflow(
358
358
  improvement_action="fixit",
359
359
  metrics={
360
- "completeness": 0.8,
360
+ "completeness": 0.7,
361
361
  "instruction_adherence": 0.75,
362
362
  },
363
363
  name="Push Alert Workflow",
@@ -33,7 +33,7 @@ client = Deeprails(
33
33
  defend_response = client.defend.create_workflow(
34
34
  improvement_action="fixit",
35
35
  metrics={
36
- "completeness": 0.8,
36
+ "completeness": 0.7,
37
37
  "instruction_adherence": 0.75,
38
38
  },
39
39
  name="Push Alert Workflow",
@@ -65,7 +65,7 @@ async def main() -> None:
65
65
  defend_response = await client.defend.create_workflow(
66
66
  improvement_action="fixit",
67
67
  metrics={
68
- "completeness": 0.8,
68
+ "completeness": 0.7,
69
69
  "instruction_adherence": 0.75,
70
70
  },
71
71
  name="Push Alert Workflow",
@@ -106,7 +106,7 @@ async def main() -> None:
106
106
  defend_response = await client.defend.create_workflow(
107
107
  improvement_action="fixit",
108
108
  metrics={
109
- "completeness": 0.8,
109
+ "completeness": 0.7,
110
110
  "instruction_adherence": 0.75,
111
111
  },
112
112
  name="Push Alert Workflow",
@@ -165,7 +165,7 @@ try:
165
165
  client.defend.create_workflow(
166
166
  improvement_action="fixit",
167
167
  metrics={
168
- "completeness": 0.8,
168
+ "completeness": 0.7,
169
169
  "instruction_adherence": 0.75,
170
170
  },
171
171
  name="Push Alert Workflow",
@@ -216,7 +216,7 @@ client = Deeprails(
216
216
  client.with_options(max_retries=5).defend.create_workflow(
217
217
  improvement_action="fixit",
218
218
  metrics={
219
- "completeness": 0.8,
219
+ "completeness": 0.7,
220
220
  "instruction_adherence": 0.75,
221
221
  },
222
222
  name="Push Alert Workflow",
@@ -247,7 +247,7 @@ client = Deeprails(
247
247
  client.with_options(timeout=5.0).defend.create_workflow(
248
248
  improvement_action="fixit",
249
249
  metrics={
250
- "completeness": 0.8,
250
+ "completeness": 0.7,
251
251
  "instruction_adherence": 0.75,
252
252
  },
253
253
  name="Push Alert Workflow",
@@ -296,7 +296,7 @@ client = Deeprails()
296
296
  response = client.defend.with_raw_response.create_workflow(
297
297
  improvement_action="fixit",
298
298
  metrics={
299
- "completeness": 0.8,
299
+ "completeness": 0.7,
300
300
  "instruction_adherence": 0.75,
301
301
  },
302
302
  name="Push Alert Workflow",
@@ -322,7 +322,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
322
322
  with client.defend.with_streaming_response.create_workflow(
323
323
  improvement_action="fixit",
324
324
  metrics={
325
- "completeness": 0.8,
325
+ "completeness": 0.7,
326
326
  "instruction_adherence": 0.75,
327
327
  },
328
328
  name="Push Alert Workflow",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "deeprails"
3
- version = "1.4.1"
3
+ version = "1.6.0"
4
4
  description = "The official Python library for the deeprails API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "deeprails"
4
- __version__ = "1.4.1" # x-release-please-version
4
+ __version__ = "1.6.0" # x-release-please-version
@@ -213,9 +213,9 @@ class DefendResource(SyncAPIResource):
213
213
  evaluation
214
214
 
215
215
  Args:
216
- model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
217
- `user_prompt` field and an optional `context` field. Additional properties are
218
- allowed.
216
+ model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
217
+ contain at least one of `user_prompt` or `system_prompt`. For
218
+ ground_truth_aherence guadrail metric, `ground_truth` should be provided.
219
219
 
220
220
  model_output: Output generated by the LLM to be evaluated.
221
221
 
@@ -491,9 +491,9 @@ class AsyncDefendResource(AsyncAPIResource):
491
491
  evaluation
492
492
 
493
493
  Args:
494
- model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
495
- `user_prompt` field and an optional `context` field. Additional properties are
496
- allowed.
494
+ model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
495
+ contain at least one of `user_prompt` or `system_prompt`. For
496
+ ground_truth_aherence guadrail metric, `ground_truth` should be provided.
497
497
 
498
498
  model_output: Output generated by the LLM to be evaluated.
499
499
 
@@ -75,9 +75,9 @@ class EvaluateResource(SyncAPIResource):
75
75
  guardrail metrics
76
76
 
77
77
  Args:
78
- model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
79
- `user_prompt` field and an optional `context` field. Additional properties are
80
- allowed.
78
+ model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
79
+ contain at least one of `user_prompt` or `system_prompt`. For
80
+ ground_truth_aherence guadrail metric, `ground_truth` should be provided.
81
81
 
82
82
  model_output: Output generated by the LLM to be evaluated.
83
83
 
@@ -206,9 +206,9 @@ class AsyncEvaluateResource(AsyncAPIResource):
206
206
  guardrail metrics
207
207
 
208
208
  Args:
209
- model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
210
- `user_prompt` field and an optional `context` field. Additional properties are
211
- allowed.
209
+ model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
210
+ contain at least one of `user_prompt` or `system_prompt`. For
211
+ ground_truth_aherence guadrail metric, `ground_truth` should be provided.
212
212
 
213
213
  model_output: Output generated by the LLM to be evaluated.
214
214
 
@@ -219,9 +219,9 @@ class MonitorResource(SyncAPIResource):
219
219
  `completeness`, `instruction_adherence`, `context_adherence`,
220
220
  `ground_truth_adherence`, and/or `comprehensive_safety`.
221
221
 
222
- model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
223
- `user_prompt` field and an optional `context` field. Additional properties are
224
- allowed.
222
+ model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
223
+ contain at least one of `user_prompt` or `system_prompt`. For
224
+ ground_truth_aherence guadrail metric, `ground_truth` should be provided.
225
225
 
226
226
  model_output: Output generated by the LLM to be evaluated.
227
227
 
@@ -457,9 +457,9 @@ class AsyncMonitorResource(AsyncAPIResource):
457
457
  `completeness`, `instruction_adherence`, `context_adherence`,
458
458
  `ground_truth_adherence`, and/or `comprehensive_safety`.
459
459
 
460
- model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
461
- `user_prompt` field and an optional `context` field. Additional properties are
462
- allowed.
460
+ model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
461
+ contain at least one of `user_prompt` or `system_prompt`. For
462
+ ground_truth_aherence guadrail metric, `ground_truth` should be provided.
463
463
 
464
464
  model_output: Output generated by the LLM to be evaluated.
465
465
 
@@ -2,8 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Union
6
- from typing_extensions import Literal, Required, TypeAlias, TypedDict
5
+ from typing_extensions import Literal, Required, TypedDict
7
6
 
8
7
  __all__ = ["DefendSubmitEventParams", "ModelInput"]
9
8
 
@@ -12,8 +11,8 @@ class DefendSubmitEventParams(TypedDict, total=False):
12
11
  model_input: Required[ModelInput]
13
12
  """A dictionary of inputs sent to the LLM to generate output.
14
13
 
15
- This must contain a `user_prompt` field and an optional `context` field.
16
- Additional properties are allowed.
14
+ The dictionary must contain at least one of `user_prompt` or `system_prompt`.
15
+ For ground_truth_aherence guadrail metric, `ground_truth` should be provided.
17
16
  """
18
17
 
19
18
  model_output: Required[str]
@@ -35,10 +34,12 @@ class DefendSubmitEventParams(TypedDict, total=False):
35
34
  """An optional, user-defined tag for the event."""
36
35
 
37
36
 
38
- class ModelInputTyped(TypedDict, total=False):
39
- user_prompt: Required[str]
37
+ class ModelInput(TypedDict, total=False):
38
+ ground_truth: str
39
+ """The ground truth for evaluating Ground Truth Adherence guardrail."""
40
40
 
41
- context: str
41
+ system_prompt: str
42
+ """The system prompt used to generate the output."""
42
43
 
43
-
44
- ModelInput: TypeAlias = Union[ModelInputTyped, Dict[str, object]]
44
+ user_prompt: str
45
+ """The user prompt used to generate the output."""
@@ -2,8 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union
6
- from typing_extensions import Literal, Required, TypeAlias, TypedDict
5
+ from typing import List
6
+ from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  __all__ = ["EvaluateCreateParams", "ModelInput"]
9
9
 
@@ -12,8 +12,8 @@ class EvaluateCreateParams(TypedDict, total=False):
12
12
  model_input: Required[ModelInput]
13
13
  """A dictionary of inputs sent to the LLM to generate output.
14
14
 
15
- This must contain a `user_prompt` field and an optional `context` field.
16
- Additional properties are allowed.
15
+ The dictionary must contain at least one of `user_prompt` or `system_prompt`.
16
+ For ground_truth_aherence guadrail metric, `ground_truth` should be provided.
17
17
  """
18
18
 
19
19
  model_output: Required[str]
@@ -51,10 +51,12 @@ class EvaluateCreateParams(TypedDict, total=False):
51
51
  """An optional, user-defined tag for the evaluation."""
52
52
 
53
53
 
54
- class ModelInputTyped(TypedDict, total=False):
55
- user_prompt: Required[str]
54
+ class ModelInput(TypedDict, total=False):
55
+ ground_truth: str
56
+ """The ground truth for evaluating Ground Truth Adherence guardrail."""
56
57
 
57
- context: str
58
+ system_prompt: str
59
+ """The system prompt used to generate the output."""
58
60
 
59
-
60
- ModelInput: TypeAlias = Union[ModelInputTyped, Dict[str, object]]
61
+ user_prompt: str
62
+ """The user prompt used to generate the output."""
@@ -1,6 +1,6 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- from typing import TYPE_CHECKING, Dict, List, Optional
3
+ from typing import Dict, List, Optional
4
4
  from datetime import datetime
5
5
  from typing_extensions import Literal
6
6
 
@@ -12,23 +12,14 @@ __all__ = ["Evaluation", "ModelInput"]
12
12
 
13
13
 
14
14
  class ModelInput(BaseModel):
15
- user_prompt: str
16
- """The user prompt used to generate the output."""
17
-
18
- context: Optional[str] = None
19
- """Optional context supplied to the LLM when generating the output."""
15
+ ground_truth: Optional[str] = None
16
+ """The ground truth for evaluating Ground Truth Adherence guardrail."""
20
17
 
21
- if TYPE_CHECKING:
22
- # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
23
- # value to this field, so for compatibility we avoid doing it at runtime.
24
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
18
+ system_prompt: Optional[str] = None
19
+ """The system prompt used to generate the output."""
25
20
 
26
- # Stub to indicate that arbitrary properties are accepted.
27
- # To access properties that are not valid identifiers you can use `getattr`, e.g.
28
- # `getattr(obj, '$type')`
29
- def __getattr__(self, attr: str) -> object: ...
30
- else:
31
- __pydantic_extra__: Dict[str, object]
21
+ user_prompt: Optional[str] = None
22
+ """The user prompt used to generate the output."""
32
23
 
33
24
 
34
25
  class Evaluation(BaseModel):
@@ -41,8 +32,8 @@ class Evaluation(BaseModel):
41
32
  api_model_input: ModelInput = FieldInfo(alias="model_input")
42
33
  """A dictionary of inputs sent to the LLM to generate output.
43
34
 
44
- The dictionary must contain a `user_prompt` field and an optional `context`
45
- field. Additional properties are allowed.
35
+ The dictionary must contain at least one of `user_prompt` or `system_prompt`.
36
+ For ground_truth_aherence guadrail metric, `ground_truth` should be provided.
46
37
  """
47
38
 
48
39
  api_model_output: str = FieldInfo(alias="model_output")
@@ -2,8 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union
6
- from typing_extensions import Literal, Required, TypeAlias, TypedDict
5
+ from typing import List
6
+ from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  __all__ = ["MonitorSubmitEventParams", "ModelInput"]
9
9
 
@@ -31,8 +31,8 @@ class MonitorSubmitEventParams(TypedDict, total=False):
31
31
  model_input: Required[ModelInput]
32
32
  """A dictionary of inputs sent to the LLM to generate output.
33
33
 
34
- This must contain a `user_prompt` field and an optional `context` field.
35
- Additional properties are allowed.
34
+ The dictionary must contain at least one of `user_prompt` or `system_prompt`.
35
+ For ground_truth_aherence guadrail metric, `ground_truth` should be provided.
36
36
  """
37
37
 
38
38
  model_output: Required[str]
@@ -54,10 +54,12 @@ class MonitorSubmitEventParams(TypedDict, total=False):
54
54
  """
55
55
 
56
56
 
57
- class ModelInputTyped(TypedDict, total=False):
58
- user_prompt: Required[str]
57
+ class ModelInput(TypedDict, total=False):
58
+ ground_truth: str
59
+ """The ground truth for evaluating Ground Truth Adherence guardrail."""
59
60
 
60
- context: str
61
+ system_prompt: str
62
+ """The system prompt used to generate the output."""
61
63
 
62
-
63
- ModelInput: TypeAlias = Union[ModelInputTyped, Dict[str, object]]
64
+ user_prompt: str
65
+ """The user prompt used to generate the output."""
@@ -176,7 +176,7 @@ class TestDefend:
176
176
  def test_method_submit_event(self, client: Deeprails) -> None:
177
177
  defend = client.defend.submit_event(
178
178
  workflow_id="workflow_id",
179
- model_input={"user_prompt": "user_prompt"},
179
+ model_input={},
180
180
  model_output="model_output",
181
181
  model_used="model_used",
182
182
  run_mode="precision_plus",
@@ -189,8 +189,9 @@ class TestDefend:
189
189
  defend = client.defend.submit_event(
190
190
  workflow_id="workflow_id",
191
191
  model_input={
192
+ "ground_truth": "ground_truth",
193
+ "system_prompt": "system_prompt",
192
194
  "user_prompt": "user_prompt",
193
- "context": "context",
194
195
  },
195
196
  model_output="model_output",
196
197
  model_used="model_used",
@@ -204,7 +205,7 @@ class TestDefend:
204
205
  def test_raw_response_submit_event(self, client: Deeprails) -> None:
205
206
  response = client.defend.with_raw_response.submit_event(
206
207
  workflow_id="workflow_id",
207
- model_input={"user_prompt": "user_prompt"},
208
+ model_input={},
208
209
  model_output="model_output",
209
210
  model_used="model_used",
210
211
  run_mode="precision_plus",
@@ -220,7 +221,7 @@ class TestDefend:
220
221
  def test_streaming_response_submit_event(self, client: Deeprails) -> None:
221
222
  with client.defend.with_streaming_response.submit_event(
222
223
  workflow_id="workflow_id",
223
- model_input={"user_prompt": "user_prompt"},
224
+ model_input={},
224
225
  model_output="model_output",
225
226
  model_used="model_used",
226
227
  run_mode="precision_plus",
@@ -239,7 +240,7 @@ class TestDefend:
239
240
  with pytest.raises(ValueError, match=r"Expected a non-empty value for `workflow_id` but received ''"):
240
241
  client.defend.with_raw_response.submit_event(
241
242
  workflow_id="",
242
- model_input={"user_prompt": "user_prompt"},
243
+ model_input={},
243
244
  model_output="model_output",
244
245
  model_used="model_used",
245
246
  run_mode="precision_plus",
@@ -459,7 +460,7 @@ class TestAsyncDefend:
459
460
  async def test_method_submit_event(self, async_client: AsyncDeeprails) -> None:
460
461
  defend = await async_client.defend.submit_event(
461
462
  workflow_id="workflow_id",
462
- model_input={"user_prompt": "user_prompt"},
463
+ model_input={},
463
464
  model_output="model_output",
464
465
  model_used="model_used",
465
466
  run_mode="precision_plus",
@@ -472,8 +473,9 @@ class TestAsyncDefend:
472
473
  defend = await async_client.defend.submit_event(
473
474
  workflow_id="workflow_id",
474
475
  model_input={
476
+ "ground_truth": "ground_truth",
477
+ "system_prompt": "system_prompt",
475
478
  "user_prompt": "user_prompt",
476
- "context": "context",
477
479
  },
478
480
  model_output="model_output",
479
481
  model_used="model_used",
@@ -487,7 +489,7 @@ class TestAsyncDefend:
487
489
  async def test_raw_response_submit_event(self, async_client: AsyncDeeprails) -> None:
488
490
  response = await async_client.defend.with_raw_response.submit_event(
489
491
  workflow_id="workflow_id",
490
- model_input={"user_prompt": "user_prompt"},
492
+ model_input={},
491
493
  model_output="model_output",
492
494
  model_used="model_used",
493
495
  run_mode="precision_plus",
@@ -503,7 +505,7 @@ class TestAsyncDefend:
503
505
  async def test_streaming_response_submit_event(self, async_client: AsyncDeeprails) -> None:
504
506
  async with async_client.defend.with_streaming_response.submit_event(
505
507
  workflow_id="workflow_id",
506
- model_input={"user_prompt": "user_prompt"},
508
+ model_input={},
507
509
  model_output="model_output",
508
510
  model_used="model_used",
509
511
  run_mode="precision_plus",
@@ -522,7 +524,7 @@ class TestAsyncDefend:
522
524
  with pytest.raises(ValueError, match=r"Expected a non-empty value for `workflow_id` but received ''"):
523
525
  await async_client.defend.with_raw_response.submit_event(
524
526
  workflow_id="",
525
- model_input={"user_prompt": "user_prompt"},
527
+ model_input={},
526
528
  model_output="model_output",
527
529
  model_used="model_used",
528
530
  run_mode="precision_plus",
@@ -21,7 +21,7 @@ class TestEvaluate:
21
21
  @parametrize
22
22
  def test_method_create(self, client: Deeprails) -> None:
23
23
  evaluate = client.evaluate.create(
24
- model_input={"user_prompt": "user_prompt"},
24
+ model_input={},
25
25
  model_output="model_output",
26
26
  run_mode="precision_plus",
27
27
  )
@@ -32,8 +32,9 @@ class TestEvaluate:
32
32
  def test_method_create_with_all_params(self, client: Deeprails) -> None:
33
33
  evaluate = client.evaluate.create(
34
34
  model_input={
35
+ "ground_truth": "ground_truth",
36
+ "system_prompt": "system_prompt",
35
37
  "user_prompt": "user_prompt",
36
- "context": "context",
37
38
  },
38
39
  model_output="model_output",
39
40
  run_mode="precision_plus",
@@ -47,7 +48,7 @@ class TestEvaluate:
47
48
  @parametrize
48
49
  def test_raw_response_create(self, client: Deeprails) -> None:
49
50
  response = client.evaluate.with_raw_response.create(
50
- model_input={"user_prompt": "user_prompt"},
51
+ model_input={},
51
52
  model_output="model_output",
52
53
  run_mode="precision_plus",
53
54
  )
@@ -61,7 +62,7 @@ class TestEvaluate:
61
62
  @parametrize
62
63
  def test_streaming_response_create(self, client: Deeprails) -> None:
63
64
  with client.evaluate.with_streaming_response.create(
64
- model_input={"user_prompt": "user_prompt"},
65
+ model_input={},
65
66
  model_output="model_output",
66
67
  run_mode="precision_plus",
67
68
  ) as response:
@@ -125,7 +126,7 @@ class TestAsyncEvaluate:
125
126
  @parametrize
126
127
  async def test_method_create(self, async_client: AsyncDeeprails) -> None:
127
128
  evaluate = await async_client.evaluate.create(
128
- model_input={"user_prompt": "user_prompt"},
129
+ model_input={},
129
130
  model_output="model_output",
130
131
  run_mode="precision_plus",
131
132
  )
@@ -136,8 +137,9 @@ class TestAsyncEvaluate:
136
137
  async def test_method_create_with_all_params(self, async_client: AsyncDeeprails) -> None:
137
138
  evaluate = await async_client.evaluate.create(
138
139
  model_input={
140
+ "ground_truth": "ground_truth",
141
+ "system_prompt": "system_prompt",
139
142
  "user_prompt": "user_prompt",
140
- "context": "context",
141
143
  },
142
144
  model_output="model_output",
143
145
  run_mode="precision_plus",
@@ -151,7 +153,7 @@ class TestAsyncEvaluate:
151
153
  @parametrize
152
154
  async def test_raw_response_create(self, async_client: AsyncDeeprails) -> None:
153
155
  response = await async_client.evaluate.with_raw_response.create(
154
- model_input={"user_prompt": "user_prompt"},
156
+ model_input={},
155
157
  model_output="model_output",
156
158
  run_mode="precision_plus",
157
159
  )
@@ -165,7 +167,7 @@ class TestAsyncEvaluate:
165
167
  @parametrize
166
168
  async def test_streaming_response_create(self, async_client: AsyncDeeprails) -> None:
167
169
  async with async_client.evaluate.with_streaming_response.create(
168
- model_input={"user_prompt": "user_prompt"},
170
+ model_input={},
169
171
  model_output="model_output",
170
172
  run_mode="precision_plus",
171
173
  ) as response:
@@ -174,7 +174,7 @@ class TestMonitor:
174
174
  monitor = client.monitor.submit_event(
175
175
  monitor_id="monitor_id",
176
176
  guardrail_metrics=["correctness"],
177
- model_input={"user_prompt": "user_prompt"},
177
+ model_input={},
178
178
  model_output="model_output",
179
179
  )
180
180
  assert_matches_type(MonitorSubmitEventResponse, monitor, path=["response"])
@@ -186,8 +186,9 @@ class TestMonitor:
186
186
  monitor_id="monitor_id",
187
187
  guardrail_metrics=["correctness"],
188
188
  model_input={
189
+ "ground_truth": "ground_truth",
190
+ "system_prompt": "system_prompt",
189
191
  "user_prompt": "user_prompt",
190
- "context": "context",
191
192
  },
192
193
  model_output="model_output",
193
194
  model_used="model_used",
@@ -202,7 +203,7 @@ class TestMonitor:
202
203
  response = client.monitor.with_raw_response.submit_event(
203
204
  monitor_id="monitor_id",
204
205
  guardrail_metrics=["correctness"],
205
- model_input={"user_prompt": "user_prompt"},
206
+ model_input={},
206
207
  model_output="model_output",
207
208
  )
208
209
 
@@ -217,7 +218,7 @@ class TestMonitor:
217
218
  with client.monitor.with_streaming_response.submit_event(
218
219
  monitor_id="monitor_id",
219
220
  guardrail_metrics=["correctness"],
220
- model_input={"user_prompt": "user_prompt"},
221
+ model_input={},
221
222
  model_output="model_output",
222
223
  ) as response:
223
224
  assert not response.is_closed
@@ -235,7 +236,7 @@ class TestMonitor:
235
236
  client.monitor.with_raw_response.submit_event(
236
237
  monitor_id="",
237
238
  guardrail_metrics=["correctness"],
238
- model_input={"user_prompt": "user_prompt"},
239
+ model_input={},
239
240
  model_output="model_output",
240
241
  )
241
242
 
@@ -398,7 +399,7 @@ class TestAsyncMonitor:
398
399
  monitor = await async_client.monitor.submit_event(
399
400
  monitor_id="monitor_id",
400
401
  guardrail_metrics=["correctness"],
401
- model_input={"user_prompt": "user_prompt"},
402
+ model_input={},
402
403
  model_output="model_output",
403
404
  )
404
405
  assert_matches_type(MonitorSubmitEventResponse, monitor, path=["response"])
@@ -410,8 +411,9 @@ class TestAsyncMonitor:
410
411
  monitor_id="monitor_id",
411
412
  guardrail_metrics=["correctness"],
412
413
  model_input={
414
+ "ground_truth": "ground_truth",
415
+ "system_prompt": "system_prompt",
413
416
  "user_prompt": "user_prompt",
414
- "context": "context",
415
417
  },
416
418
  model_output="model_output",
417
419
  model_used="model_used",
@@ -426,7 +428,7 @@ class TestAsyncMonitor:
426
428
  response = await async_client.monitor.with_raw_response.submit_event(
427
429
  monitor_id="monitor_id",
428
430
  guardrail_metrics=["correctness"],
429
- model_input={"user_prompt": "user_prompt"},
431
+ model_input={},
430
432
  model_output="model_output",
431
433
  )
432
434
 
@@ -441,7 +443,7 @@ class TestAsyncMonitor:
441
443
  async with async_client.monitor.with_streaming_response.submit_event(
442
444
  monitor_id="monitor_id",
443
445
  guardrail_metrics=["correctness"],
444
- model_input={"user_prompt": "user_prompt"},
446
+ model_input={},
445
447
  model_output="model_output",
446
448
  ) as response:
447
449
  assert not response.is_closed
@@ -459,6 +461,6 @@ class TestAsyncMonitor:
459
461
  await async_client.monitor.with_raw_response.submit_event(
460
462
  monitor_id="",
461
463
  guardrail_metrics=["correctness"],
462
- model_input={"user_prompt": "user_prompt"},
464
+ model_input={},
463
465
  model_output="model_output",
464
466
  )
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.4.1"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes