22 lines
794 B
JavaScript
22 lines
794 B
JavaScript
import OpenAI from 'openai'
|
|
const client = new OpenAI({
|
|
apiKey:
|
|
'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'
|
|
})
|
|
|
|
const resp = await client.responses.create({
|
|
model: 'gpt-5-nano',
|
|
tools: [
|
|
{
|
|
type: 'code_interpreter',
|
|
container: { type: 'auto', memory_limit: '4g' }
|
|
}
|
|
],
|
|
instructions:
|
|
"You are a python code interpreter running inside a container. When you execute code, you will get the output back. Use this to perform calculations or manipulate data as needed to answer the user's question.",
|
|
input: 'solve 3x+11=58'
|
|
// 'convert "Hello world" to CIDv0 and return the result'
|
|
})
|
|
|
|
console.log(JSON.stringify(resp.output, null, 2))
|