Skip to content
SP StackPractices

Tag: ai-pattern

Browse 8 practical software engineering resources tagged with "ai-pattern". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving ai-pattern.

Agent Tool Selection Pattern

Dynamically select which tools an LLM agent can use based on the task context. Reduce token usage and improve decision quality by narrowing the tool set.

Embedding Cache Pattern

Cache LLM embeddings to reduce API calls and cost. Store embeddings with a content hash key and serve from cache on repeated inputs.

Human-in-the-Loop Pattern

Pause LLM agent execution for human approval before high-impact actions. Route decisions to a reviewer when confidence is low or stakes are high.

LLM Fallback Pattern

Fall back to alternative LLM providers or models when the primary fails. Handle rate limits, timeouts, and errors gracefully with a provider chain.

LLM Guardrails Pattern

Validate LLM inputs and outputs with rules, classifiers, and content filters. Prevent prompt injection, toxic content, and data leakage before reaching users.

LLM Router Pattern

Route queries to different LLM models based on complexity, cost, and latency requirements. Classify input before dispatching to the right model.

Prompt Chaining Pattern

Chain multiple LLM calls where each step's output feeds the next step's input. Break complex tasks into smaller, verifiable prompts for better results.

RAG Hybrid Search Pattern

Combine keyword (BM25) and semantic (vector) search to improve retrieval accuracy in RAG pipelines. Fuse ranked results using reciprocal rank fusion.