Update CLI tool to modify user prompt for file creation, change model to 'gpt-5-mini', and adjust verbosity levels for text and reasoning. Enable output logging for function call results and deltas.
This commit is contained in:
18
cli.js
18
cli.js
@@ -23,8 +23,7 @@ async function loadTools() {
|
||||
return Object.fromEntries(toolEntries);
|
||||
}
|
||||
|
||||
|
||||
streamOnce(new OpenAI({ apiKey: process.env.OPENAI_API_KEY }), 'Zeig mir die Dateiein in /');
|
||||
streamOnce(new OpenAI({ apiKey: process.env.OPENAI_API_KEY }), 'Zeig mir die Dateiein in / und lege index.html an mit dummydaten, kurz');
|
||||
|
||||
async function streamOnce(openai, userText) {
|
||||
const toolsByFile = await loadTools();
|
||||
@@ -39,10 +38,10 @@ async function streamOnce(openai, userText) {
|
||||
console.log('input:', input.length);
|
||||
|
||||
const call = {
|
||||
model: 'gpt-5-nano',
|
||||
model: 'gpt-5-mini',
|
||||
input: input,
|
||||
text: { format: { type: 'text' }, verbosity: 'low' },
|
||||
reasoning: { effort: 'high', summary: 'detailed' },
|
||||
text: { format: { type: 'text' }, verbosity: 'medium' },
|
||||
reasoning: { effort: 'low', summary: 'detailed' },
|
||||
tools: Object.values(toolsByFile).map(t => t.def),
|
||||
store: true,
|
||||
}
|
||||
@@ -55,10 +54,10 @@ async function streamOnce(openai, userText) {
|
||||
}
|
||||
});
|
||||
stream.on('response.reasoning_summary_text.delta', (event) => {
|
||||
//process.stdout.write(event.delta);
|
||||
process.stdout.write(event.delta);
|
||||
});
|
||||
stream.on('response.reasoning_summary_text.done', () => {
|
||||
//process.stdout.write('\n');
|
||||
process.stdout.write('\n');
|
||||
//clear on next delta
|
||||
});
|
||||
|
||||
@@ -73,7 +72,7 @@ async function streamOnce(openai, userText) {
|
||||
}
|
||||
});
|
||||
stream.on('response.function_call_arguments.delta', (event) => {
|
||||
//process.stdout.write(event.delta);
|
||||
process.stdout.write(event.delta);
|
||||
});
|
||||
|
||||
const functionCalls = [];
|
||||
@@ -88,6 +87,7 @@ async function streamOnce(openai, userText) {
|
||||
} catch (e){
|
||||
console.error('Error parsing arguments:', e, event.item.arguments);
|
||||
}
|
||||
console.log('function call:', id, name);
|
||||
functionCalls.push({ id, name, args, promise: toolsByFile[name].run(args) });
|
||||
}
|
||||
});
|
||||
@@ -107,7 +107,7 @@ async function streamOnce(openai, userText) {
|
||||
call_id: call.id,
|
||||
output: JSON.stringify(result),
|
||||
})
|
||||
//console.log('function call result:', call,result);
|
||||
console.log('function call result:', call,result);
|
||||
} catch (err) {
|
||||
console.error('Error in function call:', call.name, err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user