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
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
How to use
- Open a Python file in VS Code.
- Type a prefix (for example
genai-hf-generate or ml-pandas-prep ) and press Tab or select the snippet from the IntelliSense menu.
- 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.
| |