Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>AI and Machine LearningNew to Visual Studio Code? Get it now.
AI and Machine Learning

AI and Machine Learning

MaxiBlinkz

|
2 installs
| (0) | Free
VS Code snippets for AI, machine learning, generative AI, prompt engineering and recommender patterns.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AI & Machine Learning Snippets for VS Code

This extension provides a broad collection of Python snippets for machine learning, generative AI, prompt engineering, recommender systems, and common web app endpoints scaffolding (FastAPI/Flask).

Quick start

  • Install required Python packages for the snippets you plan to use (examples: scikit-learn, pandas, torch, transformers, diffusers, openai, langchain, faiss, chromadb).
  • Open a Python file, type a snippet prefix (prefixes use ml- for classic ML and genai- for generative AI examples), then press Tab to expand.

Where to find snippet details

  • See snippets/README.md for a full list of prefixes and example usage.

Version

  • This release: v0.0.2

Contributing

  • Contributions welcome. Open a PR with new snippets, and ensure JSON validity of snippets/snippets.code-snippets.

License

  • MIT (or adjust as necessary) Machine Learning & Generative AI Snippets

This folder contains VS Code snippets for Python workflows related to machine learning, generative AI, and prompt engineering.

Prefix convention

  • Machine learning snippets use the ml- prefix. Examples:

    • ml-sklearn-imports — common scikit-learn imports
    • ml-sklearn-train — quick scikit-learn train/eval pipeline
    • ml-pandas-prep — pandas quick data prep
    • ml-regression-linear — linear regression training/eval
    • ml-reco-surprise-svd — recommender example (Surprise)
  • Generative AI snippets use the genai- prefix. Examples:

    • genai-hf-generate — Hugging Face text generation
    • genai-hf-finetune — Hugging Face Trainer skeleton
    • genai-hf-t5-summarize — T5 summarization example
    • genai-diffusers-generate — Stable Diffusion generation
    • genai-diffusers-inpaint — Diffusers inpainting example
    • genai-blip-caption — BLIP image captioning
    • genai-openai-chat — OpenAI chat completion example
    • genai-openai-emb — OpenAI embeddings example
    • genai-langchain-basic — LangChain prompt template example
    • genai-prompt-template — prompt-engineering skeleton

How to use

  1. Open a Python file in VS Code.
  2. Type a prefix (for example genai-hf-generate or ml-pandas-prep) and press Tab or select the snippet from the IntelliSense menu.
  3. Fill in placeholders (${1:...}) and adapt variable names to your code.

Notes & recommendations

  • Some snippets reference placeholder variables like numeric_cols, categorical_cols, train_ds, text, and target. Replace them with your actual variables.
  • Ensure required packages are installed in your environment (scikit-learn, pandas, torch, transformers, diffusers, openai, langchain, fastapi, etc.) before running snippet code.
  • For OpenAI/other API usage, set appropriate environment variables (ex: OPENAI_API_KEY).

Want more?

  • I can add short alias prefixes (e.g., ml-skl), JS/TS snippets, or more specialized templates (cross-validation workflows, data validation with Great Expectations, dataset loaders, or MLOps deployment snippets). Reply with which you prefer.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft