-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest-riza-error.js
More file actions
44 lines (36 loc) 路 1.06 KB
/
Copy pathtest-riza-error.js
File metadata and controls
44 lines (36 loc) 路 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
import { ToolProxy } from './cli/tool-proxy.js';
// Test RIZA API key error handling
async function testRizaErrorHandling() {
console.log('馃И Testing RIZA API Key Error Handling...\n');
// Temporarily remove RIZA_API_KEY
const originalKey = process.env.RIZA_API_KEY;
process.env.RIZA_API_KEY = undefined;
try {
const toolProxy = new ToolProxy();
const toolCall = {
id: 'test-123',
type: 'tool_call',
toolName: 'execute_code',
parameters: {
language: 'python',
code: 'print("hello world")',
},
};
console.log('馃摛 Executing code without RIZA_API_KEY...');
const result = await toolProxy.executeToolCall(toolCall);
console.log('馃摜 Result:');
console.log(`Success: ${result.success}`);
if (result.success) {
console.log(`Output: ${result.result}`);
} else {
console.log(`Error: ${result.error}`);
}
} finally {
// Restore original key
if (originalKey) {
process.env.RIZA_API_KEY = originalKey;
}
}
}
testRizaErrorHandling();