MCPcopy
hub / github.com/andrewyng/aisuite / test_client_chat_completions

Function test_client_chat_completions

tests/client/test_client.py:94–109  ·  view source on GitHub ↗
(
    provider_configs: dict, patch_target: str, provider: str, model: str
)

Source from the content-addressed store, hash-verified

92 ],
93)
94def test_client_chat_completions(
95 provider_configs: dict, patch_target: str, provider: str, model: str
96):
97 expected_response = f"{patch_target}_{provider}_{model}"
98 with patch(patch_target) as mock_provider:
99 mock_provider.return_value = expected_response
100 client = Client()
101 client.configure(provider_configs)
102 messages = [
103 {"role": "system", "content": "You are a helpful assistant."},
104 {"role": "user", "content": "Who won the world series in 2020?"},
105 ]
106
107 model_str = f"{provider}:{model}"
108 model_response = client.chat.completions.create(model_str, messages=messages)
109 assert model_response == expected_response
110
111
112def test_invalid_provider_in_client_config():

Callers

nothing calls this directly

Calls 3

configureMethod · 0.95
ClientClass · 0.90
createMethod · 0.80

Tested by

no test coverage detected