File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,14 @@ print(resp.output_text)
46
46
import OpenAI from " openai" ;
47
47
const client = new OpenAI ();
48
48
49
- const resp = await client .responses .create ({
49
+ const resp = await client .chat . completions .create ({
50
50
model: " gpt-4o" ,
51
- instructions: " You are a concise technical explainer." ,
52
- input: " In one paragraph, explain what a token is in an LLM."
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
+ ]
53
55
});
54
- console .log (resp .output_text );
56
+ console .log (resp .choices [ 0 ]. message . content );
55
57
```
56
58
57
59
> ** 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