|
8 | 8 | normalize_pydantic_schema, |
9 | 9 | ) |
10 | 10 | from hyperbrowser.models import ( |
| 11 | + CuaBaseUrls, |
11 | 12 | CreateSandboxParams, |
12 | 13 | CreateSessionParams, |
13 | 14 | StartBrowserUseTaskParams, |
| 15 | + StartCuaTaskParams, |
14 | 16 | ) |
15 | 17 | from hyperbrowser.tools import _normalize_extract_tool_params |
16 | 18 |
|
@@ -76,6 +78,36 @@ def test_mapping_uses_existing_cross_field_validation(): |
76 | 78 | ) |
77 | 79 |
|
78 | 80 |
|
| 81 | +def test_cua_custom_base_url_serializes_for_mapping_and_legacy_model(): |
| 82 | + mapping = { |
| 83 | + "task": "Complete the task", |
| 84 | + "use_custom_api_keys": True, |
| 85 | + "api_keys": {"openai": "openai-key"}, |
| 86 | + "base_urls": { |
| 87 | + "openai": "https://example.openai.azure.com/openai/v1/", |
| 88 | + }, |
| 89 | + } |
| 90 | + legacy = StartCuaTaskParams( |
| 91 | + task="Complete the task", |
| 92 | + use_custom_api_keys=True, |
| 93 | + api_keys={"openai": "openai-key"}, |
| 94 | + base_urls=CuaBaseUrls(openai="https://example.openai.azure.com/openai/v1/"), |
| 95 | + ) |
| 96 | + |
| 97 | + assert dump_request(mapping, StartCuaTaskParams) == dump_request( |
| 98 | + legacy, |
| 99 | + StartCuaTaskParams, |
| 100 | + ) |
| 101 | + assert dump_request(mapping, StartCuaTaskParams) == { |
| 102 | + "task": "Complete the task", |
| 103 | + "useCustomApiKeys": True, |
| 104 | + "apiKeys": {"openai": "openai-key"}, |
| 105 | + "baseUrls": { |
| 106 | + "openai": "https://example.openai.azure.com/openai/v1/", |
| 107 | + }, |
| 108 | + } |
| 109 | + |
| 110 | + |
79 | 111 | def test_raw_json_schema_is_copied_without_rewriting_or_dereferencing(): |
80 | 112 | schema = { |
81 | 113 | "$defs": { |
|
0 commit comments