(platform: str, sync: bool, requests: list[httpx2.Request] | None = None)
| 53 | |
| 54 | |
| 55 | def platform_client(platform: str, sync: bool, requests: list[httpx2.Request] | None = None) -> Any: |
| 56 | def respond(request: httpx2.Request) -> httpx2.Response: |
| 57 | if requests is not None: |
| 58 | requests.append(request) |
| 59 | return httpx2.Response(200, json=MESSAGE) |
| 60 | |
| 61 | transport = httpx2.MockTransport(respond) |
| 62 | if platform == "bedrock": |
| 63 | if sync: |
| 64 | return AnthropicBedrock( |
| 65 | aws_region="us-east-1", api_key="fake-api-key", http_client=httpx2.Client(transport=transport) |
| 66 | ) |
| 67 | return AsyncAnthropicBedrock( |
| 68 | aws_region="us-east-1", api_key="fake-api-key", http_client=httpx2.AsyncClient(transport=transport) |
| 69 | ) |
| 70 | |
| 71 | if sync: |
| 72 | return AnthropicVertex( |
| 73 | region="us-east5", |
| 74 | project_id="fake-project", |
| 75 | access_token="fake-access-token", |
| 76 | http_client=httpx2.Client(transport=transport), |
| 77 | ) |
| 78 | return AsyncAnthropicVertex( |
| 79 | region="us-east5", |
| 80 | project_id="fake-project", |
| 81 | access_token="fake-access-token", |
| 82 | http_client=httpx2.AsyncClient(transport=transport), |
| 83 | ) |
| 84 | |
| 85 | |
| 86 | def public_members(value: object) -> set[str]: |
no test coverage detected