langwatch-scenario 0.6.0__py3-none-any.whl → 0.7.2__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.
- {langwatch_scenario-0.6.0.dist-info → langwatch_scenario-0.7.2.dist-info}/METADATA +145 -41
- langwatch_scenario-0.7.2.dist-info/RECORD +237 -0
- scenario/__init__.py +1 -4
- scenario/{events → _events}/__init__.py +9 -11
- scenario/_events/event_bus.py +185 -0
- scenario/{events → _events}/event_reporter.py +1 -1
- scenario/{events → _events}/events.py +20 -27
- scenario/_events/messages.py +58 -0
- scenario/{events → _events}/utils.py +43 -32
- scenario/_generated/langwatch_api_client/README.md +139 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/__init__.py +13 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/__init__.py +1 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/__init__.py +1 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/delete_api_annotations_id.py +155 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/delete_api_prompts_by_id.py +218 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/delete_api_scenario_events.py +183 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_annotations.py +136 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_annotations_id.py +155 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_annotations_trace_id.py +160 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_dataset_by_slug_or_id.py +229 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_prompts.py +188 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_prompts_by_id.py +218 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_prompts_by_id_versions.py +218 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/get_api_trace_id.py +155 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/patch_api_annotations_id.py +178 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/post_api_annotations_trace_id.py +178 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/post_api_dataset_by_slug_entries.py +108 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/post_api_prompts.py +187 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/post_api_prompts_by_id_versions.py +241 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/post_api_scenario_events.py +229 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/post_api_trace_id_share.py +155 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/post_api_trace_id_unshare.py +155 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/default/put_api_prompts_by_id.py +241 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/traces/__init__.py +1 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/api/traces/post_api_trace_search.py +168 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/client.py +268 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/errors.py +16 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/__init__.py +455 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/annotation.py +131 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/dataset_post_entries.py +74 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/dataset_post_entries_entries_item.py +44 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_annotations_id_response_200.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_prompts_by_id_response_200.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_prompts_by_id_response_400.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_prompts_by_id_response_400_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_prompts_by_id_response_401.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_prompts_by_id_response_401_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_prompts_by_id_response_404.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_prompts_by_id_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_scenario_events_response_200.py +81 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_scenario_events_response_400.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_scenario_events_response_401.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/delete_api_scenario_events_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/error.py +67 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/evaluation.py +164 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/evaluation_timestamps.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_200.py +75 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_200_data_item.py +109 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_200_data_item_entry.py +44 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_400.py +78 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_401.py +78 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_404.py +78 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_422.py +67 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_dataset_by_slug_or_id_response_500.py +78 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_200.py +172 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_200_messages_item.py +69 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_200_messages_item_role.py +10 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_200_response_format_type_0.py +81 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_200_response_format_type_0_json_schema.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_200_response_format_type_0_json_schema_schema.py +44 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_200_response_format_type_0_type.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_400.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_400_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_401.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_401_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_404.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200.py +155 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data.py +204 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_demonstrations.py +101 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_demonstrations_columns_item.py +79 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_demonstrations_columns_item_type.py +18 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_demonstrations_rows_item.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_inputs_item.py +71 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_inputs_item_type.py +16 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_messages_item.py +71 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_messages_item_role.py +10 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_outputs_item.py +98 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_outputs_item_json_schema.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_outputs_item_type.py +11 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_200_config_data_prompting_technique.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_400.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_400_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_401.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_401_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_404.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_by_id_versions_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_200_item.py +172 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_200_item_messages_item.py +69 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_200_item_messages_item_role.py +10 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_200_item_response_format_type_0.py +81 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_200_item_response_format_type_0_json_schema.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_200_item_response_format_type_0_json_schema_schema.py +44 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_200_item_response_format_type_0_type.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_400.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_400_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_401.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_401_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_prompts_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200.py +249 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_error_type_0.py +79 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_evaluations_item.py +152 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_evaluations_item_error.py +79 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_evaluations_item_timestamps.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_input.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_metadata.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_metrics.py +95 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_output.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item.py +271 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_error_type_0.py +79 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_input.py +90 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_input_value_item.py +69 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_metrics.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_output.py +89 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_output_value_item.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_params.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_spans_item_timestamps.py +95 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/get_api_trace_id_response_200_timestamps.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/input_.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/metadata.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/metrics.py +115 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/output.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/pagination.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/patch_api_annotations_id_body.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/patch_api_annotations_id_response_200.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_annotations_trace_id_body.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_body.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body.py +147 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data.py +207 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_demonstrations.py +106 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_demonstrations_columns_item.py +79 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_demonstrations_columns_item_type.py +18 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_demonstrations_rows_item.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_inputs_item.py +71 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_inputs_item_type.py +16 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_messages_item.py +71 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_messages_item_role.py +10 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_outputs_item.py +98 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_outputs_item_json_schema.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_outputs_item_type.py +11 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_body_config_data_prompting_technique.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200.py +155 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data.py +206 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_demonstrations.py +101 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_demonstrations_columns_item.py +79 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_demonstrations_columns_item_type.py +18 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_demonstrations_rows_item.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_inputs_item.py +71 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_inputs_item_type.py +16 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_messages_item.py +71 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_messages_item_role.py +10 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_outputs_item.py +98 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_outputs_item_json_schema.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_outputs_item_type.py +11 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_200_config_data_prompting_technique.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_400.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_400_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_401.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_401_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_404.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_by_id_versions_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_200.py +172 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_200_messages_item.py +69 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_200_messages_item_role.py +10 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_200_response_format_type_0.py +81 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_200_response_format_type_0_json_schema.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_200_response_format_type_0_json_schema_schema.py +44 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_200_response_format_type_0_type.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_400.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_400_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_401.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_401_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_prompts_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_0.py +127 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_0_metadata.py +68 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_1.py +164 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_1_results_type_0.py +98 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_1_results_type_0_verdict.py +10 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_1_status.py +13 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2.py +245 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2_messages_item_type_0.py +88 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2_messages_item_type_1.py +88 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2_messages_item_type_2.py +120 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2_messages_item_type_2_tool_calls_item.py +87 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2_messages_item_type_2_tool_calls_item_function.py +67 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2_messages_item_type_3.py +88 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_body_type_2_messages_item_type_4.py +85 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_response_201.py +81 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_response_400.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_response_401.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_scenario_events_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_trace_id_share_response_200.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/post_api_trace_id_unshare_response_200.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_body.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_response_200.py +75 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_response_400.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_response_400_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_response_401.py +61 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_response_401_error.py +8 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_response_404.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/put_api_prompts_by_id_response_500.py +59 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/search_request.py +133 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/search_request_filters.py +51 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/search_response.py +93 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/timestamps.py +77 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/models/trace.py +225 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/py.typed +1 -0
- scenario/_generated/langwatch_api_client/lang_watch_api_client/types.py +46 -0
- scenario/_generated/langwatch_api_client/pyproject.toml +27 -0
- scenario/_utils/__init__.py +1 -1
- scenario/_utils/message_conversion.py +2 -2
- scenario/judge_agent.py +6 -1
- scenario/pytest_plugin.py +4 -4
- scenario/scenario_executor.py +196 -223
- scenario/types.py +5 -2
- langwatch_scenario-0.6.0.dist-info/RECORD +0 -27
- scenario/events/event_bus.py +0 -175
- scenario/events/messages.py +0 -84
- {langwatch_scenario-0.6.0.dist-info → langwatch_scenario-0.7.2.dist-info}/WHEEL +0 -0
- {langwatch_scenario-0.6.0.dist-info → langwatch_scenario-0.7.2.dist-info}/entry_points.txt +0 -0
- {langwatch_scenario-0.6.0.dist-info → langwatch_scenario-0.7.2.dist-info}/top_level.txt +0 -0
scenario/events/event_bus.py
DELETED
@@ -1,175 +0,0 @@
|
|
1
|
-
from rx.subject.subject import Subject
|
2
|
-
from rx import operators as ops
|
3
|
-
from typing import Optional
|
4
|
-
from datetime import datetime, UTC
|
5
|
-
from .events import ScenarioEvent, ScenarioRunFinishedEvent
|
6
|
-
from .event_reporter import EventReporter
|
7
|
-
from typing import Any
|
8
|
-
|
9
|
-
import asyncio
|
10
|
-
|
11
|
-
|
12
|
-
class ScenarioEventBus:
|
13
|
-
"""
|
14
|
-
Manages scenario event publishing, subscription, and processing pipeline using RxPY.
|
15
|
-
|
16
|
-
The EventBus provides a centralized event processing system that handles scenario
|
17
|
-
events asynchronously with retry logic and concurrent processing. It automatically
|
18
|
-
manages the event stream lifecycle and ensures all events are processed before
|
19
|
-
completion.
|
20
|
-
|
21
|
-
Events are processed concurrently to improve performance, and failed event
|
22
|
-
processing is automatically retried with exponential backoff.
|
23
|
-
|
24
|
-
Attributes:
|
25
|
-
_events: RxPY Subject for event stream management
|
26
|
-
_event_reporter: EventReporter instance for HTTP posting of events
|
27
|
-
_processing_complete: Async event to signal when all events are processed
|
28
|
-
_processing_task: Background task for event processing
|
29
|
-
_max_retries: Maximum number of retry attempts for failed event processing
|
30
|
-
|
31
|
-
Example:
|
32
|
-
```python
|
33
|
-
# Create event bus with custom reporter
|
34
|
-
reporter = EventReporter(endpoint="https://api.langwatch.ai")
|
35
|
-
event_bus = ScenarioEventBus(event_reporter=reporter, max_retries=5)
|
36
|
-
|
37
|
-
# Start listening for events
|
38
|
-
await event_bus.listen()
|
39
|
-
|
40
|
-
# Publish events
|
41
|
-
event_bus.publish(scenario_started_event)
|
42
|
-
event_bus.publish(message_snapshot_event)
|
43
|
-
event_bus.publish(scenario_finished_event) # This completes the stream
|
44
|
-
|
45
|
-
# Wait for all events to be processed
|
46
|
-
await event_bus.drain()
|
47
|
-
```
|
48
|
-
"""
|
49
|
-
|
50
|
-
def __init__(
|
51
|
-
self, event_reporter: Optional[EventReporter] = None, max_retries: int = 3
|
52
|
-
):
|
53
|
-
"""
|
54
|
-
Initialize the event bus with optional event reporter and retry configuration.
|
55
|
-
|
56
|
-
Args:
|
57
|
-
event_reporter: Optional EventReporter for HTTP posting of events.
|
58
|
-
If not provided, a default EventReporter will be created.
|
59
|
-
max_retries: Maximum number of retry attempts for failed event processing.
|
60
|
-
Defaults to 3 attempts with exponential backoff.
|
61
|
-
"""
|
62
|
-
self._events = Subject()
|
63
|
-
# Use default EventReporter if none provided
|
64
|
-
self._event_reporter: EventReporter = event_reporter or EventReporter()
|
65
|
-
self._processing_complete = asyncio.Event()
|
66
|
-
self._processing_task: Optional[asyncio.Task[Any]] = None
|
67
|
-
self._max_retries = max_retries
|
68
|
-
|
69
|
-
def publish(self, event: ScenarioEvent) -> None:
|
70
|
-
"""
|
71
|
-
Publishes an event into the processing pipeline.
|
72
|
-
|
73
|
-
This method adds an event to the RxPY stream for processing. The event
|
74
|
-
timestamp is automatically set to the current time in milliseconds if
|
75
|
-
not already provided. Publishing a ScenarioRunFinishedEvent automatically
|
76
|
-
completes the event stream.
|
77
|
-
|
78
|
-
Args:
|
79
|
-
event: The scenario event to publish. Must be a valid ScenarioEvent type.
|
80
|
-
|
81
|
-
Note:
|
82
|
-
Events are processed asynchronously in the background. Use `drain()`
|
83
|
-
to wait for all events to be processed after publishing.
|
84
|
-
"""
|
85
|
-
# Convert to Unix timestamp in milliseconds
|
86
|
-
event.timestamp = int(datetime.now(UTC).timestamp() * 1000)
|
87
|
-
self._events.on_next(event)
|
88
|
-
|
89
|
-
if isinstance(event, ScenarioRunFinishedEvent):
|
90
|
-
self._events.on_completed()
|
91
|
-
|
92
|
-
async def listen(self) -> None:
|
93
|
-
"""
|
94
|
-
Begins listening for and processing events.
|
95
|
-
|
96
|
-
This method sets up the RxPY event processing pipeline with concurrent
|
97
|
-
processing and automatic retry logic. It should be called before publishing
|
98
|
-
any events to ensure proper event handling.
|
99
|
-
|
100
|
-
The processing pipeline:
|
101
|
-
1. Receives events from the publish() method
|
102
|
-
2. Processes each event concurrently using asyncio tasks
|
103
|
-
3. Automatically retries failed events with exponential backoff
|
104
|
-
4. Completes when a ScenarioRunFinishedEvent is published
|
105
|
-
|
106
|
-
Note:
|
107
|
-
This method is idempotent - calling it multiple times has no effect
|
108
|
-
if the processing pipeline is already active.
|
109
|
-
"""
|
110
|
-
if self._processing_task is not None:
|
111
|
-
return
|
112
|
-
|
113
|
-
async def process_single_event(event: ScenarioEvent, attempt: int = 1) -> bool:
|
114
|
-
"""
|
115
|
-
Process a single event with retry logic.
|
116
|
-
|
117
|
-
Args:
|
118
|
-
event: The event to process
|
119
|
-
attempt: Current attempt number (1-based)
|
120
|
-
|
121
|
-
Returns:
|
122
|
-
True if processing succeeded, False if all retries failed
|
123
|
-
"""
|
124
|
-
try:
|
125
|
-
if self._event_reporter:
|
126
|
-
await self._event_reporter.post_event(event)
|
127
|
-
return True
|
128
|
-
except Exception as e:
|
129
|
-
if attempt >= self._max_retries:
|
130
|
-
print(f"Failed to process event after {attempt} attempts: {e}")
|
131
|
-
return False
|
132
|
-
print(
|
133
|
-
f"Error processing event (attempt {attempt}/{self._max_retries}): {e}"
|
134
|
-
)
|
135
|
-
await asyncio.sleep(0.1 * (2 ** (attempt - 1)))
|
136
|
-
return await process_single_event(event, attempt + 1)
|
137
|
-
|
138
|
-
def process_event(event: ScenarioEvent) -> asyncio.Task[bool]:
|
139
|
-
"""Create an asyncio task to process an event concurrently."""
|
140
|
-
loop = asyncio.get_event_loop()
|
141
|
-
return loop.create_task(process_single_event(event))
|
142
|
-
|
143
|
-
# Set up the event processing pipeline with concurrent processing
|
144
|
-
self._events.pipe(ops.flat_map(lambda event: process_event(event))).subscribe(
|
145
|
-
on_next=lambda success: None,
|
146
|
-
on_completed=lambda: self._processing_complete.set(),
|
147
|
-
on_error=lambda e: print(f"Unexpected error in event stream: {e}"),
|
148
|
-
)
|
149
|
-
|
150
|
-
async def drain(self) -> None:
|
151
|
-
"""
|
152
|
-
Waits for all events to be processed after the stream is completed.
|
153
|
-
|
154
|
-
This method blocks until all events in the processing pipeline have been
|
155
|
-
handled. It should be called after publishing all events to ensure
|
156
|
-
proper cleanup and that no events are lost.
|
157
|
-
|
158
|
-
Note:
|
159
|
-
This method will wait indefinitely if the event stream has not been
|
160
|
-
completed (i.e., if no ScenarioRunFinishedEvent has been published).
|
161
|
-
"""
|
162
|
-
await self._processing_complete.wait()
|
163
|
-
|
164
|
-
def is_completed(self) -> bool:
|
165
|
-
"""
|
166
|
-
Returns whether the event bus has completed processing all events.
|
167
|
-
|
168
|
-
This method provides a non-blocking way to check if all events have
|
169
|
-
been processed. It's useful for monitoring the state of the event bus
|
170
|
-
without blocking execution.
|
171
|
-
|
172
|
-
Returns:
|
173
|
-
True if all events have been processed, False otherwise
|
174
|
-
"""
|
175
|
-
return self._processing_complete.is_set()
|
scenario/events/messages.py
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
from typing import Union, Optional, List
|
2
|
-
from ag_ui.core import (
|
3
|
-
UserMessage as AgUiUserMessage,
|
4
|
-
AssistantMessage as AgUiAssistantMessage,
|
5
|
-
SystemMessage as AgUiSystemMessage,
|
6
|
-
ToolMessage as AgUiToolMessage,
|
7
|
-
ToolCall as AgUiToolCall,
|
8
|
-
FunctionCall as AgUiFunctionCall,
|
9
|
-
)
|
10
|
-
|
11
|
-
class UserMessage(AgUiUserMessage):
|
12
|
-
"""
|
13
|
-
An AG-UI user message extended with the to_dict method.
|
14
|
-
Enforces role='user' and requires content.
|
15
|
-
"""
|
16
|
-
def __init__(self, id: str, content: str, name: Optional[str] = None):
|
17
|
-
super().__init__(id=id, role="user", content=content, name=name)
|
18
|
-
|
19
|
-
def to_dict(self):
|
20
|
-
"""Convert the UserMessage to a dictionary representation."""
|
21
|
-
return self.model_dump(exclude_none=True)
|
22
|
-
|
23
|
-
class AssistantMessage(AgUiAssistantMessage):
|
24
|
-
"""
|
25
|
-
An AG-UI assistant message extended with the to_dict method.
|
26
|
-
Enforces role='assistant' and allows optional content and tool_calls.
|
27
|
-
"""
|
28
|
-
def __init__(self, id: str, content: Optional[str] = None, tool_calls: Optional[List['ToolCall']] = None, name: Optional[str] = None):
|
29
|
-
super().__init__(id=id, role="assistant", content=content, tool_calls=tool_calls, name=name)
|
30
|
-
|
31
|
-
def to_dict(self):
|
32
|
-
"""Convert the AssistantMessage to a dictionary representation."""
|
33
|
-
return self.model_dump(exclude_none=True)
|
34
|
-
|
35
|
-
class SystemMessage(AgUiSystemMessage):
|
36
|
-
"""
|
37
|
-
An AG-UI system message extended with the to_dict method.
|
38
|
-
Enforces role='system' and requires content.
|
39
|
-
"""
|
40
|
-
def __init__(self, id: str, content: str, name: Optional[str] = None):
|
41
|
-
super().__init__(id=id, role="system", content=content, name=name)
|
42
|
-
|
43
|
-
def to_dict(self):
|
44
|
-
"""Convert the SystemMessage to a dictionary representation."""
|
45
|
-
return self.model_dump(exclude_none=True)
|
46
|
-
|
47
|
-
class ToolMessage(AgUiToolMessage):
|
48
|
-
"""
|
49
|
-
An AG-UI tool message extended with the to_dict method.
|
50
|
-
Enforces role='tool' and requires content and tool_call_id.
|
51
|
-
"""
|
52
|
-
def __init__(self, id: str, content: str, tool_call_id: str):
|
53
|
-
super().__init__(id=id, role="tool", content=content, tool_call_id=tool_call_id)
|
54
|
-
|
55
|
-
def to_dict(self):
|
56
|
-
"""Convert the ToolMessage to a dictionary representation."""
|
57
|
-
return self.model_dump(exclude_none=True)
|
58
|
-
|
59
|
-
class ToolCall(AgUiToolCall):
|
60
|
-
"""
|
61
|
-
An AG-UI tool call extended with the to_dict method.
|
62
|
-
Enforces type='function' and requires id and function.
|
63
|
-
"""
|
64
|
-
def __init__(self, id: str, function: 'FunctionCall'):
|
65
|
-
super().__init__(id=id, type="function", function=function)
|
66
|
-
|
67
|
-
def to_dict(self):
|
68
|
-
"""Convert the ToolCall to a dictionary representation."""
|
69
|
-
return self.model_dump(exclude_none=True)
|
70
|
-
|
71
|
-
class FunctionCall(AgUiFunctionCall):
|
72
|
-
"""
|
73
|
-
An AG-UI function call extended with the to_dict method.
|
74
|
-
Requires name and arguments.
|
75
|
-
"""
|
76
|
-
def __init__(self, name: str, arguments: str):
|
77
|
-
super().__init__(name=name, arguments=arguments)
|
78
|
-
|
79
|
-
def to_dict(self):
|
80
|
-
"""Convert the FunctionCall to a dictionary representation."""
|
81
|
-
return self.model_dump(exclude_none=True)
|
82
|
-
|
83
|
-
# Union type alias for all message types
|
84
|
-
Message = Union[UserMessage, AssistantMessage, SystemMessage, ToolMessage, ToolCall, FunctionCall]
|
File without changes
|
File without changes
|
File without changes
|