typescriptbeginner
Text Classification
AI/ML technique: text-classification
typescriptPress ⌘/Ctrl + Shift + C to copy
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{ role: "system", content: "Return one label: positive, neutral, or negative" },
{ role: "user", content: "The onboarding was fast and smooth" },
],
temperature: 0,
});
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.
typescriptintermediate
Text To Code
AI/ML technique: text-to-code
Best for: machine learning
#ai#machine-learning
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