This cloud function automatically processes Request for Proposal (RFP) Excel sheets using Google's Vertex AI and Discovery Engine. It transforms requirements into questions, generates responses using RAG (Retrieval-Augmented Generation), and provides referenced answers from your knowledge base.
- 🤖 Automated RFP response generation
- 📝 Answers questions based on the RFP requirements
- 🔍 RAG-based answer generation using Discovery Engine
- 📚 Provides source references for each answer
- 📊 Maintains Excel formatting with proper styling
- ♻️ Automatic retry mechanism for API failures
- 🔄 Processes multiple sheets within a workbook
- Google Cloud Project with enabled APIs:
- Vertex AI API
- Discovery Engine API
- Cloud Storage API
- Python 3.7+
- Required Python packages:
functions-framework google-cloud-storage pandas vertexai openpyxl requests google-auth
- Clone this repository
- Set up your Google Cloud project:
export PROJECT_ID="your-project-id" gcloud config set project $PROJECT_ID
- Enable required APIs:
gcloud services enable \ aiplatform.googleapis.com \ discoveryengine.googleapis.com \ storage.googleapis.com
- Configure Discovery Engine with your knowledge base
- Update the project configurations in the code:
- Update
project_id
ininitialize_vertex_ai()
- Update Discovery Engine URL in
call_discovery_engine()
- Update
- Upload your RFP Excel file to the configured Google Cloud Storage bucket
- The cloud function automatically triggers and processes the file
- A new file with prefix
processed_
will be created in the same bucket - Download the processed file containing:
- Original requirements
- Generated questions
- RAG-based responses
- Reference sources
The function supports Excel files with the following column names:
Bank Requirement
orrequirements
- Contains the RFP requirements- Additional columns will be preserved, and new columns will be added:
Questions
- Generated Yes/No questionsVendor Response
- RAG-generated answersReferences
- Source documents references
- Implements exponential backoff retry mechanism
- Handles API failures gracefully
- Skips already processed files
- Validates sheet structure before processing
- Processing time depends on the number of requirements
- 20-second delay between RAG queries to respect API limits
- Maximum 3 reference sources per response
- Answers are limited to 100-200 words
Tejan Gavandi
- Google Vertex AI
- Google Discovery Engine
- Cloud Functions Framework