From 80cf0a7e4710f4c0ab920ce0419ff96c7e3dd18d Mon Sep 17 00:00:00 2001 From: Ralph El Hage Date: Wed, 6 Mar 2024 13:08:11 -0800 Subject: [PATCH] Add markdown flow charts --- ideas/notes/ai_init_flow.md | 320 ++++++++++++++++++++++++ ideas/notes/ai_init_ui_flow_current.md | 124 +++++++++ ideas/notes/ai_init_ui_flow_proposed.md | 110 ++++++++ 3 files changed, 554 insertions(+) create mode 100644 ideas/notes/ai_init_flow.md create mode 100644 ideas/notes/ai_init_ui_flow_current.md create mode 100644 ideas/notes/ai_init_ui_flow_proposed.md diff --git a/ideas/notes/ai_init_flow.md b/ideas/notes/ai_init_flow.md new file mode 100644 index 00000000..076b3ece --- /dev/null +++ b/ideas/notes/ai_init_flow.md @@ -0,0 +1,320 @@ +# AI init flow + +This focuses on the UI that the user sees and will duplicate some shared code paths for clarity + +```mermaid +flowchart + %% =========================================== + %% Subgraphs and node definitions + %% =========================================== + start([START]) + done[[DONE]] + + subgraph "VerifyProjectAsync()" + saved_verify_subs["`Verify subscription + *GET /subscriptions*`"] + saved_verify_project["`Verify project + NOTE: SAME AS Verify Project step below. See there for details`"] + saved_choose_saved_or_else{{Choose: + - Saved project + - Something else}} + end + + subgraph DoInitRootMenuPick + top_level_choose{{"Choose: + - New AI Project + - Existing AI Project + - Standalone Resources + "}} + + subgraph "DoInitRootProject(true, allowCreate, allowPick)" + subgraph "DoInitSubscriptionId(true)" + choose_subs{{"`Choose AI subscription + */subscriptions*`"}} + end + subgraph "DoInitProject(true, allowCreate, allowPick)" + subgraph "DoInitHubResource(true)" + newai_choose_res{{"`Choose AI resource + - Create new integrated + - Create new standalone + - Choose from existing + *../MachineLearningServices/workspaces*`"}} + + subgraph "AiSdkConsoleGui.TryCreateAiHubResourceInteractive(values,subsId)" + newai_choose_region{{"`Choose Region + *GET ../locations*`"}} + newai_choose_resgrp{{"`Choose resource group + - Create new + - Existing + *GET ../resourcegroups*`"}} + newai_name_resgrp{{Choose resource group name}} + newai_create_resgrp["`Create resource group + TODO: unnecessarily makes REST Get regions call again + *PUT ../resourcegroups/{resGrp}*`"] + newai_choose_aires_name{{Choose AI resource name}} + newai_create_aires[Create AI resource] + end + end + + subgraph "AiSdkConsoleGui.PickOrCreateAndConfigAiHubProject(...)" + newai_choose_proj_name{{Choose project name}} + newai_create_proj["`Create project + *PUT ../Microsoft.Resources/deployments/{projName}*`"] + + existingai_choose_ai_proj{{"`Choose AI project + - ___ONLY___ Existing + *GET ../providers/Microsoft.MachineLearningServices/workspaces?kind=project*`"}} + + verify_project["`Verify Project + *../Microsoft.MachineLearningServices/workspaces* + TODO: we already have HubId in calling method, + getting all is redundant + TODO: list connecitons already queries for single project + *../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}* + *../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}/connections*`"] + verify_ai_res["`Verify OpenAI resource + *../providers/Microsoft.CognitiveServices/accounts*`"] + verify_search_conn["`Verify Search Resource + *GET ../resourcegroups* + *GET ../resources?$filter=resourceType eq 'Microsoft.Search/searchServices'* + TODO: Should pass resource group to skip extra lookup?`"] + + subgraph "AzCliConsoleGui.PickOrCreateAndConfigCognitiveServicesOpenAiKindResourceDeployments(...)" + subgraph "AzCliConsoleGui.PickOrCreateCognitiveServicesResourceDeployment(interactive, allowSkipDeployments, 'Chat')" + choose_chat_deployment{{"`Choose AI chat deployment + - New + - Existing + - Skip + *../resourceGroups/{resGrp}/providers/Microsoft.CognitiveServices/accounts/{aiResName}/deployments*`"}} + choose_chat_model{{"`Choose AI chat model + This will filter out models without remamining usage + *GET ../providers/Microsoft.CognitiveServices/locations/{region}/models* + *GET ../providers/Microsoft.CognitiveServices/locations/{region}/usages*`"}} + name_chat_deployment{{Name AI chat deployment}} + create_chat_deployment["`Create AI chat deployment + *PUT*`"] + end + subgraph "AzCliConsoleGui.PickOrCreateCognitiveServicesResourceDeployment(interactive, allowSkipDeployments, 'Embeddings')" + choose_embed_deployment{{"`Choose AI embeddings deployment + - New + - Existing + - Skip + *../resourceGroups/{resGrp}/providers/Microsoft.CognitiveServices/accounts/{aiResName}/deployments* + TODO: Remove duplicated request`"}} + choose_embed_model{{"`Choose AI embedddings model`"}} + name_embed_deployment{{Name AI embeddings deployment}} + create_embed_deployment["`Create AI embeddings deployment + *PUT*`"] + end + subgraph "AzCliConsoleGui.PickOrCreateCognitiveServicesResourceDeployment(interactive, allowSkipDeployments, 'Evaluation')" + choose_eval_deployment{{"`Choose AI evaluation deployment + - New + - Existing + - Skip + *../resourceGroups/{resGrp}/providers/Microsoft.CognitiveServices/accounts/{aiResName}/deployments* + TODO: Remove duplicated request`"}} + choose_eval_model{{"`Choose AI evaluation model`"}} + name_eval_deployment{{Name AI evaluation deployment}} + create_eval_deployment["`Create AI evaluation deployment + *PUT*`"] + end + + subgraph "AzCliConsoleGui.LoadCognitiveServicesResourceKeys" + verify_reskeys["`Verify Cognitive Services Resource keys + *POST ../resourceGroups/{regGrp}/providers/Microsoft.CognitiveServices/accounts/{aiServiceName}/listKeys*`"] + end + + save_config_aiservces[Save AI Services config] + save_config["`Save other config + Excludes: + - services.endpoint + - services.key + - services.region + - speech.endpoint + - speech.key + - speech.region`"] + end + + verify_searchkeys["`Verify search keys + *POST ../resourceGroups/{resGrp}/providers/Microsoft.Search/searchServices/{searchResName}/listAdminKeys*`"] + save_search["Save search config"] + + subgraph "AiSdkConsoleGui.GetOrCreateAiHubProjectConnections(...)" + verify_hub_conn["`Verify hub connections + 1. Verify Default_AzureOpenAI connection: + *GET ../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}* + *GET ../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}/connections/Default_AzureOpenAI* + *POST ../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}/connections/Default_AzureOpenAI/listsecrets* + 2. Verify AzureAISearch connection: + *Get ../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}* + *Get ../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}/connections/AzureAISearch* + *POST ../resourceGroups/{resGrp}/providers/Microsoft.MachineLearningServices/workspaces/{hubName}/connections/AzureAISearch/listsecrets* + TODO We already have this information and have verified it earlier + - We have all connections already from Verify Project step + - Unnecessary triplicate call to get hub information + - Unnecessary duplicate call to /workspaces/{hubName}/connections/{connectionName} + - The listsecrets duplicates the information from the call without that so we can remove the intermediate step`"] + %% == "AiSdkConsoleGui.GetOrCreateAiHubProjectConnections(...)" + end + + save_config_json["Save project JSON config"] + %% == "AiSdkConsoleGui.PickOrCreateAndConfigAiHubProject(...)" + end + + %% == "DoInitProject(interactive, allowCreate, allowPick)" + end + %% == "DoInitRootProject(true, allowCreate, allowPick)" + end + + subgraph "DoInitStandaloneResources" + standalone_choose_type{{"`Choose: + - AI Services v2 (OpenAI, speech, vision, search) + - AI Services v1 (speech, vision, language, search) + - Azure OpenAI + - Azure Search + - Azure Speech`"}} + standalone_choose_subs{{"`Choose subscription + NOTE: Same code as regular path`"}} + standalone_choose_resource{{"`Choose resource + - Create new + - Existing + *GET ../providers/Microsoft.CognitiveServices/accounts*`"}} + standalone_create_resource>"`Create standalone resource + TODO: INCOMPLETE`"] + standalone_choose_search_resource{{"`Choose AI search resource + *GET ../resources?$filter=resourceType eq 'Microsoft.Search%2FsearchServices'*`"}} + standalone_create_search_resource>"`Create search resource + TODO: INCOMPLETE`"] + standalone_choose_chat_deployment{{"`Choose chat deployment + NOTE: same as other but different resource name`"}} + standalone_choose_embed_deployment{{"`Choose embeddings deployment + NOTE: same as other but different resource name`"}} + standalone_choose_eval_deployment{{"`Choose evaluation deployment + NOTE: same as other but different resource name`"}} + standalone_verify_res_keys[Verify resource keys] + standalone_verify_search_keys["`Verify search keys + *PUT ../resourceGroups/{resgrp}/providers + /Microsoft.Search/searchServices/ + {searchName}/listAdminKeys`"] + standalone_save_config_aiservices["`Save AI services config + NOTE: same as save_config_aiservces`"] + standalone_save_config["`Save config + NOTE: same as save_config`"] + standalone_save_config_cogsrv["Save Cognitive services config"] + standalone_save_config_openai["Save OpenAI config"] + standalone_save_config_search["Save search config"] + standalone_save_config_speech["Save speech config"] + + %% == "DoInitStandaloneResources" + end + + %% == "DoInitRootMenuPick" + end + + + %% =========================================== + %% Flow + %% =========================================== + start --> has_saved_config{Has saved + config?} + + has_saved_config --Nothing saved--> top_level_choose + has_saved_config --Saved config--> saved_verify_subs + saved_verify_subs --> saved_verify_project + saved_verify_subs --Error--> top_level_choose + saved_verify_project --Error--> top_level_choose + saved_verify_project --> saved_choose_saved_or_else + saved_choose_saved_or_else --Something else--> top_level_choose + saved_choose_saved_or_else --"`Saved project + TODO: Why are we doing this again and not using saved values?`"--> choose_chat_deployment + + top_level_choose --New AI project--> choose_subs + top_level_choose --Existing AI project--> choose_subs + top_level_choose --Standalone resources --> standalone_choose_type + + choose_subs --New AI project--> newai_choose_res + choose_subs --Existing AI project--> existingai_choose_ai_proj + + newai_choose_res --New integrated--> newai_choose_region + newai_choose_region --> newai_choose_resgrp + newai_choose_resgrp --> newai_name_resgrp + + newai_name_resgrp --> newai_create_resgrp + newai_create_resgrp --> newai_choose_aires_name + newai_choose_aires_name --> newai_create_aires + newai_create_aires --> newai_choose_proj_name + + newai_choose_res --Existing--> newai_choose_proj_name + newai_choose_proj_name --> newai_create_proj + newai_create_proj --> verify_project + verify_project --> verify_ai_res + verify_ai_res --> verify_search_conn + verify_search_conn --> choose_chat_deployment + + existingai_choose_ai_proj --> verify_project + + choose_chat_deployment --Existing OR skip--> choose_embed_deployment + choose_chat_deployment --Create new--> choose_chat_model + choose_chat_model --> name_chat_deployment + name_chat_deployment --> create_chat_deployment + create_chat_deployment --> choose_embed_deployment + + choose_embed_deployment --Existing OR skip--> choose_eval_deployment + choose_embed_deployment --Create new--> choose_embed_model + choose_embed_model --> name_embed_deployment + name_embed_deployment --> create_embed_deployment + create_embed_deployment --> choose_eval_deployment + + choose_eval_deployment --Existing OR skip--> verify_reskeys + choose_eval_deployment --Create new--> choose_eval_model + choose_eval_model --> name_eval_deployment + name_eval_deployment --> create_eval_deployment + create_eval_deployment --> verify_reskeys + + verify_reskeys --Anything else--> save_config + verify_reskeys --AI services--> save_config_aiservces + + save_config_aiservces --> verify_searchkeys + save_config --> verify_searchkeys + + verify_searchkeys --> save_search + save_search --> verify_hub_conn + verify_hub_conn --> save_config_json + save_config_json--> done + + newai_choose_res --"`New standalone ('OpenAI;AIServices')`"--> standalone_choose_resource + + standalone_choose_type --All choices--> standalone_choose_subs + standalone_choose_subs --"`AI Services v2 ('AIServices')`"--> standalone_choose_resource + standalone_choose_subs --"`AI Services v1 ('CognitiveServices')`"--> standalone_choose_resource + standalone_choose_subs --"`Azure Open AI ('OpenAI;AIServices')`"--> standalone_choose_resource + standalone_choose_subs --Azure Search--> standalone_choose_search_resource + standalone_choose_subs --"`Azure Speech ('SpeechServices')`"--> standalone_choose_resource + + standalone_choose_resource --Existing (AI services v2)--> standalone_choose_chat_deployment + standalone_choose_resource --Existing (AI services v1)--> standalone_verify_res_keys + standalone_choose_resource --Existing (Open AI)--> standalone_choose_chat_deployment + standalone_choose_resource --Existing (Azure Speech) --> standalone_verify_res_keys + + standalone_choose_search_resource --Existing---> standalone_verify_search_keys + standalone_choose_search_resource --Create new--> standalone_create_search_resource + + standalone_choose_chat_deployment --> standalone_choose_embed_deployment + standalone_choose_embed_deployment --> standalone_choose_eval_deployment + standalone_choose_eval_deployment --> standalone_verify_res_keys + + standalone_verify_res_keys --AI Services v2--> standalone_save_config_aiservices + standalone_verify_res_keys --AI Services v1--> standalone_save_config_cogsrv + standalone_verify_res_keys --Open AI--> standalone_save_config + standalone_verify_search_keys --Azure Search--> standalone_save_config_search + standalone_verify_res_keys --Azure Speech--> standalone_save_config_speech + + standalone_save_config_aiservices --> standalone_save_config_openai + standalone_save_config_cogsrv --> done + standalone_save_config --> standalone_save_config_openai + standalone_save_config_search --> done + standalone_save_config_speech --> done + standalone_save_config_openai --> done + + standalone_choose_resource --Create new--> standalone_create_resource +``` diff --git a/ideas/notes/ai_init_ui_flow_current.md b/ideas/notes/ai_init_ui_flow_current.md new file mode 100644 index 00000000..0971d41c --- /dev/null +++ b/ideas/notes/ai_init_ui_flow_current.md @@ -0,0 +1,124 @@ +# Current AI init flow + +```mermaid +flowchart + start([START]) + done([DONE]) + + start --> has_saved_config{Has saved config} + has_saved_config --config.json--> verify_saved_config[Verify saved config.json + - Verify subscription + - Verify AI project + - Verify AI hub resource] + verify_saved_config --> choose_saved_or_other{Choose: + - Saved project + - Something else} + verify_saved_config --Errors--> top_level_choose + choose_saved_or_other --Saved project--> choose_chat_deployment + choose_saved_or_other --Something else--> top_level_choose + has_saved_config --Nothing saved--> top_level_choose{{"Choose: + - New AI Project + - Existing AI Project + - Standalone Resources + "}} + + top_level_choose --Create new--> choose_subs{{Choose subscription}} + top_level_choose --Existing AI project--> choose_subs + top_level_choose --Standalone--> standalone_choose_type{{"Choose type: + - AI services v2 (OpenAI, speech, vision, search) + - AI services v1 (Speech, vision, language, search) + - Azure OpenAI + - Azure Search + - Azure Speech"}} + + standalone_choose_type --Any--> standalone_choose_subs{{Choose subscription}} + standalone_choose_subs --"AI services v2 + (AIServices)"--> standalone_choose_res{{Choose resource + filtered based on type of standalone chosen}} + standalone_choose_subs --"AI services v1 + (CognitiveServices)"---> standalone_choose_res + standalone_choose_subs --"Azure OpenAI + (OpenAI;AIServices)"--> standalone_choose_res + standalone_choose_subs --"Azure Speech + (SpeechServices)"--> standalone_choose_res + standalone_choose_subs --Azure Search--> standalone_choose_search_res{{Choose search resource}} + + standalone_choose_res --Existing AI services v2--> choose_chat_deployment + standalone_choose_res --Existing OpenAI--> choose_chat_deployment + standalone_choose_res --Existing AI services v1--> load_cogsvc_keys + standalone_choose_res --Existing Azure Speech--> load_cogsvc_keys + standalone_choose_res --Create new--> create_standalone_res>Create standalone resource + TODO INCOMPLETE] + + standalone_choose_search_res --Existing--> standalone_load_search_keys[Load search keys] + standalone_load_search_keys --> save_config + standalone_choose_search_res --Create new--> create_standalone_res_search>Create standalone search resource + TODO INCOMPLETE] + + choose_subs --New AI project--> choose_ai_res{{Choose AI hub resource + - Create new integrated + - Create new standalone + - Existing}} + choose_subs --Existing AI project--> choose_existing_ai_proj{{Choose existing AI project}} + + choose_ai_res --New integrated--> choose_region{{Choose Azure region}} + choose_ai_res --Existing--> choose_ai_proj_name{{Choose AI project}} + choose_ai_res --"New standalone + (OpenAI;AIServices)"--> standalone_choose_res + + choose_region --> choose_res_group{{Choose resource group + - Create new + - Existing}} + + choose_res_group --Create new--> choose_reg_group_name{{Choose resource group name}} + choose_res_group --Existing--> choose_ai_res_name{{Choose AI hub resource name}} + + choose_reg_group_name --> create_res_group[Create resource group] + create_res_group --> choose_ai_res_name + choose_ai_res_name --> create_ai_res[Create AI hub resource] + create_ai_res --> choose_ai_proj_name{{Choose AI project name}} + + choose_ai_proj_name --> create_ai_proj[Create AI project] + create_ai_proj --> verify_ai_proj + + choose_existing_ai_proj --> verify_ai_proj[Verify AI project] + verify_ai_proj --> verify_ai_res[Verify AI hub resource] + verify_ai_res --> verify_ai_search_res[Verify AI search resource] + verify_ai_search_res --> choose_chat_deployment{{Choose chat deployment + - Create new + - Existing + - Skip}} + + choose_chat_deployment --Existing OR skip --> choose_embed_deployment{{Choose embeddings deployment + - Create new + - Existing + - Skip}} + choose_chat_deployment --Create new--> choose_chat_model{{Choose chat model}} + choose_chat_model --> name_chat_deployment{{Name chat deployment}} + name_chat_deployment --> create_chat_deployment{{Create chat deployment}} + create_chat_deployment --> choose_embed_deployment + + choose_embed_deployment --Existing OR skip--> choose_eval_deployment{{Choose evaluation deployment + - Create new + - Existing + - Skip}} + choose_embed_deployment --Create new--> choose_embed_model{{Choose embeddings model}} + choose_embed_model --> name_embed_deployment{{Name embeddings deployment}} + name_embed_deployment --> create_embed_deployment[Create embeddings deployment] + create_embed_deployment --> choose_eval_deployment + + choose_eval_deployment --Existing OR skip --> load_cogsvc_keys[Load Cognitive services keys] + choose_eval_deployment --Create new--> choose_eval_model{{Choose evaluation model}} + choose_eval_model --> name_eval_deployment{{Name evaluation deployment}} + name_eval_deployment --> create_eval_deployment[Create evaluation deployment] + create_eval_deployment --> load_cogsvc_keys + + load_cogsvc_keys --> save_config["`Save configuration + **Multuple variations + depending on type**`"] + + save_config --AI Hub or project + but **NOT** standalone--> create_config_json[Create config.json] + save_config --> done + create_config_json --> done +``` diff --git a/ideas/notes/ai_init_ui_flow_proposed.md b/ideas/notes/ai_init_ui_flow_proposed.md new file mode 100644 index 00000000..60d88c9b --- /dev/null +++ b/ideas/notes/ai_init_ui_flow_proposed.md @@ -0,0 +1,110 @@ +# New AI streamlined AI init flow + +```mermaid +flowchart + start([START]) + done([DONE]) + failed([**FAILED**]) + + start --> has_saved_config{Has saved config} + has_saved_config --Has saved--> show_saved_config[Show saved config] + has_saved_config --Nothing saved--> choose_subs + + show_saved_config --> choose_saved_or_other{Choose: + - Saved project + - Change + - Reset} + + choose_saved_or_other --Reset--> reset_config[Reset saved config] --> done + choose_saved_or_other --Saved--> verify_config[Verify saved config.json + - Verify subscription + - Verify AI project + - Verify AI hub resource] + choose_saved_or_other --Change--> choose_subs{{Choose subscription}} + + choose_subs --> choose_res{{"`Choose resource + - Create new + - Select from existing: + * Azure AI project (preferred) + * Azure AI hub resource, + * Azure AI services v2 (with Open AI) + * Azure OpenAI, + * Cognitive Services resource (aka Azure AI services v1) + * Speech resoure + * Search resource + ___________________________________________________________________ + *NOTES: + - Since an AI hub resource will package up multiple resources into one, the list will be filtered to include just the hub resource + - Any previously saved options will be 'selected'*`"}} + + choose_res --Existing Cognitive Services, + OR speech, + OR search--> verify_config + choose_res --Existing AI project, + OR Azure AI service (v2), + OR Azure OpenAI--> choose_chat_deployment{{Choose chat deployment + - New + - Existing + - Skip}} + choose_res --Existing AI hub resource--> choose_ai_proj{{Choose AI project + - New + - Existing}} + choose_res --New--> choose_res_type{{"Choose resource type + - [Recommended] Azure AI Hub resource + - Azure AI services (v2) + - Azure OpenAI + - Cognitive services + - Speech + - Source"}} + + choose_ai_proj --Existing--> choose_chat_deployment + choose_ai_proj --New--> choose_ai_proj_name{{Choose AI project name}} + choose_ai_proj_name --> create_ai_proj[Create AI project] + create_ai_proj --> choose_chat_deployment + + choose_chat_deployment --Existing OR skip --> choose_embed_deployment{{Choose embeddings deployment + - Create new + - Existing + - Skip}} + choose_chat_deployment --Create new--> choose_chat_model{{Choose chat model}} + choose_chat_model --> name_chat_deployment{{Name chat deployment}} + name_chat_deployment --> create_chat_deployment{{Create chat deployment}} + create_chat_deployment --> choose_embed_deployment + + choose_embed_deployment --Existing OR skip--> choose_eval_deployment{{Choose evaluation deployment + - Create new + - Existing + - Skip}} + choose_embed_deployment --Create new--> choose_embed_model{{Choose embeddings model}} + choose_embed_model --> name_embed_deployment{{Name embeddings deployment}} + name_embed_deployment --> create_embed_deployment[Create embeddings deployment] + create_embed_deployment --> choose_eval_deployment + + choose_eval_deployment --Existing OR skip --> verify_config + choose_eval_deployment --Create new--> choose_eval_model{{Choose evaluation model}} + choose_eval_model --> name_eval_deployment{{Name evaluation deployment}} + name_eval_deployment --> create_eval_deployment[Create evaluation deployment] + create_eval_deployment --> verify_config + + choose_res_type --> choose_res_group{{Choose resource group + - Create new + - Existing}} + choose_res_group --Existing--> choose_res_name{{Choose resource name}} + choose_res_group --New--> choose_region{{Choose Azure region}} + + choose_res_name --> create_res[Create resource] + choose_region --> choose_res_group_name{{Choose resource group name}} + choose_res_group_name --> create_res_group[Create resource group] + create_res_group --> choose_res_name + + create_res --Azure AI hub--> choose_ai_proj_name + create_res --Azure AI services (v2) + OR Azure OpenAI--> choose_chat_deployment + create_res --Cognitive services + OR Speech + Or Search--> verify_config + + verify_config --Valid--> save_config[Save configuration] + verify_config --Errors--> failed + save_config --> done +```