Skip to content

Commit 0699988

Browse files
paytonisonCopilot
andauthored
Update articles/openai-cookbook-llms-101.md
Co-authored-by: Copilot <[email protected]>
1 parent a6c2e27 commit 0699988

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

articles/openai-cookbook-llms-101.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ print(resp.output_text)
4646
import OpenAI from "openai";
4747
const client = new OpenAI();
4848

49-
const resp = await client.responses.create({
49+
const resp = await client.chat.completions.create({
5050
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+
]
5355
});
54-
console.log(resp.output_text);
56+
console.log(resp.choices[0].message.content);
5557
```
5658

5759
> **Tip.** Model names evolve; check your Models list before shipping. Prefer streaming for chat‑like UIs (see below).

0 commit comments

Comments
 (0)