All Guides
LangChain Setup and Usage
Install the LangChain framework and develop AI applications. Chains, memory and tools.
Advanced30 min
Setup Steps
1. Install LangChain via pip:
pip install langchain langchain-openai langchain-community2. Set environment variables:
export OPENAI_API_KEY="sk-..."
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY="ls__..."3. Create a simple chain:
python
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
llm = ChatOpenAI(model="gpt-4o")
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful assistant."),
("user", "{input}")
])
chain = prompt | llm
response = chain.invoke({"input": "Hello!"})
print(response.content)4. RAG (Retrieval-Augmented Generation) example:
pip install faiss-cpu5. Document loader usage:
python
from langchain_community.document_loaders import TextLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
loader = TextLoader('document.txt')
docs = loader.load()
splitter = RecursiveCharacterTextSplitter(chunk_size=1000)
chunks = splitter.split_documents(docs)Related Guides
Claude Code Setup
Install Anthropic Claude Code CLI on your server or PC. API key configuration and basic commands.
ChatGPT API Setup
Integrate OpenAI ChatGPT API into your project. Getting API keys and sending your first request.
Google Gemini API Setup
Set up Google Gemini (formerly Bard) API and use it in your projects.
Midjourney Usage Guide
Create AI-powered images with Midjourney. Step-by-step guide for Discord usage.