Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce byod orchestrator #2

Merged
merged 10 commits into from
Nov 15, 2024
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# rest client tests for local development and testing
*.http

# generated frontend files
code/dist/

Expand Down
Empty file added code/backend/__init__.py
Empty file.
21 changes: 11 additions & 10 deletions code/backend/batch/get_conversation_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ async def do_get_conversation_response(req: func.HttpRequest) -> func.HttpRespon
lambda x: x["role"] in ("user", "assistant"), req_body["messages"][0:-1]
)
)
chat_history = []
for i, k in enumerate(user_assistant_messages):
if i % 2 == 0:
chat_history.append(
(
user_assistant_messages[i]["content"],
user_assistant_messages[i + 1]["content"],
)
)
# JM commented out
# chat_history = []
# for i, k in enumerate(user_assistant_messages):
# if i % 2 == 0:
# chat_history.append(
# (
# user_assistant_messages[i]["content"],
# user_assistant_messages[i + 1]["content"],
# )
# )

messages = await message_orchestrator.handle_message(
user_message=user_message,
chat_history=chat_history,
chat_history=user_assistant_messages, # was chat_history, #JM changed
conversation_id=conversation_id,
orchestrator=ConfigHelper.get_active_config_or_default().orchestrator,
)
Expand Down
14 changes: 0 additions & 14 deletions code/backend/batch/local.settings.json.sample

This file was deleted.

19 changes: 13 additions & 6 deletions code/backend/batch/utilities/common/source_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,22 @@ def from_json(cls, json_string):

@classmethod
def from_dict(cls, dict_obj):
"""
Create a SourceDocument instance from a dictionary.

:param dict_obj: Dictionary containing the SourceDocument attributes, at least the mandatory ones.
:return: SourceDocument instance.
"""
return cls(
dict_obj["id"],
# using dict.get() for the optional attributes
dict_obj["content"],
dict_obj["source"],
dict_obj["title"],
dict_obj["chunk"],
dict_obj["offset"],
dict_obj["page_number"],
dict_obj["chunk_id"],
dict_obj.get("id"),
dict_obj.get("title"),
dict_obj.get("chunk"),
dict_obj.get("offset"),
dict_obj.get("page_number"),
dict_obj.get("chunk_id"),
)

@classmethod
Expand Down
Loading
Loading