|
17 | 17 |
|
18 | 18 |
|
19 | 19 | if TYPE_CHECKING: |
20 | | - pass |
| 20 | + from typing import Any |
21 | 21 |
|
22 | 22 |
|
23 | 23 | HF_VERSION = package_version("huggingface-hub") |
@@ -471,14 +471,14 @@ def mock_hf_chat_completion_api_streaming_tools(httpx_mock): |
471 | 471 | @pytest.mark.parametrize("send_default_pii", [True, False]) |
472 | 472 | @pytest.mark.parametrize("include_prompts", [True, False]) |
473 | 473 | def test_text_generation( |
474 | | - sentry_init, |
475 | | - capture_events, |
476 | | - capture_items, |
477 | | - send_default_pii, |
478 | | - include_prompts, |
479 | | - mock_hf_text_generation_api, |
480 | | - stream_gen_ai_spans, |
481 | | -): |
| 474 | + sentry_init: "Any", |
| 475 | + capture_events: "Any", |
| 476 | + capture_items: "Any", |
| 477 | + send_default_pii: "Any", |
| 478 | + include_prompts: "Any", |
| 479 | + mock_hf_text_generation_api: "Any", |
| 480 | + stream_gen_ai_spans: "Any", |
| 481 | +) -> None: |
482 | 482 | sentry_init( |
483 | 483 | traces_sample_rate=1.0, |
484 | 484 | send_default_pii=send_default_pii, |
@@ -606,14 +606,14 @@ def test_text_generation( |
606 | 606 | @pytest.mark.parametrize("send_default_pii", [True, False]) |
607 | 607 | @pytest.mark.parametrize("include_prompts", [True, False]) |
608 | 608 | def test_text_generation_streaming( |
609 | | - sentry_init, |
610 | | - capture_events, |
611 | | - capture_items, |
612 | | - send_default_pii, |
613 | | - include_prompts, |
614 | | - mock_hf_text_generation_api_streaming, |
615 | | - stream_gen_ai_spans, |
616 | | -): |
| 609 | + sentry_init: "Any", |
| 610 | + capture_events: "Any", |
| 611 | + capture_items: "Any", |
| 612 | + send_default_pii: "Any", |
| 613 | + include_prompts: "Any", |
| 614 | + mock_hf_text_generation_api_streaming: "Any", |
| 615 | + stream_gen_ai_spans: "Any", |
| 616 | +) -> None: |
617 | 617 | sentry_init( |
618 | 618 | traces_sample_rate=1.0, |
619 | 619 | send_default_pii=send_default_pii, |
@@ -739,14 +739,14 @@ def test_text_generation_streaming( |
739 | 739 | @pytest.mark.parametrize("send_default_pii", [True, False]) |
740 | 740 | @pytest.mark.parametrize("include_prompts", [True, False]) |
741 | 741 | def test_chat_completion( |
742 | | - sentry_init, |
743 | | - capture_events, |
744 | | - capture_items, |
745 | | - send_default_pii, |
746 | | - include_prompts, |
747 | | - mock_hf_chat_completion_api, |
748 | | - stream_gen_ai_spans, |
749 | | -): |
| 742 | + sentry_init: "Any", |
| 743 | + capture_events: "Any", |
| 744 | + capture_items: "Any", |
| 745 | + send_default_pii: "Any", |
| 746 | + include_prompts: "Any", |
| 747 | + mock_hf_chat_completion_api: "Any", |
| 748 | + stream_gen_ai_spans: "Any", |
| 749 | +) -> None: |
750 | 750 | sentry_init( |
751 | 751 | traces_sample_rate=1.0, |
752 | 752 | send_default_pii=send_default_pii, |
@@ -876,14 +876,14 @@ def test_chat_completion( |
876 | 876 | @pytest.mark.parametrize("send_default_pii", [True, False]) |
877 | 877 | @pytest.mark.parametrize("include_prompts", [True, False]) |
878 | 878 | def test_chat_completion_streaming( |
879 | | - sentry_init, |
880 | | - capture_events, |
881 | | - capture_items, |
882 | | - send_default_pii, |
883 | | - include_prompts, |
884 | | - mock_hf_chat_completion_api_streaming, |
885 | | - stream_gen_ai_spans, |
886 | | -): |
| 879 | + sentry_init: "Any", |
| 880 | + capture_events: "Any", |
| 881 | + capture_items: "Any", |
| 882 | + send_default_pii: "Any", |
| 883 | + include_prompts: "Any", |
| 884 | + mock_hf_chat_completion_api_streaming: "Any", |
| 885 | + stream_gen_ai_spans: "Any", |
| 886 | +) -> None: |
887 | 887 | sentry_init( |
888 | 888 | traces_sample_rate=1.0, |
889 | 889 | send_default_pii=send_default_pii, |
@@ -938,7 +938,6 @@ def test_chat_completion_streaming( |
938 | 938 | "thread.id": mock.ANY, |
939 | 939 | "thread.name": mock.ANY, |
940 | 940 | } |
941 | | - |
942 | 941 | # usage is not available in older versions of the library |
943 | 942 | if HF_VERSION and HF_VERSION >= (0, 26, 0): |
944 | 943 | expected_data["gen_ai.usage.input_tokens"] = 183 |
@@ -1016,12 +1015,12 @@ def test_chat_completion_streaming( |
1016 | 1015 | @pytest.mark.parametrize("stream_gen_ai_spans", [True, False]) |
1017 | 1016 | @pytest.mark.httpx_mock(assert_all_requests_were_expected=False) |
1018 | 1017 | def test_chat_completion_api_error( |
1019 | | - sentry_init, |
1020 | | - capture_events, |
1021 | | - capture_items, |
1022 | | - mock_hf_api_with_errors, |
1023 | | - stream_gen_ai_spans, |
1024 | | -): |
| 1018 | + sentry_init: "Any", |
| 1019 | + capture_events: "Any", |
| 1020 | + capture_items: "Any", |
| 1021 | + mock_hf_api_with_errors: "Any", |
| 1022 | + stream_gen_ai_spans: "Any", |
| 1023 | +) -> None: |
1025 | 1024 | sentry_init( |
1026 | 1025 | traces_sample_rate=1.0, |
1027 | 1026 | stream_gen_ai_spans=stream_gen_ai_spans, |
@@ -1130,12 +1129,12 @@ def test_chat_completion_api_error( |
1130 | 1129 | @pytest.mark.parametrize("stream_gen_ai_spans", [True, False]) |
1131 | 1130 | @pytest.mark.httpx_mock(assert_all_requests_were_expected=False) |
1132 | 1131 | def test_span_status_error( |
1133 | | - sentry_init, |
1134 | | - capture_events, |
1135 | | - capture_items, |
1136 | | - mock_hf_api_with_errors, |
1137 | | - stream_gen_ai_spans, |
1138 | | -): |
| 1132 | + sentry_init: "Any", |
| 1133 | + capture_events: "Any", |
| 1134 | + capture_items: "Any", |
| 1135 | + mock_hf_api_with_errors: "Any", |
| 1136 | + stream_gen_ai_spans: "Any", |
| 1137 | +) -> None: |
1139 | 1138 | client = get_hf_provider_inference_client() |
1140 | 1139 |
|
1141 | 1140 | sentry_init( |
@@ -1198,13 +1197,13 @@ def test_span_status_error( |
1198 | 1197 | @pytest.mark.parametrize("send_default_pii", [True, False]) |
1199 | 1198 | @pytest.mark.parametrize("include_prompts", [True, False]) |
1200 | 1199 | def test_chat_completion_with_tools( |
1201 | | - sentry_init, |
1202 | | - capture_events, |
1203 | | - capture_items, |
1204 | | - send_default_pii, |
1205 | | - include_prompts, |
1206 | | - mock_hf_chat_completion_api_tools, |
1207 | | - stream_gen_ai_spans, |
| 1200 | + sentry_init: "Any", |
| 1201 | + capture_events: "Any", |
| 1202 | + capture_items: "Any", |
| 1203 | + send_default_pii: "Any", |
| 1204 | + include_prompts: "Any", |
| 1205 | + mock_hf_chat_completion_api_tools: "Any", |
| 1206 | + stream_gen_ai_spans: "Any", |
1208 | 1207 | ): |
1209 | 1208 | sentry_init( |
1210 | 1209 | traces_sample_rate=1.0, |
@@ -1354,14 +1353,14 @@ def test_chat_completion_with_tools( |
1354 | 1353 | @pytest.mark.parametrize("send_default_pii", [True, False]) |
1355 | 1354 | @pytest.mark.parametrize("include_prompts", [True, False]) |
1356 | 1355 | def test_chat_completion_streaming_with_tools( |
1357 | | - sentry_init, |
1358 | | - capture_events, |
1359 | | - capture_items, |
1360 | | - send_default_pii, |
1361 | | - include_prompts, |
1362 | | - mock_hf_chat_completion_api_streaming_tools, |
1363 | | - stream_gen_ai_spans, |
1364 | | -): |
| 1356 | + sentry_init: "Any", |
| 1357 | + capture_events: "Any", |
| 1358 | + capture_items: "Any", |
| 1359 | + send_default_pii: "Any", |
| 1360 | + include_prompts: "Any", |
| 1361 | + mock_hf_chat_completion_api_streaming_tools: "Any", |
| 1362 | + stream_gen_ai_spans: "Any", |
| 1363 | +) -> None: |
1365 | 1364 | sentry_init( |
1366 | 1365 | traces_sample_rate=1.0, |
1367 | 1366 | send_default_pii=send_default_pii, |
|
0 commit comments