-
+
+
+
+
+
+
ETL Convy
+
+
+
+
+
+
Upload XML File
+
+
+
+
+
+
+
From b6b059f6a5e5f8138f0236503c75712ac5b57d5b Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 17:58:32 +0530
Subject: [PATCH 04/11] Create app_bk.py
---
app_bk.py | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 app_bk.py
diff --git a/app_bk.py b/app_bk.py
new file mode 100644
index 000000000..3d1808cf6
--- /dev/null
+++ b/app_bk.py
@@ -0,0 +1,32 @@
+import os
+
+from flask import (Flask, redirect, render_template, request,
+ send_from_directory, url_for)
+
+app = Flask(__name__)
+
+
+@app.route('/')
+def index():
+ print('Request for index page received')
+ return render_template('index.html')
+
+@app.route('/favicon.ico')
+def favicon():
+ return send_from_directory(os.path.join(app.root_path, 'static'),
+ 'favicon.ico', mimetype='image/vnd.microsoft.icon')
+
+@app.route('/hello', methods=['POST'])
+def hello():
+ name = request.form.get('name')
+
+ if name:
+ print('Request for hello page received with name=%s' % name)
+ return render_template('hello.html', name = name)
+ else:
+ print('Request for hello page received with no name or blank name -- redirecting')
+ return redirect(url_for('index'))
+
+
+if __name__ == '__main__':
+ app.run()
From 5ce35fbce72eb150742a0551830d5943f15cac7e Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:00:00 +0530
Subject: [PATCH 05/11] Create styles.css
---
templates/styles.css | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 templates/styles.css
diff --git a/templates/styles.css b/templates/styles.css
new file mode 100644
index 000000000..4e7fc9866
--- /dev/null
+++ b/templates/styles.css
@@ -0,0 +1,21 @@
+* {
+ font-family: Arial, Helvetica, sans-serif;
+ }
+
+ html, body {
+ margin: 0;
+ border: 0;
+ padding: 0;
+ background-color: #fff;
+ }
+
+ main {
+ margin: auto;
+ width: 50%;
+ padding: 20px;
+ }
+
+ main > h1 {
+ text-align: center;
+ font-size: 3.5em;
+ }
From bf0843376e7b8f176a478d5a4e7c0da51825170d Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:41:26 +0530
Subject: [PATCH 06/11] Update app.py
---
app.py | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/app.py b/app.py
index 3d1808cf6..7ea2606e5 100644
--- a/app.py
+++ b/app.py
@@ -1,7 +1,9 @@
import os
from flask import (Flask, redirect, render_template, request,
- send_from_directory, url_for)
+ send_from_directory, url_for, jsonify, send_file)
+import json
+import azure_oai_connector
app = Flask(__name__)
@@ -9,7 +11,35 @@
@app.route('/')
def index():
print('Request for index page received')
- return render_template('index.html')
+ return render_template('index.html') # Render index page
+
+@app.route('/uploads', methods=['POST'])
+def process_xml():
+ try:
+ xml_file = request.files['file']
+ xml_content = xml_file.read() # Read the XML content
+
+ # Call Azure OAI and process the response
+ # (Replace this with your actual logic)
+ # For demonstration purposes, we'll return a dummy response
+ azure_oai_response = azure_oai_connector.process_xml_data(xml_content)
+
+ print("response")
+ print(azure_oai_response)
+
+ # Save the response as a JSON file (optional)
+ with open('azure_oai_response.json', 'w') as json_file:
+ json.dump(azure_oai_response, json_file, indent=4)
+
+ # Inside your process_xml route
+ return jsonify({'message': 'Processing successful. Download the JSON file:', 'file_link': '/download/response.json'}), 200
+
+ except Exception as e:
+ return jsonify({'error': str(e)}), 500
+
+@app.route('/download/response.json')
+def download_response():
+ return send_file('azure_oai_response.json', as_attachment=True)
@app.route('/favicon.ico')
def favicon():
From cb9719a7006bcb8d80b613399244f3b0a7355650 Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:43:21 +0530
Subject: [PATCH 07/11] Create azure_oai_connector.py
---
azure_oai_connector.py | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 azure_oai_connector.py
diff --git a/azure_oai_connector.py b/azure_oai_connector.py
new file mode 100644
index 000000000..578f1aed0
--- /dev/null
+++ b/azure_oai_connector.py
@@ -0,0 +1,37 @@
+import os
+
+from promptflow.core import Prompty, AzureOpenAIModelConfiguration
+
+AZURE_OPENAI_ENDPOINT="https://aoai-etl.openai.azure.com/"
+AZURE_OPENAI_CHAT_DEPLOYMENT="Trial4o"
+AZURE_OPENAI_API_KEY="c81b1674d1f84cccbbd858fa136f6405"
+AZURE_OPENAI_API_VERSION="2024-02-15-preview"
+
+model_config = AzureOpenAIModelConfiguration(
+ azure_deployment=AZURE_OPENAI_CHAT_DEPLOYMENT,
+ api_key=AZURE_OPENAI_API_KEY,
+ api_version=AZURE_OPENAI_API_VERSION,
+ azure_endpoint=AZURE_OPENAI_ENDPOINT
+)
+
+prompty = Prompty.load("chat.prompty", model={'configuration': model_config})
+
+# in_file_object = open("m_Sample_Hackathon.xml", "r+")
+# input_xml = in_file_object.read()
+
+#print(result)
+
+# oai_connector.py
+def process_xml_data(xml_data):
+ print("In aoi connector")
+ # response = prompty(
+ # # chat_history=[
+ # # {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},
+ # # {"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."}
+ # # ],
+ # chat_input=xml_data)
+
+ # Code to send XML data to Azure OpenAI and return the response
+ ...
+ response = {'message': 'response from Azure OAI json response'}
+ return response
From fd49d910ccda942daf80c68b235bdd818207e335 Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:44:28 +0530
Subject: [PATCH 08/11] Create chat.prompty
---
chat.prompty | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 chat.prompty
diff --git a/chat.prompty b/chat.prompty
new file mode 100644
index 000000000..70eb794a9
--- /dev/null
+++ b/chat.prompty
@@ -0,0 +1,33 @@
+---
+name: Chat Prompt
+description: A basic prompt that uses the chat API to answer questions
+model:
+ api: chat
+ configuration:
+ type: azure_openai
+ parameters:
+ max_tokens: 256
+ temperature: 0.2
+inputs:
+ chat_input:
+ type: string
+ chat_history:
+ type: list
+ is_chat_history: true
+ default: []
+outputs:
+ response:
+ type: string
+sample:
+ chat_input: What is the meaning of life?
+---
+system:
+You are an AI assistant who can convert Informatica XML template file to Azure Data Factory (ADF) pipeline JSON file including all field based transformations, source and target mappings.
+
+{% for item in history %}
+{{item.role}}:
+{{item.content}}
+{% endfor %}
+
+user:
+{{chat_input}}
From ce0b90a0a4885fac08b126dbc86ac0fc100a3ce5 Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:46:48 +0530
Subject: [PATCH 09/11] Update requirements.txt
---
requirements.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/requirements.txt b/requirements.txt
index c785af01f..4085d55d3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,9 @@
Flask==2.2.2
gunicorn
Werkzeug==2.2.2
+promptflow==1.14.0
+promptflow-core==1.14.0
+promptflow-devkit==1.14.0
+promptflow-tracing==1.14.0
+jsonschema==4.23.0
+jsonschema-specifications==2023.12.1
From c5d3401117adbf3ce1fee466039ab776155ffb3b Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:55:38 +0530
Subject: [PATCH 10/11] Update requirements.txt
---
requirements.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 4085d55d3..493910df1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,6 @@
-Flask==2.2.2
+Flask==3.0.3
+Flask-Cors==4.0.1
+flask-restx==1.3.0
gunicorn
Werkzeug==2.2.2
promptflow==1.14.0
From 8e80cd65402e635a2a990e47b8899766e4e468e1 Mon Sep 17 00:00:00 2001
From: MANKARNI <45879275+MANKARNI@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:57:45 +0530
Subject: [PATCH 11/11] Update requirements.txt
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 493910df1..4ca681a20 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@ Flask==3.0.3
Flask-Cors==4.0.1
flask-restx==1.3.0
gunicorn
-Werkzeug==2.2.2
+Werkzeug
promptflow==1.14.0
promptflow-core==1.14.0
promptflow-devkit==1.14.0