typescriptbeginner
Visual Qa
AI/ML technique: visual-qa
typescriptPress ⌘/Ctrl + Shift + C to copy
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const context = "Python was created by Guido van Rossum and released in 1991.";
const q = "Who created Python?";
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: `Context: ${context}\nQuestion: ${q}` }],
});
console.log(resp.choices[0].message.content);Use Cases
- machine learning
- AI applications
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
typescriptbeginner
Transformer Architecture
AI/ML technique: transformer-architecture
Best for: machine learning
#ai#machine-learning
typescriptintermediate
Bert Embeddings
AI/ML technique: bert-embeddings
Best for: machine learning
#ai#machine-learning
typescriptadvanced
Gpt Fine Tuning
AI/ML technique: gpt-fine-tuning
Best for: machine learning
#ai#machine-learning
typescriptbeginner
Llama Models
AI/ML technique: llama-models
Best for: machine learning
#ai#machine-learning