Great — now let’s train your AI agent on company-specific leads, services, and response styles so it answers like your business would, not just like a generic assistant.
🧠 Lesson: Training Your Agent on Company-Specific Leads, Services & Responses
🎯 Lesson Objective
By the end of this lesson, you’ll be able to:
-
Provide your AI agent with deep knowledge of your products, services, offers, and lead types
-
Teach it how your company communicates (tone, structure, policies)
-
Make it respond with branded, accurate, and confident messaging
-
Store and retrieve company-specific information using RAG (Retrieval-Augmented Generation)
🧠 Why Train on Your Own Data?
Generic LLMs are powerful — but they:
-
❌ Don’t know your pricing, services, or guarantees
-
❌ Use generic tone, which may clash with your brand
-
❌ Can’t answer specific lead objections unless trained
Training your agent on company data helps it:
✅ Handle real client questions
✅ Stay consistent with your brand voice
✅ Answer quickly without hallucinating
🧰 Tools You’ll Use
| Tool | Purpose |
|---|---|
LangChain |
Framework for RAG and chaining |
Ollama / OpenAI |
LLM backend |
Chroma / FAISS |
Vector DB to store internal data |
txt / PDF / CSV loaders |
Load your company content |
PromptTemplate |
Brand-style responses |
🔧 Step-by-Step: Training Your Agent
✅ 1. Gather Your Company Data
Collect all sources:
-
Product/service descriptions
-
Price lists
-
FAQ & customer service scripts
-
Past email/chat examples
-
Sales objections & how you handle them
Store in text files (.txt, .pdf, .docx, .md)
✅ 2. Load & Chunk the Data
from langchain.document_loaders import PyPDFLoader, TextLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
# Load documents
loader = TextLoader("company_services.txt") # Or PyPDFLoader("pricing.pdf")
documents = loader.load()
# Split into chunks
splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
docs = splitter.split_documents(documents)
✅ 3. Create a Vector Store (Knowledge Base)
from langchain.vectorstores import Chroma
from langchain.embeddings import OllamaEmbeddings # Or OpenAIEmbeddings
embeddings = OllamaEmbeddings(model="nomic-embed-text")
vectorstore = Chroma.from_documents(docs, embedding=embeddings)
✅ 4. Add Retrieval QA to Your Agent
from langchain.chains import RetrievalQA
from langchain.llms import Ollama
llm = Ollama(model="mistral")
qa_chain = RetrievalQA.from_chain_type(
llm=llm,
retriever=vectorstore.as_retriever(),
return_source_documents=True
)
query = "What’s the difference between our Basic and Premium plans?"
result = qa_chain.run(query)
print("Agent:", result)
✅ 5. Teach Brand Voice with PromptTemplate
from langchain.prompts import PromptTemplate
prompt = PromptTemplate(
input_variables=["question", "context"],
template="""
You are a friendly, helpful customer assistant for GreenTech Solutions.
Answer the following question using only the information provided. Keep the tone {tone} and concise.
Context:
{context}
Question:
{question}
Answer:
"""
)
Plug this into your retrieval agent’s chain to shape tone and format.
🧪 Example Queries It Can Now Answer:
| Query | Agent Answer (Trained) |
|---|---|
| “How long is your warranty?” | “We offer a 24-month warranty on all solar tracking units.” |
| “Do you provide financing?” | “Yes, we partner with GreenBank to offer low-interest financing options.” |
| “Why choose you over [competitor]?” | “Unlike many competitors, we include installation, calibration, and free support for 1 year.” |
🧠 Enhance It Further
| Feature | Description |
|---|---|
| 🎯 Lead-specific replies | Store industry or client type in memory and tailor response |
| 📂 Multi-file indexing | Combine PDFs, web copy, and past chats |
| 🔁 Dynamic updates | Re-index every time your services change |
| 🌐 Use by sales or support teams | Integrate with Streamlit or chatbots |
✅ Summary
| Step | What You Did |
|---|---|
| 🗃️ Gathered company-specific data | Services, policies, pricing, tone |
| 📚 Created a knowledge base | Via vector store & embeddings |
| 💬 Built an AI assistant | That responds accurately and consistently |
| 🧠 Trained it on real company language | Using prompt templates + documents |
🔜 Want to Go Deeper?
Would you like to:
-
🧾 Add live updates from your website or Notion page?
-
👥 Build a multi-user dashboard for sales/support teams?
-
🤖 Create a chatbot version of this trained agent for customers?
49
