-
Notifications
You must be signed in to change notification settings - Fork 428
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!: implement chat endpoint switch #905
Merged
gaurarpit
merged 41 commits into
main
from
arpit/feature/implement-chat-endpoint-switch
May 22, 2024
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6174b34
Attribute to choose between custom and byod conversation types
gaurarpit 1ebdea0
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 34ecb33
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit f12ef32
add the /conversation binding to use the ChatConversationType as an i…
gaurarpit 4774eeb
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 65a7688
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 7c20822
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 695f3ed
Merge remote-tracking branch 'origin/arpit/feature/implement-chat-end…
gaurarpit d95fd89
Merge remote-tracking branch 'origin/arpit/feature/implement-chat-end…
gaurarpit 73e7fbd
Merge remote-tracking branch 'origin/arpit/feature/implement-chat-end…
gaurarpit e4ac540
fix typo
gaurarpit 3f9fbd8
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 2a983dc
add the chat conversation type to main.json
gaurarpit 7630b59
add bicep params and make changes to call the /conversation from the …
gaurarpit 5f3209c
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 629339c
undo premature bindings removal
gaurarpit 5b4221e
update var name to a better suggestion from CHAT_CONVERSATION_TYPE to…
gaurarpit 2eecd7b
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 315a63d
Attribute to choose between custom and byod conversation types
gaurarpit 03a8070
add the /conversation binding to use the ChatConversationType as an i…
gaurarpit e838b66
fix typo
gaurarpit 130bfc4
add the chat conversation type to main.json
gaurarpit 813c312
add bicep params and make changes to call the /conversation from the …
gaurarpit f0bd85e
undo premature bindings removal
gaurarpit 2573a04
update var name to a better suggestion from CHAT_CONVERSATION_TYPE to…
gaurarpit ce99d31
Merge remote-tracking branch 'origin/arpit/feature/implement-chat-end…
gaurarpit d37946b
merged and ran pre-commit again.
gaurarpit d64a19f
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit f8cc67a
Merge branch 'main' into arpit/feature/implement-chat-endpoint-switch
gaurarpit 2a25b69
chore: force poetry to use python 3.11
liammoat 072a2f8
fix: use await when invoking conversation_custom
liammoat 37b4f2d
test: added test for conversation flow
liammoat 6e1a080
refactor: removing conversation flow specific endpoints
liammoat dea40fb
test: update test_app to use env_helper_mock, supporting new endpoint
liammoat d12b2dc
test: test for failure condition on conversation flow
liammoat 7f0fd5f
Merge remote-tracking branch 'origin/main' into arpit/feature/impleme…
liammoat ea33999
Merge remote-tracking branch 'origin/main' into arpit/feature/impleme…
liammoat 42257f0
Update merged test with new endpoints.
gaurarpit e9c860b
refactor: switch to Enum of conversation flow
liammoat 496c553
refactor: pylint for couple of lines
liammoat 7ffe361
docs: documentation for conversation flow options
liammoat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
code/backend/batch/utilities/helpers/config/conversation_flow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from enum import Enum | ||
|
||
|
||
class ConversationFlow(Enum): | ||
CUSTOM = "custom" | ||
BYOD = "byod" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
60 changes: 60 additions & 0 deletions
60
code/tests/functional/tests/backend_api/with_byod/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import logging | ||
import pytest | ||
from backend.batch.utilities.helpers.config.conversation_flow import ConversationFlow | ||
from tests.functional.app_config import AppConfig | ||
from tests.functional.tests.backend_api.common import get_free_port, start_app | ||
from backend.batch.utilities.helpers.config.config_helper import ConfigHelper | ||
from backend.batch.utilities.helpers.env_helper import EnvHelper | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@pytest.fixture(scope="package") | ||
def app_port() -> int: | ||
logger.info("Getting free port") | ||
return get_free_port() | ||
|
||
|
||
@pytest.fixture(scope="package") | ||
def app_url(app_port: int) -> str: | ||
return f"http://localhost:{app_port}" | ||
|
||
|
||
@pytest.fixture(scope="package") | ||
def app_config(make_httpserver, ca): | ||
logger.info("Creating APP CONFIG") | ||
with ca.cert_pem.tempfile() as ca_temp_path: | ||
app_config = AppConfig( | ||
{ | ||
"AZURE_OPENAI_ENDPOINT": f"https://localhost:{make_httpserver.port}/", | ||
"AZURE_SEARCH_SERVICE": f"https://localhost:{make_httpserver.port}/", | ||
"AZURE_CONTENT_SAFETY_ENDPOINT": f"https://localhost:{make_httpserver.port}/", | ||
"AZURE_SPEECH_REGION_ENDPOINT": f"https://localhost:{make_httpserver.port}/", | ||
"AZURE_STORAGE_ACCOUNT_ENDPOINT": f"https://localhost:{make_httpserver.port}/", | ||
"SSL_CERT_FILE": ca_temp_path, | ||
"CURL_CA_BUNDLE": ca_temp_path, | ||
"CONVERSATION_FLOW": ConversationFlow.BYOD.value, | ||
} | ||
) | ||
logger.info(f"Created app config: {app_config.get_all()}") | ||
yield app_config | ||
|
||
|
||
@pytest.fixture(scope="package", autouse=True) | ||
def manage_app(app_port: int, app_config: AppConfig): | ||
app_config.apply_to_environment() | ||
EnvHelper.clear_instance() | ||
ConfigHelper.clear_config() | ||
start_app(app_port) | ||
yield | ||
app_config.remove_from_environment() | ||
EnvHelper.clear_instance() | ||
ConfigHelper.clear_config() | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def reset_default_config(): | ||
""" | ||
Reset the default config after each test | ||
""" | ||
ConfigHelper.clear_config() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the weird project structure, using an absolute import here breaks the Admin app and Azure Function when running in Azure
I think that using a relative import should fix it