Skip to main content

RFP Questions using Google Colab

Product Documentation: Using Google Colab to Create a Utility for Asking RFP Questions via the AI12Z Copilot Platform with Excel Input

Introduction

This guide explains how to use Google Colab to create a utility that queries predefined questions related to RFP (Request for Proposals) and retrieves answers from the AI12Z Copilot Platform. This version of the utility takes an Excel file as input, where the questions are stored in a column. The utility uses the AI12Z API to analyze previously uploaded RFP documents and website content.

Prerequisites

Before proceeding, ensure you have:

  • A Google account for accessing Google Colab.
  • Access to the AI12Z Copilot Platform and an API key.
  • An Excel file containing a column named Question with RFP-related questions.
  • Familiarity with Python and basic data handling using Pandas.

Getting Started

Step 1: Access Google Colab

  1. Go to Google Colab.
  2. Sign in with your Google account if prompted.

Step 2: Create a New Notebook

  1. Click on File > New Notebook to create a new Python notebook.
  2. Rename the notebook by clicking on the title.

Step 3: Set Up the Colab Environment

In your new Colab notebook, paste the following code. This script will upload an Excel file, read questions from the Question column, query the AI12Z Copilot API, and retrieve the answers.

from google.colab import files
import requests
import json
import pandas as pd # Import pandas for DataFrame operations

# AI12Z API endpoint for querying
api_endpoint = "https://api.ai12z.net/api/askai"

# Headers for the API request
headers = {
"Accept": "application/json",
"User-Agent": "Mozilla/5.0"
}

# Upload the Excel file with questions
uploaded = files.upload()

# Load the uploaded Excel file into a pandas DataFrame
for filename in uploaded.keys():
df = pd.read_excel(filename)

# Check if 'Question' column exists
if 'Question' not in df.columns:
raise ValueError("The uploaded Excel file must contain a 'Question' column.")

# Use your own API key for authentication with the AI12Z platform
api_key = "Add your API key"

# List to store the results
results = []

# Loop over each question in the Excel file
for question in df['Question']:
data = {
"query": question,
"conversationId": "", # Keep blank or set a conversation ID if required
"apiKey": api_key,
"format": "markdown", # Request response in markdown format
"includeTags": [],
"excludeTags": []
}

# Send the request to the AI12Z API
response = requests.post(api_endpoint, headers=headers, json=data, timeout=60).json()

# Print the question and the corresponding answer from the API
print(question)
print(response["answer"])

# Append the question and its answer to the results list
results.append({
'Question': question,
'Answer': response['answer']
})

# Convert the results list into a pandas DataFrame for easy manipulation
df_results = pd.DataFrame(results)

# Write the DataFrame to a new Excel file
output_filename = 'results.xlsx'
df_results.to_excel(output_filename, index=False)

# Download the new Excel file to your local machine
files.download(output_filename)

Step 4: Prepare the Excel File

Ensure your Excel file contains a column labeled Question, where each row contains a question you want to ask. For example:

Question
What is your company's mission statement?
What security certifications does your company hold?
Can you provide examples of previous clients in healthcare?

You can add as many questions as you need.

Step 5: Upload the Excel File and Run the Notebook

  1. When prompted by the notebook, upload the prepared Excel file.
  2. Click on the code cell and press Shift + Enter to run the script.
  3. The notebook will read your questions from the uploaded Excel file, send them to the AI12Z platform, and display the corresponding answers.

Step 6: Download the Results

Once the notebook completes running, a new Excel file named results.xlsx will be generated and downloaded to your local machine. The file will contain two columns: Question and Answer, where the Question column holds the RFP questions from your Excel file and the Answer column holds the corresponding responses from the AI12Z platform.

Example Output:

QuestionAnswer
What is your company's mission statement?Our mission is to...
What security certifications does your company hold?We are certified in...
Can you provide examples of previous clients in healthcare?Previous clients include...

Additional Notes

  1. API Key: Ensure that your API key is correctly set in the api_key variable.
  2. Error Handling: If you encounter any issues (e.g., API errors or incorrect responses), refer to the AI12Z API documentation for troubleshooting steps.
  3. File Format: The results are saved as an Excel file, but you can modify the script to save the results as a CSV file if preferred.

Conclusion

By following this guide, you can quickly and efficiently query an RFP database using the AI12Z Copilot platform, with your questions conveniently stored in an Excel file. This method is ideal for retrieving answers to commonly asked RFP questions, making it a useful tool for organizations preparing proposals or responding to requests.