Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
52cc294
Form created
mrowe23 Aug 15, 2024
0ebec61
backend file stuff
tendau Aug 15, 2024
80140d3
Attempt file upload 1
mrowe23 Aug 15, 2024
afb853a
move to poetry
tendau Aug 19, 2024
a35ef8e
change to artifact feed
tendau Aug 19, 2024
3cf9c0f
adding build.sh
tendau Aug 19, 2024
82721b1
add appscv.yaml remove build
tendau Aug 19, 2024
87deef9
update to appsvc
tendau Aug 19, 2024
634caa2
appsvc.yaml changes
tendau Aug 19, 2024
14517e0
Changing appsvc to include poentry config step
tendau Aug 19, 2024
21616d7
appsvc updates
tendau Aug 19, 2024
c91459c
Change env names
tendau Aug 19, 2024
fa1e72a
add debug logging
tendau Aug 19, 2024
0a10b57
Added tnr ai tools
tendau Aug 19, 2024
28db418
update appsvc pre-build
tendau Aug 19, 2024
5f91a63
added poetry lock
dennisfeng20 Aug 19, 2024
d7366f8
minimal working version of UpdatedOrchestrator
dennisfeng20 Aug 20, 2024
fdb1d8b
use API key or managed ID
dennisfeng20 Aug 20, 2024
cbe1389
added dynamic form and loading dialog
mrowe23 Aug 21, 2024
fdfbf39
Compiled changes from last push.
mrowe23 Aug 21, 2024
5dfb91c
On submit downloads file and new loading messages.
mrowe23 Aug 21, 2024
1138973
added to docstring, ready to start implementing file handling of conv…
dennisfeng20 Aug 21, 2024
dba3136
merged profile matching UI branch
dennisfeng20 Aug 22, 2024
c1547ed
formatted with black
dennisfeng20 Aug 22, 2024
8a629ce
added to poetry requirements
dennisfeng20 Aug 22, 2024
bfce513
draft of file attachment handling for dynamic form orch
dennisfeng20 Aug 22, 2024
07ba059
added poetry shell to start.cmd
dennisfeng20 Aug 22, 2024
841132f
draft of structuring JSONChat to give dynamic forma data in endpoint …
dennisfeng20 Aug 22, 2024
5aaf729
fixed ad_token_provider bug in dynamicFormOrchestrator
dennisfeng20 Aug 26, 2024
020328a
moved all env variables into env_params
dennisfeng20 Aug 28, 2024
f023145
wip conversation_with_data
dennisfeng20 Aug 28, 2024
573ca07
wip for conversation_with_data
dennisfeng20 Aug 29, 2024
1442638
draft of conversation_with_data
dennisfeng20 Aug 29, 2024
1ff5e4f
script test file has working LM call with RAG using system assigned m…
dennisfeng20 Aug 30, 2024
ba40fad
cleaned up the pytest for LM call using RAG
dennisfeng20 Aug 30, 2024
83427e5
refactored the pytest slightly
dennisfeng20 Aug 30, 2024
6b7374e
working LM + RAG , using vector simple hybrid query type, which requi…
dennisfeng20 Aug 30, 2024
faf7871
msrchat successfully gives expected structured output, but code is me…
dennisfeng20 Sep 3, 2024
29e02bd
cleaned up code in dynamic form orch
dennisfeng20 Sep 4, 2024
f665da8
remove unnecessary print statements
dennisfeng20 Sep 4, 2024
78cafb2
add TODO for using file in conversation_with_data
dennisfeng20 Sep 4, 2024
e0721d9
added more comments
dennisfeng20 Sep 4, 2024
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
13 changes: 13 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": [
"development"
],
"hints": {
"axe/forms": [
"default",
{
"select-name": "off"
}
]
}
}
22 changes: 16 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,29 @@ def should_use_data():

return False


@app.route("/conversation", methods=["GET", "POST"])
def conversation():
message_uuid = str(uuid.uuid4())
request_body = request.json
return conversation_internal(request_body, message_uuid)

def conversation_internal(request_body, message_uuid):
request_body = None
file = request.files.get("file", None)

request_body = {}
for key in request.form:
try:
request_body[key] = json.loads(request.form[key])
except json.JSONDecodeError:
request_body[key] = request.form[key]
return conversation_internal(request_body, message_uuid, file)

def conversation_internal(request_body, message_uuid, file=None):
try:
print(request_body)
use_data = should_use_data()
if use_data:
return orchestrator.conversation_with_data(request_body, message_uuid)
return orchestrator.conversation_with_data(request_body, message_uuid, file)
else:
return orchestrator.conversation_without_data(request_body, message_uuid)
return orchestrator.conversation_without_data(request_body, message_uuid, file)
except Exception as e:
logging.exception("Exception in /conversation")
return jsonify({"error": str(e)}), 500
Expand Down
5 changes: 5 additions & 0 deletions appsvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 1

pre-build: |
export POETRY_HTTP_BASIC_TNRDEV_USERNAME=agent
export POETRY_HTTP_BASIC_TNRDEV_PASSWORD=$AZURE_ARTIFACTS_PAT
4 changes: 2 additions & 2 deletions backend/orchestrators/AdvancedOrchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self):
self.load_balancer = LoadBalancer()

# Post chat info if data configured
def conversation_with_data(self, request_body, message_uuid):
def conversation_with_data(self, request_body, message_uuid, file=None):
logging.debug(f"ADV ORCH COVO W/ DATA")
# Get a weighted random OpenAIContext object
openai_context = self.load_balancer.get_openai_context()
Expand Down Expand Up @@ -57,7 +57,7 @@ def conversation_with_data(self, request_body, message_uuid):
return Response(super().stream_with_data(body, headers, endpoint, message_uuid, history_metadata), mimetype='text/event-stream')

# Post chat info if data not configured
def conversation_without_data(self, request_body, message_uuid):
def conversation_without_data(self, request_body, message_uuid, file=None):
# Get a weighted random OpenAIContext object
openai_context = self.load_balancer.get_openai_context()

Expand Down
15 changes: 12 additions & 3 deletions backend/orchestrators/DefaultOrchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class DefaultOrchestrator(Orchestrator):
# Post chat info if data configured
def conversation_with_data(self, request_body, message_uuid):
def conversation_with_data(self, request_body, message_uuid, file=None):
# Set up request variables
body, headers = super().prepare_body_headers_with_data(request)
base_url = super().AZURE_OPENAI_ENDPOINT if super().AZURE_OPENAI_ENDPOINT else f"https://{super().AZURE_OPENAI_RESOURCE}.openai.azure.com/"
Expand Down Expand Up @@ -32,7 +32,7 @@ def conversation_with_data(self, request_body, message_uuid):
return Response(super().stream_with_data(body, headers, endpoint, message_uuid, history_metadata), mimetype='text/event-stream')

# Post chat info if data not configured
def conversation_without_data(self, request_body, message_uuid):
def conversation_without_data(self, request_body, message_uuid, file=None):
# Setup for direct query to OpenAI
openai.api_type = "azure"
openai.api_base = super().AZURE_OPENAI_ENDPOINT if super().AZURE_OPENAI_ENDPOINT else f"https://{super().AZURE_OPENAI_RESOURCE}.openai.azure.com/"
Expand All @@ -50,11 +50,20 @@ def conversation_without_data(self, request_body, message_uuid):

for message in request_messages:
if message:
# if message starts with User Provided File: then skip
if message["content"].startswith("User Provided File: "):
continue
messages.append({
"role": message["role"] ,
"content": message["content"]
"content": f"{message['content']}"
})

if(file):
messages.append({
"role": "user",
"content": f"User Provided File: {super().parse_file(file)}"
})

history_metadata = request_body.get("history_metadata", {})
history_metadata = super().conversation_client.create_conversation_item(
request_body,
Expand Down
Loading