Copy the logic of GPT service and Scenario Service into package common. This will allow us to reuse the logic for the new endpoint.
Extract the common logic of retrieving parameters into package common.util.
Design:
Route:/api/CopilotService
Method:GET/POST
Request Body:
{
"question": "How do I deploy a python application on Azure?", // 1
"history": [ // 2 ,optional, only for GPT call
{
"role": "user",
"content": "a question from user"
},
{
"role": "assistant",
"content": "the answer of the question"
}
],
"top_num": 5, // 3 ,optional, only for scenario search
"type": "Mix / knowledgeSearch / GPTGeneration" // The service type, the mix mode is to first calls "knowledgeSearch". If "knowledgeSearch" does not meet expectations, it will fall back to "GPTGeneration"
}
question:stringrequired
history:list
top_num:int
type:string The service type, which can be either Mix, knowledgeSearch or GPTGeneration
Response Body:
// Scenario Suggested by KnowledgeSearch
{
"data": [
{
"description": "Create an Azure Kubernetes Service (AKS) cluster with API Server VNet Integration",
"source_url": "https://docs.microsoft.com/en-us/azure/aks/api-server-vnet-integration",
"update_time": "2022-10-13T09:47:30.285Z",
"commandSet": [
{
"command": "az aks create",
"arguments": [
"-n",
"-g",
"-l",
"--network-plugin",
"--enable-apiserver-vnet-integration"
],
"reason": "Deploy a public cluster",
"example": "az aks create -n <cluster-name> -g <resource-group> -l <location> --network-plugin azure --enable-apiserver-vnet-integration"
},
{
"command": "az network vnet create",
"arguments": [
"-n",
"-l",
"--address-prefixes"
],
"reason": "Create the virtual network",
"example": "az network vnet create -n <vnet-name> -l <location> --address-prefixes 172.19.0.0/16"
}
],
"source": 2,
"firstCommand": "az aks create",
"id": "Create an Azure Kubernetes Service cluster with API Server VNet Integration (PREVIEW)",
"score": 18.85117,
"highlights": {
"description": [
"<em>Create</em> <em>an</em> <em>Azure</em> <em>Kubernetes</em> <em>Service</em> (AKS) <em>cluster</em> <em>with</em> API Server VNet Integration"
],
"scenario": [
"<em>Create</em> <em>an</em> <em>Azure</em> <em>Kubernetes</em> <em>Service</em> <em>cluster</em> <em>with</em> API Server VNet Integration (PREVIEW)"
]
},
"scenario": "Create an Azure Kubernetes Service cluster with API Server VNet Integration (PREVIEW)"
}
],
"error": null,
"status": 200,
"api_version": "1.1.0-alpha"
}
// Scenario Suggested by ChatGPT
{
"data": [
{
"history_msg": [
{
"role": "user",
"content": "How do i create an kubernetes cluster with service mesh using Azure CLI"
},
{
"role": "assistant",
"content": "{'Description': 'Create an Azure Kubernetes Service (AKS) cluster and install the Azure Service Operator', 'CommandSet': [{'command': 'aks create', 'arguments': ['--resource-group', '--name', '--node-count', '--enable-addons', '--generate-ssh-keys'], 'reason': 'Create an Azure Kubernetes Service (AKS) cluster.', 'example': 'az aks create --resource-group chatgpt-ResourceGroup-123456 --name chatgpt-AKS-123456 --node-count 2 --enable-addons monitoring --generate-ssh-keys'}, {'command': 'aks get-credentials', 'arguments': ['--resource-group', '--name'], 'reason': 'Get the credentials for the Kubernetes cluster.', 'example': 'az aks get-credentials --resource-group chatgpt-ResourceGroup-123456 --name chatgpt-AKS-123456'}, {'command': 'apply', 'arguments': ['-f'], 'reason': 'Install the Azure Service Operator on the cluster.', 'example': 'kubectl apply -f [https://raw.githubusercontent.com/Azure/azure-service-operator/master/charts/azure-service-operator/crds.yaml'}]](https://raw.githubusercontent.com/Azure/azure-service-operator/master/charts/azure-service-operator/crds.yaml%27%7D]), 'Reason': 'To create an Azure Kubernetes Service (AKS) cluster and install the Azure Service Operator, you need to create the AKS cluster, get the credentials for the cluster, and then apply the Azure Service Operator.'}"
}
],
"commandSet": [
{
"command": "aks create",
"arguments": [
"--resource-group",
"--name",
"--node-count",
"--enable-addons",
"--generate-ssh-keys"
],
"reason": "Create an Azure Kubernetes Service (AKS) cluster.",
"example": "az aks create --resource-group chatgpt-ResourceGroup-123456 --name chatgpt-AKS-123456 --node-count 2 --enable-addons monitoring --generate-ssh-keys"
},
{
"command": "aks get-credentials",
"arguments": [
"--resource-group",
"--name"
],
"reason": "Get the credentials for the Kubernetes cluster.",
"example": "az aks get-credentials --resource-group chatgpt-ResourceGroup-123456 --name chatgpt-AKS-123456"
}
],
"firstCommand": "aks create",
"scenario": "Create an Azure Kubernetes Service (AKS) cluster and install the Azure Service Operator",
"description": "To create an Azure Kubernetes Service (AKS) cluster and install the Azure Service Operator, you need to create the AKS cluster, get the credentials for the cluster, and then apply the Azure Service Operator."
}
],
"error": null,
"status": 200,
"api_version": "1.1.0-alpha"
}
Description:
CopilotService
.common
. This will allow us to reuse the logic for the new endpoint.common.util
.Design:
/api/CopilotService
GET
/POST
string
required
list
int
string
The service type, which can be eitherMix
,knowledgeSearch
orGPTGeneration