opik 1.9.26__py3-none-any.whl → 1.9.41__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.
- opik/__init__.py +10 -3
- opik/api_objects/dataset/rest_operations.py +2 -0
- opik/api_objects/experiment/experiment.py +31 -5
- opik/api_objects/experiment/helpers.py +34 -10
- opik/api_objects/local_recording.py +8 -3
- opik/api_objects/opik_client.py +218 -46
- opik/api_objects/opik_query_language.py +9 -0
- opik/api_objects/prompt/__init__.py +11 -3
- opik/api_objects/prompt/base_prompt.py +69 -0
- opik/api_objects/prompt/base_prompt_template.py +29 -0
- opik/api_objects/prompt/chat/__init__.py +1 -0
- opik/api_objects/prompt/chat/chat_prompt.py +193 -0
- opik/api_objects/prompt/chat/chat_prompt_template.py +350 -0
- opik/api_objects/prompt/{chat_content_renderer_registry.py → chat/content_renderer_registry.py} +31 -34
- opik/api_objects/prompt/client.py +101 -30
- opik/api_objects/prompt/text/__init__.py +1 -0
- opik/api_objects/prompt/{prompt.py → text/prompt.py} +55 -32
- opik/api_objects/prompt/{prompt_template.py → text/prompt_template.py} +8 -5
- opik/cli/export.py +6 -2
- opik/config.py +0 -5
- opik/decorator/base_track_decorator.py +37 -40
- opik/evaluation/__init__.py +13 -2
- opik/evaluation/engine/engine.py +195 -223
- opik/evaluation/engine/helpers.py +8 -7
- opik/evaluation/engine/metrics_evaluator.py +237 -0
- opik/evaluation/evaluation_result.py +35 -1
- opik/evaluation/evaluator.py +309 -23
- opik/evaluation/models/litellm/util.py +78 -6
- opik/evaluation/report.py +14 -2
- opik/evaluation/rest_operations.py +6 -9
- opik/evaluation/test_case.py +2 -2
- opik/evaluation/types.py +9 -1
- opik/exceptions.py +17 -0
- opik/id_helpers.py +18 -0
- opik/integrations/adk/helpers.py +16 -7
- opik/integrations/adk/legacy_opik_tracer.py +7 -4
- opik/integrations/adk/opik_tracer.py +3 -1
- opik/integrations/adk/patchers/adk_otel_tracer/opik_adk_otel_tracer.py +7 -3
- opik/integrations/dspy/callback.py +1 -4
- opik/integrations/haystack/opik_connector.py +2 -2
- opik/integrations/haystack/opik_tracer.py +2 -4
- opik/integrations/langchain/opik_tracer.py +1 -4
- opik/integrations/llama_index/callback.py +2 -4
- opik/integrations/openai/agents/opik_tracing_processor.py +1 -2
- opik/integrations/openai/opik_tracker.py +1 -1
- opik/opik_context.py +7 -7
- opik/rest_api/__init__.py +127 -11
- opik/rest_api/dashboards/client.py +65 -2
- opik/rest_api/dashboards/raw_client.py +82 -0
- opik/rest_api/datasets/client.py +538 -2
- opik/rest_api/datasets/raw_client.py +1347 -441
- opik/rest_api/experiments/client.py +30 -2
- opik/rest_api/experiments/raw_client.py +26 -0
- opik/rest_api/optimizations/client.py +302 -0
- opik/rest_api/optimizations/raw_client.py +463 -0
- opik/rest_api/optimizations/types/optimization_update_status.py +3 -1
- opik/rest_api/prompts/__init__.py +2 -2
- opik/rest_api/prompts/client.py +34 -4
- opik/rest_api/prompts/raw_client.py +32 -2
- opik/rest_api/prompts/types/__init__.py +3 -1
- opik/rest_api/prompts/types/create_prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/prompts/types/prompt_write_template_structure.py +5 -0
- opik/rest_api/traces/client.py +6 -6
- opik/rest_api/traces/raw_client.py +4 -4
- opik/rest_api/types/__init__.py +125 -11
- opik/rest_api/types/aggregation_data.py +1 -0
- opik/rest_api/types/automation_rule_evaluator.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_write.py +2 -0
- opik/rest_api/types/{automation_rule_evaluator_object_public.py → automation_rule_evaluator_object_object_public.py} +32 -10
- opik/rest_api/types/automation_rule_evaluator_page_public.py +2 -2
- opik/rest_api/types/automation_rule_evaluator_public.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_public.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_write.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_update_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_write.py +23 -1
- opik/rest_api/types/dashboard_page_public.py +1 -0
- opik/rest_api/types/dataset.py +4 -0
- opik/rest_api/types/dataset_item.py +1 -0
- opik/rest_api/types/dataset_item_compare.py +1 -0
- opik/rest_api/types/dataset_item_page_compare.py +1 -0
- opik/rest_api/types/dataset_item_page_public.py +1 -0
- opik/rest_api/types/dataset_item_public.py +1 -0
- opik/rest_api/types/dataset_public.py +4 -0
- opik/rest_api/types/dataset_public_status.py +5 -0
- opik/rest_api/types/dataset_status.py +5 -0
- opik/rest_api/types/dataset_version_diff.py +22 -0
- opik/rest_api/types/dataset_version_diff_stats.py +24 -0
- opik/rest_api/types/dataset_version_page_public.py +23 -0
- opik/rest_api/types/dataset_version_public.py +54 -0
- opik/rest_api/types/dataset_version_summary.py +41 -0
- opik/rest_api/types/dataset_version_summary_public.py +41 -0
- opik/rest_api/types/experiment.py +2 -0
- opik/rest_api/types/experiment_public.py +2 -0
- opik/rest_api/types/experiment_score.py +20 -0
- opik/rest_api/types/experiment_score_public.py +20 -0
- opik/rest_api/types/experiment_score_write.py +20 -0
- opik/rest_api/types/feedback_score_public.py +4 -0
- opik/rest_api/types/group_content_with_aggregations.py +1 -0
- opik/rest_api/types/optimization.py +2 -0
- opik/rest_api/types/optimization_public.py +2 -0
- opik/rest_api/types/optimization_public_status.py +3 -1
- opik/rest_api/types/optimization_status.py +3 -1
- opik/rest_api/types/optimization_studio_config.py +27 -0
- opik/rest_api/types/optimization_studio_config_public.py +27 -0
- opik/rest_api/types/optimization_studio_config_write.py +27 -0
- opik/rest_api/types/optimization_studio_log.py +22 -0
- opik/rest_api/types/optimization_write.py +2 -0
- opik/rest_api/types/optimization_write_status.py +3 -1
- opik/rest_api/types/prompt.py +6 -0
- opik/rest_api/types/prompt_detail.py +6 -0
- opik/rest_api/types/prompt_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_public.py +6 -0
- opik/rest_api/types/prompt_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_template_structure.py +5 -0
- opik/rest_api/types/prompt_version.py +2 -0
- opik/rest_api/types/prompt_version_detail.py +2 -0
- opik/rest_api/types/prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_public.py +2 -0
- opik/rest_api/types/prompt_version_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_template_structure.py +5 -0
- opik/rest_api/types/score_name.py +1 -0
- opik/rest_api/types/service_toggles_config.py +5 -0
- opik/rest_api/types/span_filter.py +23 -0
- opik/rest_api/types/span_filter_operator.py +21 -0
- opik/rest_api/types/span_filter_write.py +23 -0
- opik/rest_api/types/span_filter_write_operator.py +21 -0
- opik/rest_api/types/span_llm_as_judge_code.py +27 -0
- opik/rest_api/types/span_llm_as_judge_code_public.py +27 -0
- opik/rest_api/types/span_llm_as_judge_code_write.py +27 -0
- opik/rest_api/types/studio_evaluation.py +20 -0
- opik/rest_api/types/studio_evaluation_public.py +20 -0
- opik/rest_api/types/studio_evaluation_write.py +20 -0
- opik/rest_api/types/studio_llm_model.py +21 -0
- opik/rest_api/types/studio_llm_model_public.py +21 -0
- opik/rest_api/types/studio_llm_model_write.py +21 -0
- opik/rest_api/types/studio_message.py +20 -0
- opik/rest_api/types/studio_message_public.py +20 -0
- opik/rest_api/types/studio_message_write.py +20 -0
- opik/rest_api/types/studio_metric.py +21 -0
- opik/rest_api/types/studio_metric_public.py +21 -0
- opik/rest_api/types/studio_metric_write.py +21 -0
- opik/rest_api/types/studio_optimizer.py +21 -0
- opik/rest_api/types/studio_optimizer_public.py +21 -0
- opik/rest_api/types/studio_optimizer_write.py +21 -0
- opik/rest_api/types/studio_prompt.py +20 -0
- opik/rest_api/types/studio_prompt_public.py +20 -0
- opik/rest_api/types/studio_prompt_write.py +20 -0
- opik/rest_api/types/trace.py +6 -0
- opik/rest_api/types/trace_public.py +6 -0
- opik/rest_api/types/trace_thread_filter_write.py +23 -0
- opik/rest_api/types/trace_thread_filter_write_operator.py +21 -0
- opik/rest_api/types/value_entry.py +2 -0
- opik/rest_api/types/value_entry_compare.py +2 -0
- opik/rest_api/types/value_entry_experiment_item_bulk_write_view.py +2 -0
- opik/rest_api/types/value_entry_public.py +2 -0
- opik/synchronization.py +5 -6
- opik/{decorator/tracing_runtime_config.py → tracing_runtime_config.py} +6 -7
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/METADATA +4 -3
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/RECORD +180 -120
- opik/api_objects/prompt/chat_prompt_template.py +0 -200
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/WHEEL +0 -0
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/entry_points.txt +0 -0
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/licenses/LICENSE +0 -0
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/top_level.txt +0 -0
opik/rest_api/prompts/client.py
CHANGED
|
@@ -10,6 +10,8 @@ from ..types.prompt_page_public import PromptPagePublic
|
|
|
10
10
|
from ..types.prompt_version_detail import PromptVersionDetail
|
|
11
11
|
from ..types.prompt_version_page_public import PromptVersionPagePublic
|
|
12
12
|
from .raw_client import AsyncRawPromptsClient, RawPromptsClient
|
|
13
|
+
from .types.create_prompt_version_detail_template_structure import CreatePromptVersionDetailTemplateStructure
|
|
14
|
+
from .types.prompt_write_template_structure import PromptWriteTemplateStructure
|
|
13
15
|
from .types.prompt_write_type import PromptWriteType
|
|
14
16
|
|
|
15
17
|
# this is used as the default value for optional parameters
|
|
@@ -85,6 +87,7 @@ class PromptsClient:
|
|
|
85
87
|
metadata: typing.Optional[JsonNodeWrite] = OMIT,
|
|
86
88
|
change_description: typing.Optional[str] = OMIT,
|
|
87
89
|
type: typing.Optional[PromptWriteType] = OMIT,
|
|
90
|
+
template_structure: typing.Optional[PromptWriteTemplateStructure] = OMIT,
|
|
88
91
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
89
92
|
request_options: typing.Optional[RequestOptions] = None,
|
|
90
93
|
) -> None:
|
|
@@ -107,6 +110,9 @@ class PromptsClient:
|
|
|
107
110
|
|
|
108
111
|
type : typing.Optional[PromptWriteType]
|
|
109
112
|
|
|
113
|
+
template_structure : typing.Optional[PromptWriteTemplateStructure]
|
|
114
|
+
Template structure type: 'text' or 'chat'. Immutable after creation.
|
|
115
|
+
|
|
110
116
|
tags : typing.Optional[typing.Sequence[str]]
|
|
111
117
|
|
|
112
118
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -130,13 +136,19 @@ class PromptsClient:
|
|
|
130
136
|
metadata=metadata,
|
|
131
137
|
change_description=change_description,
|
|
132
138
|
type=type,
|
|
139
|
+
template_structure=template_structure,
|
|
133
140
|
tags=tags,
|
|
134
141
|
request_options=request_options,
|
|
135
142
|
)
|
|
136
143
|
return _response.data
|
|
137
144
|
|
|
138
145
|
def create_prompt_version(
|
|
139
|
-
self,
|
|
146
|
+
self,
|
|
147
|
+
*,
|
|
148
|
+
name: str,
|
|
149
|
+
version: PromptVersionDetail,
|
|
150
|
+
template_structure: typing.Optional[CreatePromptVersionDetailTemplateStructure] = OMIT,
|
|
151
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
140
152
|
) -> PromptVersionDetail:
|
|
141
153
|
"""
|
|
142
154
|
Create prompt version
|
|
@@ -147,6 +159,9 @@ class PromptsClient:
|
|
|
147
159
|
|
|
148
160
|
version : PromptVersionDetail
|
|
149
161
|
|
|
162
|
+
template_structure : typing.Optional[CreatePromptVersionDetailTemplateStructure]
|
|
163
|
+
Template structure for the prompt: 'text' or 'chat'. Note: This field is only used when creating a new prompt. If a prompt with the given name already exists, this field is ignored and the existing prompt's template structure is used. Template structure is immutable after prompt creation.
|
|
164
|
+
|
|
150
165
|
request_options : typing.Optional[RequestOptions]
|
|
151
166
|
Request-specific configuration.
|
|
152
167
|
|
|
@@ -162,7 +177,9 @@ class PromptsClient:
|
|
|
162
177
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
163
178
|
client.prompts.create_prompt_version(name='name', version=PromptVersionDetail(template='template', ), )
|
|
164
179
|
"""
|
|
165
|
-
_response = self._raw_client.create_prompt_version(
|
|
180
|
+
_response = self._raw_client.create_prompt_version(
|
|
181
|
+
name=name, version=version, template_structure=template_structure, request_options=request_options
|
|
182
|
+
)
|
|
166
183
|
return _response.data
|
|
167
184
|
|
|
168
185
|
def get_prompt_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> PromptDetail:
|
|
@@ -474,6 +491,7 @@ class AsyncPromptsClient:
|
|
|
474
491
|
metadata: typing.Optional[JsonNodeWrite] = OMIT,
|
|
475
492
|
change_description: typing.Optional[str] = OMIT,
|
|
476
493
|
type: typing.Optional[PromptWriteType] = OMIT,
|
|
494
|
+
template_structure: typing.Optional[PromptWriteTemplateStructure] = OMIT,
|
|
477
495
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
478
496
|
request_options: typing.Optional[RequestOptions] = None,
|
|
479
497
|
) -> None:
|
|
@@ -496,6 +514,9 @@ class AsyncPromptsClient:
|
|
|
496
514
|
|
|
497
515
|
type : typing.Optional[PromptWriteType]
|
|
498
516
|
|
|
517
|
+
template_structure : typing.Optional[PromptWriteTemplateStructure]
|
|
518
|
+
Template structure type: 'text' or 'chat'. Immutable after creation.
|
|
519
|
+
|
|
499
520
|
tags : typing.Optional[typing.Sequence[str]]
|
|
500
521
|
|
|
501
522
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -522,13 +543,19 @@ class AsyncPromptsClient:
|
|
|
522
543
|
metadata=metadata,
|
|
523
544
|
change_description=change_description,
|
|
524
545
|
type=type,
|
|
546
|
+
template_structure=template_structure,
|
|
525
547
|
tags=tags,
|
|
526
548
|
request_options=request_options,
|
|
527
549
|
)
|
|
528
550
|
return _response.data
|
|
529
551
|
|
|
530
552
|
async def create_prompt_version(
|
|
531
|
-
self,
|
|
553
|
+
self,
|
|
554
|
+
*,
|
|
555
|
+
name: str,
|
|
556
|
+
version: PromptVersionDetail,
|
|
557
|
+
template_structure: typing.Optional[CreatePromptVersionDetailTemplateStructure] = OMIT,
|
|
558
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
532
559
|
) -> PromptVersionDetail:
|
|
533
560
|
"""
|
|
534
561
|
Create prompt version
|
|
@@ -539,6 +566,9 @@ class AsyncPromptsClient:
|
|
|
539
566
|
|
|
540
567
|
version : PromptVersionDetail
|
|
541
568
|
|
|
569
|
+
template_structure : typing.Optional[CreatePromptVersionDetailTemplateStructure]
|
|
570
|
+
Template structure for the prompt: 'text' or 'chat'. Note: This field is only used when creating a new prompt. If a prompt with the given name already exists, this field is ignored and the existing prompt's template structure is used. Template structure is immutable after prompt creation.
|
|
571
|
+
|
|
542
572
|
request_options : typing.Optional[RequestOptions]
|
|
543
573
|
Request-specific configuration.
|
|
544
574
|
|
|
@@ -558,7 +588,7 @@ class AsyncPromptsClient:
|
|
|
558
588
|
asyncio.run(main())
|
|
559
589
|
"""
|
|
560
590
|
_response = await self._raw_client.create_prompt_version(
|
|
561
|
-
name=name, version=version, request_options=request_options
|
|
591
|
+
name=name, version=version, template_structure=template_structure, request_options=request_options
|
|
562
592
|
)
|
|
563
593
|
return _response.data
|
|
564
594
|
|
|
@@ -19,6 +19,8 @@ from ..types.prompt_detail import PromptDetail
|
|
|
19
19
|
from ..types.prompt_page_public import PromptPagePublic
|
|
20
20
|
from ..types.prompt_version_detail import PromptVersionDetail
|
|
21
21
|
from ..types.prompt_version_page_public import PromptVersionPagePublic
|
|
22
|
+
from .types.create_prompt_version_detail_template_structure import CreatePromptVersionDetailTemplateStructure
|
|
23
|
+
from .types.prompt_write_template_structure import PromptWriteTemplateStructure
|
|
22
24
|
from .types.prompt_write_type import PromptWriteType
|
|
23
25
|
|
|
24
26
|
# this is used as the default value for optional parameters
|
|
@@ -99,6 +101,7 @@ class RawPromptsClient:
|
|
|
99
101
|
metadata: typing.Optional[JsonNodeWrite] = OMIT,
|
|
100
102
|
change_description: typing.Optional[str] = OMIT,
|
|
101
103
|
type: typing.Optional[PromptWriteType] = OMIT,
|
|
104
|
+
template_structure: typing.Optional[PromptWriteTemplateStructure] = OMIT,
|
|
102
105
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
103
106
|
request_options: typing.Optional[RequestOptions] = None,
|
|
104
107
|
) -> HttpResponse[None]:
|
|
@@ -121,6 +124,9 @@ class RawPromptsClient:
|
|
|
121
124
|
|
|
122
125
|
type : typing.Optional[PromptWriteType]
|
|
123
126
|
|
|
127
|
+
template_structure : typing.Optional[PromptWriteTemplateStructure]
|
|
128
|
+
Template structure type: 'text' or 'chat'. Immutable after creation.
|
|
129
|
+
|
|
124
130
|
tags : typing.Optional[typing.Sequence[str]]
|
|
125
131
|
|
|
126
132
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -141,6 +147,7 @@ class RawPromptsClient:
|
|
|
141
147
|
"metadata": metadata,
|
|
142
148
|
"change_description": change_description,
|
|
143
149
|
"type": type,
|
|
150
|
+
"template_structure": template_structure,
|
|
144
151
|
"tags": tags,
|
|
145
152
|
},
|
|
146
153
|
headers={
|
|
@@ -191,7 +198,12 @@ class RawPromptsClient:
|
|
|
191
198
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
192
199
|
|
|
193
200
|
def create_prompt_version(
|
|
194
|
-
self,
|
|
201
|
+
self,
|
|
202
|
+
*,
|
|
203
|
+
name: str,
|
|
204
|
+
version: PromptVersionDetail,
|
|
205
|
+
template_structure: typing.Optional[CreatePromptVersionDetailTemplateStructure] = OMIT,
|
|
206
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
195
207
|
) -> HttpResponse[PromptVersionDetail]:
|
|
196
208
|
"""
|
|
197
209
|
Create prompt version
|
|
@@ -202,6 +214,9 @@ class RawPromptsClient:
|
|
|
202
214
|
|
|
203
215
|
version : PromptVersionDetail
|
|
204
216
|
|
|
217
|
+
template_structure : typing.Optional[CreatePromptVersionDetailTemplateStructure]
|
|
218
|
+
Template structure for the prompt: 'text' or 'chat'. Note: This field is only used when creating a new prompt. If a prompt with the given name already exists, this field is ignored and the existing prompt's template structure is used. Template structure is immutable after prompt creation.
|
|
219
|
+
|
|
205
220
|
request_options : typing.Optional[RequestOptions]
|
|
206
221
|
Request-specific configuration.
|
|
207
222
|
|
|
@@ -218,6 +233,7 @@ class RawPromptsClient:
|
|
|
218
233
|
"version": convert_and_respect_annotation_metadata(
|
|
219
234
|
object_=version, annotation=PromptVersionDetail, direction="write"
|
|
220
235
|
),
|
|
236
|
+
"template_structure": template_structure,
|
|
221
237
|
},
|
|
222
238
|
headers={
|
|
223
239
|
"content-type": "application/json",
|
|
@@ -800,6 +816,7 @@ class AsyncRawPromptsClient:
|
|
|
800
816
|
metadata: typing.Optional[JsonNodeWrite] = OMIT,
|
|
801
817
|
change_description: typing.Optional[str] = OMIT,
|
|
802
818
|
type: typing.Optional[PromptWriteType] = OMIT,
|
|
819
|
+
template_structure: typing.Optional[PromptWriteTemplateStructure] = OMIT,
|
|
803
820
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
804
821
|
request_options: typing.Optional[RequestOptions] = None,
|
|
805
822
|
) -> AsyncHttpResponse[None]:
|
|
@@ -822,6 +839,9 @@ class AsyncRawPromptsClient:
|
|
|
822
839
|
|
|
823
840
|
type : typing.Optional[PromptWriteType]
|
|
824
841
|
|
|
842
|
+
template_structure : typing.Optional[PromptWriteTemplateStructure]
|
|
843
|
+
Template structure type: 'text' or 'chat'. Immutable after creation.
|
|
844
|
+
|
|
825
845
|
tags : typing.Optional[typing.Sequence[str]]
|
|
826
846
|
|
|
827
847
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -842,6 +862,7 @@ class AsyncRawPromptsClient:
|
|
|
842
862
|
"metadata": metadata,
|
|
843
863
|
"change_description": change_description,
|
|
844
864
|
"type": type,
|
|
865
|
+
"template_structure": template_structure,
|
|
845
866
|
"tags": tags,
|
|
846
867
|
},
|
|
847
868
|
headers={
|
|
@@ -892,7 +913,12 @@ class AsyncRawPromptsClient:
|
|
|
892
913
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
893
914
|
|
|
894
915
|
async def create_prompt_version(
|
|
895
|
-
self,
|
|
916
|
+
self,
|
|
917
|
+
*,
|
|
918
|
+
name: str,
|
|
919
|
+
version: PromptVersionDetail,
|
|
920
|
+
template_structure: typing.Optional[CreatePromptVersionDetailTemplateStructure] = OMIT,
|
|
921
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
896
922
|
) -> AsyncHttpResponse[PromptVersionDetail]:
|
|
897
923
|
"""
|
|
898
924
|
Create prompt version
|
|
@@ -903,6 +929,9 @@ class AsyncRawPromptsClient:
|
|
|
903
929
|
|
|
904
930
|
version : PromptVersionDetail
|
|
905
931
|
|
|
932
|
+
template_structure : typing.Optional[CreatePromptVersionDetailTemplateStructure]
|
|
933
|
+
Template structure for the prompt: 'text' or 'chat'. Note: This field is only used when creating a new prompt. If a prompt with the given name already exists, this field is ignored and the existing prompt's template structure is used. Template structure is immutable after prompt creation.
|
|
934
|
+
|
|
906
935
|
request_options : typing.Optional[RequestOptions]
|
|
907
936
|
Request-specific configuration.
|
|
908
937
|
|
|
@@ -919,6 +948,7 @@ class AsyncRawPromptsClient:
|
|
|
919
948
|
"version": convert_and_respect_annotation_metadata(
|
|
920
949
|
object_=version, annotation=PromptVersionDetail, direction="write"
|
|
921
950
|
),
|
|
951
|
+
"template_structure": template_structure,
|
|
922
952
|
},
|
|
923
953
|
headers={
|
|
924
954
|
"content-type": "application/json",
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
|
+
from .create_prompt_version_detail_template_structure import CreatePromptVersionDetailTemplateStructure
|
|
6
|
+
from .prompt_write_template_structure import PromptWriteTemplateStructure
|
|
5
7
|
from .prompt_write_type import PromptWriteType
|
|
6
8
|
|
|
7
|
-
__all__ = ["PromptWriteType"]
|
|
9
|
+
__all__ = ["CreatePromptVersionDetailTemplateStructure", "PromptWriteTemplateStructure", "PromptWriteType"]
|
opik/rest_api/traces/client.py
CHANGED
|
@@ -887,14 +887,14 @@ class TracesClient:
|
|
|
887
887
|
return _response.data
|
|
888
888
|
|
|
889
889
|
def find_trace_threads_feedback_score_names(
|
|
890
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
890
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
891
891
|
) -> typing.List[str]:
|
|
892
892
|
"""
|
|
893
893
|
Find Trace Threads Feedback Score names
|
|
894
894
|
|
|
895
895
|
Parameters
|
|
896
896
|
----------
|
|
897
|
-
project_id : str
|
|
897
|
+
project_id : typing.Optional[str]
|
|
898
898
|
|
|
899
899
|
request_options : typing.Optional[RequestOptions]
|
|
900
900
|
Request-specific configuration.
|
|
@@ -908,7 +908,7 @@ class TracesClient:
|
|
|
908
908
|
--------
|
|
909
909
|
from Opik import OpikApi
|
|
910
910
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
911
|
-
client.traces.find_trace_threads_feedback_score_names(
|
|
911
|
+
client.traces.find_trace_threads_feedback_score_names()
|
|
912
912
|
"""
|
|
913
913
|
_response = self._raw_client.find_trace_threads_feedback_score_names(
|
|
914
914
|
project_id=project_id, request_options=request_options
|
|
@@ -2429,14 +2429,14 @@ class AsyncTracesClient:
|
|
|
2429
2429
|
return _response.data
|
|
2430
2430
|
|
|
2431
2431
|
async def find_trace_threads_feedback_score_names(
|
|
2432
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
2432
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
2433
2433
|
) -> typing.List[str]:
|
|
2434
2434
|
"""
|
|
2435
2435
|
Find Trace Threads Feedback Score names
|
|
2436
2436
|
|
|
2437
2437
|
Parameters
|
|
2438
2438
|
----------
|
|
2439
|
-
project_id : str
|
|
2439
|
+
project_id : typing.Optional[str]
|
|
2440
2440
|
|
|
2441
2441
|
request_options : typing.Optional[RequestOptions]
|
|
2442
2442
|
Request-specific configuration.
|
|
@@ -2452,7 +2452,7 @@ class AsyncTracesClient:
|
|
|
2452
2452
|
import asyncio
|
|
2453
2453
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2454
2454
|
async def main() -> None:
|
|
2455
|
-
await client.traces.find_trace_threads_feedback_score_names(
|
|
2455
|
+
await client.traces.find_trace_threads_feedback_score_names()
|
|
2456
2456
|
asyncio.run(main())
|
|
2457
2457
|
"""
|
|
2458
2458
|
_response = await self._raw_client.find_trace_threads_feedback_score_names(
|
|
@@ -1124,14 +1124,14 @@ class RawTracesClient:
|
|
|
1124
1124
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1125
1125
|
|
|
1126
1126
|
def find_trace_threads_feedback_score_names(
|
|
1127
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
1127
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
1128
1128
|
) -> HttpResponse[typing.List[str]]:
|
|
1129
1129
|
"""
|
|
1130
1130
|
Find Trace Threads Feedback Score names
|
|
1131
1131
|
|
|
1132
1132
|
Parameters
|
|
1133
1133
|
----------
|
|
1134
|
-
project_id : str
|
|
1134
|
+
project_id : typing.Optional[str]
|
|
1135
1135
|
|
|
1136
1136
|
request_options : typing.Optional[RequestOptions]
|
|
1137
1137
|
Request-specific configuration.
|
|
@@ -3115,14 +3115,14 @@ class AsyncRawTracesClient:
|
|
|
3115
3115
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3116
3116
|
|
|
3117
3117
|
async def find_trace_threads_feedback_score_names(
|
|
3118
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
3118
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
3119
3119
|
) -> AsyncHttpResponse[typing.List[str]]:
|
|
3120
3120
|
"""
|
|
3121
3121
|
Find Trace Threads Feedback Score names
|
|
3122
3122
|
|
|
3123
3123
|
Parameters
|
|
3124
3124
|
----------
|
|
3125
|
-
project_id : str
|
|
3125
|
+
project_id : typing.Optional[str]
|
|
3126
3126
|
|
|
3127
3127
|
request_options : typing.Optional[RequestOptions]
|
|
3128
3128
|
Request-specific configuration.
|