Skip to content
Back to skills

Llm Integration

ASecurity

Guide for integrating Large Language Models into applications.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 5, 2026
ai-agentspythonapisecurityperformance

Works with

  • api

Security analysis

A100/100

Scanned June 5, 2026

npx -y skills add Burburton/amazingteam --skill llm-integration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Llm Integration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Llm Integration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/burburton-llm-integration/badge)](https://www.skillsdirectory.com/skills/burburton-llm-integration)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# LLM Integration Skill

## Purpose

Guide for integrating Large Language Models into applications.

## Framework Choice

- **LangChain**: Full-featured LLM framework
- **LlamaIndex**: RAG-focused
- **Direct API**: OpenAI/Anthropic SDKs

## Basic Integration

```python
from langchain_openai import ChatOpenAI
from langchain.schema import HumanMessage, SystemMessage

llm = ChatOpenAI(model="gpt-4", temperature=0.7)

response = llm.invoke([
    SystemMessage(content="You are a helpful assistant."),
    HumanMessage(content="Hello!")
])
```

## Prompt Engineering

### System Prompts

```python
SYSTEM_PROMPT = """You are an expert code reviewer.
Analyze code for:
- Security vulnerabilities
- Performance issues
- Best practice violations

Respond in JSON format."""
```

### Few-Shot Examples

```python
examples = [
    {"input": "def add(a, b): return a + b", 
     "output": "Valid: Simple addition function"},
    {"input": "eval(user_input)", 
     "output": "Critical: Code injection risk"},
]
```

## RAG Patterns

### Vector Store Integration

```python
from langchain.vectorstores import Chroma
from langchain.embeddings import OpenAIEmbeddings

embeddings = OpenAIEmbeddings()
vectorstore = Chroma.from_documents(documents, embeddings)

results = vectorstore.similarity_search(query, k=4)
```

### Retrieval Chain

```python
from langchain.chains import RetrievalQA

qa_chain = RetrievalQA.from_chain_type(
    llm=llm,
    retriever=vectorstore.as_retriever(),
    return_source_documents=True
)
```

## Cost Optimization

1. Use smaller models for simple tasks
2. Implement caching for repeated queries
3. Batch requests when possible
4. Monitor token usage

## Error Handling

```python
from openai import RateLimitError, APIError

try:
    response = llm.invoke(messages)
except RateLimitError:
    # Implement backoff retry
    time.sleep(60)
    response = llm.invoke(messages)
except APIError as e:
    logger.error(f"API Error: {e}")
    raise
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.