File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -46,14 +46,12 @@ print(resp.output_text)
46
46
import OpenAI from " openai" ;
47
47
const client = new OpenAI ();
48
48
49
- const resp = await client .chat . completions .create ({
49
+ const resp = await client .responses .create ({
50
50
model: " gpt-4o" ,
51
- messages: [
52
- { role: " system" , content: " You are a concise technical explainer." },
53
- { role: " user" , content: " In one paragraph, explain what a token is in an LLM." }
54
- ]
51
+ instructions: " You are a concise technical explainer." ,
52
+ input: " In one paragraph, explain what a token is in an LLM."
55
53
});
56
- console .log (resp .choices [ 0 ]. message . content );
54
+ console .log (resp .output_text );
57
55
```
58
56
59
57
> ** Tip.** Model names evolve; check your Models list before shipping. Prefer streaming for chat‑like UIs (see below).
You can’t perform that action at this time.
0 commit comments