MCPcopy Create free account
hub / github.com/apache/maka / testConnectionModel

Function testConnectionModel

packages/runtime/src/test-connection.ts:177–215  ·  view source on GitHub ↗
(
  connection: ConnectionEffectConnection,
  secret: string,
  testModel: string,
  fetchFn: ConnectionEffectFetch | undefined,
  t0: number,
  timeoutMs = CONNECTION_TEST_TIMEOUT_MS,
)

Source from the content-addressed store, hash-verified

175}
176
177async function testConnectionModel(
178 connection: ConnectionEffectConnection,
179 secret: string,
180 testModel: string,
181 fetchFn: ConnectionEffectFetch | undefined,
182 t0: number,
183 timeoutMs = CONNECTION_TEST_TIMEOUT_MS,
184): Promise<ConnectionTestResult> {
185 const { adapter, baseUrl, wire } = resolveModelRuntime(connection, testModel);
186
187 switch (adapter.kind) {
188 case 'anthropic':
189 case 'claude-subscription':
190 return await probeAnthropic(connection, baseUrl, secret, testModel, t0, fetchFn);
191 case 'openai':
192 return wire === 'openai-responses'
193 ? await probeOpenAIResponses(baseUrl, secret, testModel, t0, fetchFn)
194 : await probeOpenAI(connection, baseUrl, secret, testModel, t0, fetchFn, timeoutMs);
195 case 'openai-codex':
196 return await probeOpenAI(connection, baseUrl, secret, testModel, t0, fetchFn, timeoutMs);
197 case 'openai-compatible':
198 return wire === 'openai-responses'
199 ? await probeOpenAIResponses(baseUrl, secret, testModel, t0, fetchFn)
200 : await probeOpenAI(connection, baseUrl, secret, testModel, t0, fetchFn, timeoutMs);
201 case 'github-copilot':
202 return await probeGitHubCopilot(baseUrl, secret, testModel, t0, fetchFn);
203 case 'google':
204 return await probeGoogle(
205 baseUrl,
206 secret,
207 testModel,
208 t0,
209 adapter.normalizeBaseUrl !== false,
210 fetchFn,
211 );
212 case 'cohere':
213 return await probeCohere(baseUrl, secret, testModel, t0, fetchFn);
214 }
215}
216
217async function probeGitHubCopilot(
218 baseUrl: string,

Callers 1

testConnectionStrictFunction · 0.85

Calls 7

resolveModelRuntimeFunction · 0.85
probeAnthropicFunction · 0.85
probeOpenAIResponsesFunction · 0.85
probeOpenAIFunction · 0.85
probeGitHubCopilotFunction · 0.85
probeGoogleFunction · 0.85
probeCohereFunction · 0.85

Tested by

no test coverage detected