|
1 | 1 | import base64
|
2 | 2 | import json
|
3 |
| -<<<<<<< HEAD |
4 |
| -from typing import Any, List, Optional, cast |
5 |
| -from unittest.mock import MagicMock |
6 |
| -======= |
7 | 3 | from typing import Any, List, Literal, Optional, cast
|
8 |
| ->>>>>>> master |
| 4 | +from unittest.mock import MagicMock |
9 | 5 |
|
10 | 6 | import httpx
|
11 | 7 | import pytest
|
@@ -1229,7 +1225,7 @@ def has_tool_calling(self) -> bool:
|
1229 | 1225 | if not self.has_tool_calling:
|
1230 | 1226 | pytest.skip("Test requires tool calling.")
|
1231 | 1227 |
|
1232 |
| - schema, validation_function = _get_joke_class(schema_type) # type: ignore[arg-type] |
| 1228 | + schema, validation_function = _get_joke_class(schema_type) # type: ignore[arg-type] |
1233 | 1229 | chat = model.with_structured_output(schema, **self.structured_output_kwargs)
|
1234 | 1230 | mock_callback = MagicMock()
|
1235 | 1231 | mock_callback.on_chat_model_start = MagicMock()
|
@@ -1308,7 +1304,9 @@ def has_tool_calling(self) -> bool:
|
1308 | 1304 | }
|
1309 | 1305 |
|
1310 | 1306 | @pytest.mark.parametrize("schema_type", ["pydantic", "typeddict", "json_schema"])
|
1311 |
| - async def test_structured_output_async(self, model: BaseChatModel, schema_type: str) -> None: |
| 1307 | + async def test_structured_output_async( |
| 1308 | + self, model: BaseChatModel, schema_type: str |
| 1309 | + ) -> None: |
1312 | 1310 | """Test to verify structured output is generated both on invoke and stream.
|
1313 | 1311 |
|
1314 | 1312 | This test is optional and should be skipped if the model does not support
|
@@ -1338,9 +1336,8 @@ def has_tool_calling(self) -> bool:
|
1338 | 1336 | if not self.has_tool_calling:
|
1339 | 1337 | pytest.skip("Test requires tool calling.")
|
1340 | 1338 |
|
1341 |
| - schema, validation_function = _get_joke_class(schema_type) # type: ignore[arg-type] |
| 1339 | + schema, validation_function = _get_joke_class(schema_type) # type: ignore[arg-type] |
1342 | 1340 |
|
1343 |
| - # Pydantic class |
1344 | 1341 | chat = model.with_structured_output(schema, **self.structured_output_kwargs)
|
1345 | 1342 | ainvoke_callback = _TestCallbackHandler()
|
1346 | 1343 |
|
|
0 commit comments