StackPractices

Code Recipes

Practical, copy-paste code recipes in Python, JavaScript, Java, SQL, and more. Solve real development problems with tested, runnable examples.

431 results

advanced

Build Autonomous AI Agents with Tool Use and Reasoning

How to design AI agents that autonomously plan, execute tools, and iterate toward goals using...

advanced

AI Agents with Tool Use

Build autonomous AI agents that can use external tools and APIs to accomplish complex tasks.

beginner

OpenAI Assistants API Chatbot: Build, Cost & Deploy

How to create an AI chatbot using the OpenAI Assistants API with function calling and file search.

intermediate

Generate Images Programmatically with AI Models

How to create, edit, and optimize images using DALL-E, Stable Diffusion, and Midjourney APIs with...

advanced

Fine-Tune a Language Model for Code Generation

How to fine-tune an LLM for code using LoRA and QLoRA on consumer GPUs.

intermediate

Apply Prompt Engineering: What Works

How to write useful prompts for LLMs using role assignment, few-shot examples, chain-of-thought...

advanced

Build Stateful AI Agents with LangGraph State Machines

Create multi-step AI agents with LangGraph using state machines, conditional edges, tool calling,...

advanced

Fine-Tune and Deploy Text Classifiers with Hugging Face

Fine-tune a pre-trained transformer model for text classification using Hugging Face Trainer,...

intermediate

Compose LCEL Chains in LangChain for Multi-Step LLM

Build composable LLM pipelines with LangChain Expression Language (LCEL) using pipes, parallel...

intermediate

Evaluate RAG Quality with RAGAS Metrics

Measure RAG pipeline quality using RAGAS framework metrics — faithfulness, answer relevancy,...

intermediate

Stream LLM Output with Server-Sent Events (SSE)

Stream LLM responses to clients in real-time using Server-Sent Events with FastAPI, OpenAI...

intermediate

Run LLMs Locally with Ollama for Private Inference

Install and use Ollama to run open-source LLMs locally with Python, including streaming,...

intermediate

Compare Text Semantic Similarity with OpenAI Embeddings

Generate text embeddings with OpenAI and compute cosine similarity to measure semantic similarity...

intermediate

Structured JSON Output from OpenAI Function Calling

Use OpenAI function calling and structured outputs to get reliable JSON from LLMs with Pydantic...

python openai function-calling ai
intermediate

a Local RAG Pipeline with ChromaDB and Sentence Transformers

Implement retrieval-augmented generation locally with ChromaDB, sentence-transformers embeddings,...

intermediate

Sentiment Analysis with Python and NLTK

Score text sentiment using NLTK VADER and custom lexicons in Python. Classify reviews, process...

ai python nlp text-processing
intermediate

Store and Query Embeddings in Pinecone Vector Database

Use Pinecone to store, query, and filter vector embeddings for semantic search with metadata...

intermediate

Build a RAG Pipeline with LangChain and Vector Databases

How to build a Retrieval-Augmented Generation (RAG) pipeline using LangChain and vector databases...

intermediate

Build Semantic Search with Embeddings in Python, JS, Java

Build a semantic search engine with text embeddings and vector similarity. Includes Python,...

intermediate

Build a Slack Bot with OpenAI GPT-4

How to build a conversational Slack bot powered by OpenAI GPT-4 that responds to mentions and...

No results found.