Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added albatross/.DS_Store
Binary file not shown.
41 changes: 41 additions & 0 deletions albatross/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Gen-Ai-Rush-Buildathon

## Team Name - Albatross

Problem Statement - As modern enterprises increasingly utilize various tools for data sharing (Slack, Notion, Mailchimp etc), the inadvertent inclusion of Personally Identifiable Information (PII) by employees poses a significant challenge. Ensuring anonymity by appropriately handling PII is vital to comply with privacy regulations, protect data security, and maintain trust.

Team Leader Email - [email protected]

## A Brief of the Prototype:
The grand vision is to run a AI model on enterprise server which will keep montoring any exchange of data happening and will stop/warn if theere is any sensitive data leak.

For POC purpose, we have added this model between the usage of LLMs, and will prevent giving sensitive data to online LLMs.

## Tech Stack:
Python
Flask
Javascript
React
OpenaAI
GenAI


## Step-by-Step Code Execution Instructions:
There are 2 different services

For securex-fe, it is a frontend interface written in react
Steps to run on local machine
1. npm install
2. npm start

For securex-be, it is a microservice written in flask using python
Steps to urn on local machine
1. Install dependencies mentioned in requirements.txt, go to the directory where requiremnts.txt is then run pip install -r requirements.xtx
2. Run hello.py -> python3 run.py


## What I Learned:
1. We were first trying to setup local models, we learned about inferencing and quantization of models.
2. But the local models were super slow and was not able to perform the task correctly.
3. The bottle neck was computing power of our system.

71 changes: 71 additions & 0 deletions albatross/securex-be/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
from flask import Flask, request, jsonify
import openai
from flask_cors import CORS
import os
from dotenv import load_dotenv, find_dotenv
app = Flask(__name__)
CORS(app)

# OpenAI API key
# Either direclty set or fetch it from environment variable

load_dotenv(find_dotenv())
openai.api_key = os.environ.get("OPENAI_API_KEY")


@app.route('/incog')
def index():
return 'Hello from Flask!'


@app.route('/api', methods=['POST'])
def api():
try:
if not request.json or 'userPrompt' not in request.json:
raise ValueError(
"Request body must be JSON and include a 'userPrompt' key")

user_prompt = request.json['userPrompt']

# First OpenAI API call
# Note: This Redaction of API call is supposed to be done server running on local system.
# We had difficuly setting up local models on our system. So for demo sake we are using OpenAI API.
private_prompt = openai.ChatCompletion.create(
model=
"gpt-4", # replace this with the correct model name for GPT-4 when it becomes available
messages=[
{
"role":
"system",
"content":"Remove any personal information from the prompt like name, address, location, organisation name, age. Dont remove that information which is necessary for the prompt to make sense."
},
{
"role": "user",
"content": user_prompt
},
])

first_response = private_prompt['choices'][0]['message']['content']

# Second OpenAI API call
response = openai.ChatCompletion.create(model="gpt-4",
messages=[
{
"role": "user",
"content": first_response
},
])

final_response = response['choices'][0]['message']['content']

return jsonify(infoData=first_response, chatData=final_response)

except Exception as e:
# Log the error and return a 500 response
print(str(e))
app.logger.error(f"An error occurred: {str(e)}")
return jsonify(error=str(e)), 500


if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8080)
25 changes: 25 additions & 0 deletions albatross/securex-be/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
aiohttp==3.8.5
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
blinker==1.6.2
certifi==2023.7.22
charset-normalizer==3.2.0
click==8.1.6
Flask==2.3.2
Flask-Cors==4.0.0
frozenlist==1.4.0
idna==3.4
importlib-metadata==6.8.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
multidict==6.0.4
openai==0.27.8
python-dotenv==1.0.0
requests==2.31.0
tqdm==4.65.0
urllib3==2.0.4
Werkzeug==2.3.6
yarl==1.9.2
zipp==3.16.2
Binary file added albatross/securex-fe/.DS_Store
Binary file not shown.
Loading