MCPcopy Create free account
hub / github.com/AI45Lab/Code / runLiveTests

Function runLiveTests

sdk/node/examples/basic/test_api_alignment.ts:200–279  ·  view source on GitHub ↗
(_apiKey: string)

Source from the content-addressed store, hash-verified

198const apiKey = process.env.KIMI_API_KEY;
199
200async function runLiveTests(_apiKey: string) {
201 section('Phase 2: Live integration tests (kimi-k2.5)');
202
203 const cwd = process.cwd();
204
205 // --- 2a: basic send ---
206 console.log('\n 2a. Basic send');
207 try {
208 const agent = await Agent.create(KIMI_ACL_CONFIG);
209 const session = agent.session(cwd);
210 const result = await session.send('Reply with exactly: HELLO');
211 check('basic send returns result', result != null);
212 check('basic send has text', Boolean(result?.text));
213 check('basic send contains HELLO', (result?.text ?? '').toUpperCase().includes('HELLO'),
214 `got: ${result?.text?.slice(0, 80)}`);
215 } catch (e: any) {
216 check('basic send', false, String(e));
217 }
218
219 // --- 2b: temperature ---
220 console.log('\n 2b. temperature in SessionOptions');
221 try {
222 const agent = await Agent.create(KIMI_ACL_CONFIG);
223 const session = agent.session(cwd, {
224 model: 'openai/kimi-k2.5',
225 temperature: 0.0,
226 });
227 const result = await session.send('Reply with exactly: TEMPERATURE_OK');
228 check('temperature=0.0 accepted', result != null);
229 check('temperature=0.0 has text', Boolean(result?.text),
230 `got: ${result?.text?.slice(0, 80)}`);
231 } catch (e: any) {
232 check('temperature via SessionOptions', false, String(e));
233 }
234
235 // --- 2c: continuationEnabled=false ---
236 console.log('\n 2c. continuationEnabled=false');
237 try {
238 const agent = await Agent.create(KIMI_ACL_CONFIG);
239 const session = agent.session(cwd, { continuationEnabled: false });
240 const result = await session.send('Reply with exactly: CONT_OK');
241 check('continuationEnabled=false accepted', result != null);
242 check('continuationEnabled=false has text', Boolean(result?.text),
243 `got: ${result?.text?.slice(0, 80)}`);
244 } catch (e: any) {
245 check('continuationEnabled=false', false, String(e));
246 }
247
248 // --- 2d: maxContinuationTurns=1 ---
249 console.log('\n 2d. maxContinuationTurns=1');
250 try {
251 const agent = await Agent.create(KIMI_ACL_CONFIG);
252 const session = agent.session(cwd, { maxContinuationTurns: 1 });
253 const result = await session.send('Reply with exactly: TURNS_OK');
254 check('maxContinuationTurns=1 accepted', result != null);
255 } catch (e: any) {
256 check('maxContinuationTurns=1', false, String(e));
257 }

Callers 1

mainFunction · 0.85

Calls 6

sectionFunction · 0.70
checkFunction · 0.70
logMethod · 0.45
createMethod · 0.45
sessionMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected