#ai
75 snippets tagged with #ai
Claude Messages API (Anthropic SDK)
Send messages to Claude using the official Anthropic SDK with system prompt and user turn.
Best for: AI assistant
DALL·E 3 Image Generation
Generate images from a text prompt using the OpenAI DALL·E 3 API and return a URL.
Best for: AI art generation
Content Moderation with OpenAI
Check user input for harmful content using the OpenAI Moderation API before processing.
Best for: user input safety
Next.js AI Streaming Route Handler
Stream OpenAI responses from a Next.js App Router route handler using the Vercel AI SDK.
Best for: AI chatbot backend
RAG Pipeline Implementation
Build a retrieval-augmented generation pipeline that grounds LLM answers in your own documents.
Best for: Grounding LLM answers in private documents
Build a RAG Pipeline with LangChain
Implement retrieval-augmented generation using LangChain, embeddings, and a vector store.
Best for: Knowledge base Q&A
OpenAI Structured Output with Pydantic
Force GPT to return validated JSON matching a Pydantic schema.
Best for: Review analysis
Prompt Template Engineering Patterns
Design reusable, parameterized prompt templates for consistent LLM outputs.
Best for: Consistent LLM outputs
Semantic Similarity Search with Embeddings
Compute and compare text embeddings for semantic search and matching.
Best for: Semantic search
Text Classification with Hugging Face
Fine-tune or use pre-trained Hugging Face models for text classification.
Best for: Sentiment analysis
OpenAI Function Calling / Tool Use
Let GPT call your functions by defining tool schemas and handling responses.
Best for: AI agents
Stream LLM Chat Responses
Stream OpenAI chat completions token-by-token for real-time UI updates.
Best for: Chat UIs
Token Counting and Cost Estimation
Count tokens accurately and estimate API costs before making LLM calls.
Best for: Budget management
Analyze Images with GPT Vision API
Send images to GPT-4o for description, analysis, and visual Q&A.
Best for: Image analysis
Build a ReAct Agent Loop
Implement a reasoning-action loop for an AI agent that uses tools iteratively.
Best for: AI agents
Output Guardrails for LLM Responses
Validate and sanitize LLM outputs to prevent hallucination and injection.
Best for: Safety filtering
Batch Process Embeddings Efficiently
Process large datasets of embeddings with batching, caching, and rate limiting.
Best for: Large-scale indexing
Prepare a Fine-Tuning Dataset for OpenAI
Format, validate, and upload training data for OpenAI model fine-tuning.
Best for: Model customization
LangChain Conversation with Memory
Maintain conversation context across turns using LangChain memory modules.
Best for: Multi-turn chatbots
Ollama Local LLM Inference
Run local LLM inference using Ollama REST API with streaming and model management.
Best for: local development
ChromaDB Vector Database Operations
Store and query vector embeddings using ChromaDB for semantic search and RAG applications.
Best for: semantic search
LLM Output Evaluation and Scoring
Evaluate LLM outputs programmatically with scoring rubrics for quality, relevance, and safety.
Best for: prompt testing
Text Chunking Strategies for RAG
Implement different text chunking strategies for RAG pipelines — fixed, recursive, and semantic.
Best for: RAG pipeline preprocessing
OpenAI Vision API Image Analysis
Analyze images using GPT-4o vision capabilities with base64 and URL inputs.
Best for: image captioning
Anthropic Claude Tool Use Pattern
Implement tool/function calling with Claude using the Anthropic SDK for agentic workflows.
Best for: agentic workflows
Transformer Architecture
AI/ML technique: transformer-architecture
Best for: machine learning
Bert Embeddings
AI/ML technique: bert-embeddings
Best for: machine learning
Gpt Fine Tuning
AI/ML technique: gpt-fine-tuning
Best for: machine learning
Llama Models
AI/ML technique: llama-models
Best for: machine learning
Attention Mechanism
AI/ML technique: attention-mechanism
Best for: machine learning
Self Attention
AI/ML technique: self-attention
Best for: machine learning
Multi Head Attention
AI/ML technique: multi-head-attention
Best for: machine learning
Cross Attention
AI/ML technique: cross-attention
Best for: machine learning
Positional Encoding
AI/ML technique: positional-encoding
Best for: machine learning
Rotary Embeddings
AI/ML technique: rotary-embeddings
Best for: machine learning
Tokenization Advanced
AI/ML technique: tokenization-advanced
Best for: machine learning
Bpe Tokenizer
AI/ML technique: bpe-tokenizer
Best for: machine learning
Text Classification
AI/ML technique: text-classification
Best for: machine learning
Sentiment Analysis
AI/ML technique: sentiment-analysis
Best for: machine learning
Named Entity Recognition
AI/ML technique: named-entity-recognition
Best for: machine learning
Semantic Similarity
AI/ML technique: semantic-similarity
Best for: machine learning
Clustering Embeddings
AI/ML technique: clustering-embeddings
Best for: machine learning
Semantic Search Advanced
AI/ML technique: semantic-search-advanced
Best for: machine learning
Reranking Models
AI/ML technique: reranking-models
Best for: machine learning
Retrieval Ranking
AI/ML technique: retrieval-ranking
Best for: machine learning
Knowledge Graphs
AI/ML technique: knowledge-graphs
Best for: machine learning
Ontology Design
AI/ML technique: ontology-design
Best for: machine learning
Entity Linking
AI/ML technique: entity-linking
Best for: machine learning
Relation Extraction
AI/ML technique: relation-extraction
Best for: machine learning
Question Answering System
AI/ML technique: question-answering-system
Best for: machine learning
Open Domain Qa
AI/ML technique: open-domain-qa
Best for: machine learning
Reading Comprehension
AI/ML technique: reading-comprehension
Best for: machine learning
Multi Hop Reasoning
AI/ML technique: multi-hop-reasoning
Best for: machine learning
Machine Translation
AI/ML technique: machine-translation
Best for: machine learning
Transliteration
AI/ML technique: transliteration
Best for: machine learning
Code Generation
AI/ML technique: code-generation
Best for: machine learning
Text To Code
AI/ML technique: text-to-code
Best for: machine learning
Image Captioning
AI/ML technique: image-captioning
Best for: machine learning
Visual Qa
AI/ML technique: visual-qa
Best for: machine learning
Object Detection Models
AI/ML technique: object-detection-models
Best for: machine learning
Segmentation Models
AI/ML technique: segmentation-models
Best for: machine learning
Diffusion Models
AI/ML technique: diffusion-models
Best for: machine learning
Vae Variational
AI/ML technique: vae-variational
Best for: machine learning
Gan Generative
AI/ML technique: gan-generative
Best for: machine learning
Flow Models
AI/ML technique: flow-models
Best for: machine learning
Reinforcement Learning
AI/ML technique: reinforcement-learning
Best for: machine learning
Policy Gradient
AI/ML technique: policy-gradient
Best for: machine learning
Q Learning
AI/ML technique: q-learning
Best for: machine learning
Actor Critic
AI/ML technique: actor-critic
Best for: machine learning
Prompt Engineering
AI/ML technique: prompt-engineering
Best for: machine learning
Rag Evaluation
AI/ML technique: rag-evaluation
Best for: machine learning
Model Distillation
AI/ML technique: model-distillation
Best for: machine learning
Model Quantization
AI/ML technique: model-quantization
Best for: machine learning
Lora Finetuning
AI/ML technique: lora-finetuning
Best for: machine learning
Vector Database Indexing
AI/ML technique: vector-database-indexing
Best for: machine learning