Agent skill
langchain-rate-limit-errors
Sub-skill of langchain: Rate Limit Errors (+2).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/ai/prompting/langchain/rate-limit-errors
SKILL.md
Rate Limit Errors (+2)
Rate Limit Errors
from langchain_openai import ChatOpenAI
from tenacity import retry, wait_exponential, stop_after_attempt
llm = ChatOpenAI(
model="gpt-4",
max_retries=3,
request_timeout=60
)
@retry(wait=wait_exponential(min=1, max=60), stop=stop_after_attempt(5))
def invoke_with_retry(chain, input_data):
return chain.invoke(input_data)
Memory Issues with Large Documents
# Process documents in batches
def batch_process_documents(documents, batch_size=100):
for i in range(0, len(documents), batch_size):
batch = documents[i:i + batch_size]
yield process_batch(batch)
Vector Store Performance
# Use FAISS for larger collections
from langchain_community.vectorstores import FAISS
vectorstore = FAISS.from_documents(
documents,
embeddings,
distance_strategy="COSINE"
)
# Add index for faster retrieval
vectorstore.save_local("faiss_index")
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?