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

Tf assistant cleanup #227

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions infrastructure/terraform/orchestration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ module "logic_app_orchestration" {
FUNCTION_SHORTCLIP_KEY = module.function_shortclip.linux_function_app_primary_key
META_PROMPT = data.local_file.file_meta_prompt.content
DEFAULT_LANGUAGE = var.default_language
DELETE_ASSISTANT_ENABLED = var.delete_assistant_enabled

Comment on lines +67 to +68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DELETE_ASSISTANT_ENABLED = var.delete_assistant_enabled
DELETE_ASSISTANT_ENABLED = var.delete_assistant_enabled

}
logic_app_always_on = true
logic_app_code_path = "${path.module}/../../utilities/logicApp"
Expand Down
7 changes: 7 additions & 0 deletions infrastructure/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,10 @@ variable "subnet_id" {
sensitive = false
default = "/subscriptions/be25820a-df86-4794-9e95-6a45cd5c0941/resourceGroups/swedencentral-vnet/providers/Microsoft.Network/virtualNetworks/swedencentral-vnet/subnets/default"
}

variable "delete_assistant_enabled" {
description = "Specifies whether the delete assistant is enabled."
type = bool
sensitive = false
default = false
}
25 changes: 23 additions & 2 deletions utilities/logicApp/OpenAi-Workflow/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,27 @@
},
"type": "Scope"
},
"OpenAI-DeleteAssistant": {
"inputs": {
"authentication": {
"audience": "https://cognitiveservices.azure.com",
"type": "ManagedServiceIdentity"
},
"method": "DELETE",
"uri": "@concat(parameters('AZURE_OPENAI_ENDPOINT'), '/openai/assistants/', body('OpenAi-CreateAssisstant-Response')?['id'], '?api-version=2024-03-01-preview')"
},
"runAfter": {
"Get_Assistant_Messages": [
"Succeeded"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
},
"type": "Http"
},
Comment on lines +773 to +793
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am missing the use of the parameter DELETE_ASSISTANT_ENABLED in the workflow.

"Validate_Assistant_Response": {
"actions": {
"For_each": {
Expand Down Expand Up @@ -1041,8 +1062,8 @@
}
},
"runAfter": {
"Get_Assistant_Messages": [
"Succeeded"
"OpenAI-DeleteAssistant": [
"SUCCEEDED"
]
},
"type": "Scope"
Expand Down
4 changes: 4 additions & 0 deletions utilities/logicApp/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
"type": "String",
"value": "@appsetting('AZURE_OPENAI_DEPLOYMENT_NAME')"
},
"DELETE_ASSISTANT_ENABLED": {
"type": "string",
"value": "@appsetting('DELETE_ASSISTANT_ENABLED')"
},
"VIDEO_INDEXER_ID": {
"type": "String",
"value": "@appsetting('VIDEO_INDEXER_ID')"
Expand Down