Skip to content

An intelligent case resolution system for Salesforce that leverages AI and Retrieval Augmented Generation (RAG) to provide solutions based on your knowledge articles.

License

Notifications You must be signed in to change notification settings

rahul07bagul/Salesforce-CaseSolver-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Salesforce Case Resolver with AI and RAG

An intelligent case resolution system for Salesforce that leverages AI and Retrieval Augmented Generation (RAG) to provide solutions based on your knowledge articles.

Python MongoDB ChromaDB Salesforce OpenAI Gemini

Overview

This application connects your Salesforce instance with an AI-powered backend that:

  1. Receives case data from Salesforce
  2. Uses a RAG-based approach to find relevant information in your knowledge base
  3. Generates comprehensive solutions using AI (Gemini model)
  4. Returns formatted HTML solutions directly to your Salesforce interface

The system uses ChromaDB as a vector database and OpenAI embeddings to effectively retrieve contextually relevant information from your knowledge articles.

Demo

Design

Architecture

Design

Demo Implementation

The current implementation demonstrates the system using:

  • Knowledge articles scraped from Purdue University
  • Vector embeddings stored in ChromaDB
  • Flask server for API endpoints
  • LWC component integration in Salesforce

Installation

Prerequisites

  • Python 3.8+
  • OpenAI API Key
  • Google Gemini API Key
  • MongoDB
  • ngrok (for local development testing)

Backend Setup

  1. Setup
git clone https://github.com/rahul07bagul/Salesforce-CaseSolver-AI.git
cd python_server
pip install -r requirements.txt
  1. Create .env file with below content and add your API keys
GEMINI_API_KEY=""
GEMINI_MODEL_NAME="gemini-2.0-flash"
GEMINI_EMBEDDING_MODEL_NAME="gemini-embedding-exp-03-07"
OPENAI_API_KEY=
OPENAI_EMBEDDING_MODEL_NAME="text-embedding-3-small"
MONGODB_URI="mongodb://localhost:27017/"
MONGODB_DB_NAME="SFDC_AI"
CURRENT_MODEL="Gemini"
  1. Process knowledge articles (one-time setup):
python run_pipeline.py

This will:

  • Process the sample Purdue articles (from the provided JSON file)
  • Store them in MongoDB
  • Create vector embeddings in ChromaDB
  1. Start the Flask server:
python app.py
  1. For local development, expose your server using ngrok:
ngrok http 5000

Salesforce Setup

  1. Add the ngrok URL to Salesforce Trusted Sites:
    • Setup > Trusted URL > New
    • Add the ngrok URL (or your production server URL)
  2. Create a Custom Label for your endpoint:
    • Setup > Custom Labels > New
    • Create a new label (e.g., "Python_App_URL")
    • Set the value to your server URL + "api/v1/cases/get_resolution"
  3. Deploy the LWC component:
    • Use the LWC component code provided in the repository
    • Update the API endpoint reference to use your Custom Label
  4. Add the LWC component to the Case Record Page:
    • Setup > Object Manager > Case
    • Lightning Record Pages > Case Record Page
    • Edit layout and add your component

Usage

  1. Open a Case in Salesforce
  2. Click the "Get Resolution" button in your LWC component
  3. The system will:
    • Send case data to your Flask server
    • Process the case using RAG and AI
    • Return a formatted solution
    • Display the solution in the Salesforce interface

About

An intelligent case resolution system for Salesforce that leverages AI and Retrieval Augmented Generation (RAG) to provide solutions based on your knowledge articles.

Topics

Resources

License

Stars

Watchers

Forks