Skip to content

Commit

Permalink
feat: add custom-copilot-rag-aisearch python template (#11212)
Browse files Browse the repository at this point in the history
* feat: enable options

* feat: add template pj files

* fix: bad template name

* feat: enable capabilities

* fix: update codes

* fix: make repo tpl

* fix: bad tpl

* fix: remove customize rag

* fix: img resources

* fix: unit tests

* fix: bad generated files

* fix: change scripts location and modify readme

* fix: webignore

* fix: readme

* fix: bad return formmat

* fix: bad tpl suffix

* fix: modified

* fix: folder structure

* fix: naming

* fix: requirements

* fix: bad grammar

* fix: fix

* fix: bad cmd path

* feat: python code owner
  • Loading branch information
frankqianms authored Mar 29, 2024
1 parent 95cbc7d commit b0413b5
Show file tree
Hide file tree
Showing 43 changed files with 1,681 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,7 @@
/templates/**/sso-tab-with-obo-flow @Yimin-Jin @hund030 @huimiu @eriolchan
/templates/**/workflow @kimizhu @dooriya @swatDong
/templates/constraints/yml/actions @hund030 @eriolchan @huimiu
/templates/python/* @adashen @blackchoey @frankqianms
/templates/python/custom-copilot-basic @frankqianms @blackchoey
/templates/python/custom-copilot-rag-azure-ai-search @frankqianms @blackchoey
/templates/scripts @hund030 @eriolchan @huimiu
2 changes: 1 addition & 1 deletion packages/fx-core/src/question/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export const copilotPluginOptionIds = [
copilotPluginApiSpecOptionId,
copilotPluginOpenAIPluginOptionId,
];
export const capabilitiesHavePythonOption = ["custom-copilot-basic"];
export const capabilitiesHavePythonOption = ["custom-copilot-basic", "custom-copilot-rag"];
10 changes: 4 additions & 6 deletions packages/fx-core/src/question/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export class CapabilityOptions {
static customCopilots(): OptionItem[] {
return [
CapabilityOptions.customCopilotBasic(),
// CapabilityOptions.customCopilotRag(),
CapabilityOptions.customCopilotRag(),
CapabilityOptions.customCopilotAssistant(),
];
}
Expand Down Expand Up @@ -2182,10 +2182,10 @@ export class CustomCopilotRagOptions {

static all(): OptionItem[] {
return [
CustomCopilotRagOptions.customize(),
// CustomCopilotRagOptions.customize(),
CustomCopilotRagOptions.azureAISearch(),
CustomCopilotRagOptions.customApi(),
CustomCopilotRagOptions.microsoft365(),
// CustomCopilotRagOptions.customApi(),
// CustomCopilotRagOptions.microsoft365(),
];
}
}
Expand Down Expand Up @@ -2424,7 +2424,6 @@ export function capabilitySubTree(): IQTreeNode {
},
data: apiMessageExtensionAuthQuestion(),
},
/*
{
condition: (inputs: Inputs) => {
return inputs[QuestionNames.Capabilities] == CapabilityOptions.customCopilotRag().id;
Expand All @@ -2449,7 +2448,6 @@ export function capabilitySubTree(): IQTreeNode {
},
],
},
*/
{
condition: (inputs: Inputs) => {
return (
Expand Down
3 changes: 3 additions & 0 deletions packages/fx-core/src/question/inputs/CreateProjectInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface CreateProjectInputs extends Inputs {
| "copilot-plugin-new-api"
| "copilot-plugin-existing-api"
| "custom-copilot-basic"
| "custom-copilot-rag"
| "custom-copilot-agent"
| "message-extension"
| "BotAndMessageExtension"
Expand Down Expand Up @@ -84,6 +85,8 @@ export interface CreateProjectInputs extends Inputs {
"api-operation"?: string[];
/** @description Authentication Type */
"api-me-auth"?: "none" | "api-key" | "microsoft-entra";
/** @description Chat With Your Data */
"custom-copilot-rag"?: "custom-copilot-rag-azureAISearch";
/** @description AI Agent */
"custom-copilot-agent"?: "custom-copilot-agent-new" | "custom-copilot-agent-assistants-api";
/** @description Programming Language */
Expand Down
8 changes: 8 additions & 0 deletions packages/fx-core/src/question/options/CreateProjectOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const CreateProjectOptions: CLICommandOption[] = [
"copilot-plugin-new-api",
"copilot-plugin-existing-api",
"custom-copilot-basic",
"custom-copilot-rag",
"custom-copilot-agent",
"message-extension",
"BotAndMessageExtension",
Expand Down Expand Up @@ -145,6 +146,13 @@ export const CreateProjectOptions: CLICommandOption[] = [
default: "none",
choices: ["none", "api-key", "microsoft-entra"],
},
{
name: "custom-copilot-rag",
type: "string",
description: "Chat With Your Data",
default: "custom-copilot-rag-customize",
choices: ["custom-copilot-rag-azureAISearch"],
},
{
name: "custom-copilot-agent",
type: "string",
Expand Down
24 changes: 12 additions & 12 deletions packages/fx-core/tests/core/FxCore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,9 @@ describe("getQuestions", async () => {
"openapi-spec-location",
"api-operation",
"api-me-auth",
// "custom-copilot-rag",
// "openapi-spec-location",
// "api-operation",
"custom-copilot-rag",
"openapi-spec-location",
"api-operation",
"custom-copilot-agent",
"programming-language",
"llm-service",
Expand Down Expand Up @@ -1532,9 +1532,9 @@ describe("getQuestions", async () => {
"openapi-spec-location",
"api-operation",
"api-me-auth",
// "custom-copilot-rag",
// "openapi-spec-location",
// "api-operation",
"custom-copilot-rag",
"openapi-spec-location",
"api-operation",
"custom-copilot-agent",
"programming-language",
"llm-service",
Expand Down Expand Up @@ -1572,9 +1572,9 @@ describe("getQuestions", async () => {
"openapi-spec-location",
"api-operation",
"api-me-auth",
// "custom-copilot-rag",
// "openapi-spec-location",
// "api-operation",
"custom-copilot-rag",
"openapi-spec-location",
"api-operation",
"custom-copilot-agent",
"programming-language",
"llm-service",
Expand Down Expand Up @@ -1613,9 +1613,9 @@ describe("getQuestions", async () => {
"openapi-spec-location",
"api-operation",
"api-me-auth",
// "custom-copilot-rag",
// "openapi-spec-location",
// "api-operation",
"custom-copilot-rag",
"openapi-spec-location",
"api-operation",
"custom-copilot-agent",
"programming-language",
"llm-service",
Expand Down
68 changes: 34 additions & 34 deletions packages/fx-core/tests/question/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ describe("scaffold question", () => {
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: CapabilityOptions.customCopilotBasic().id });
} else if (question.name === QuestionNames.ProgrammingLanguage) {
const select = question as SingleSelectQuestion;
Expand Down Expand Up @@ -1187,17 +1187,17 @@ describe("scaffold question", () => {
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: CapabilityOptions.customCopilotRag().id });
} else if (question.name === QuestionNames.CustomCopilotRag) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 4);
assert.isTrue(options.length === 2);
return ok({ type: "success", result: CustomCopilotRagOptions.customize().id });
} else if (question.name === QuestionNames.ProgrammingLanguage) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: "typescript" });
} else if (question.name === QuestionNames.LLMService) {
const select = question as SingleSelectQuestion;
Expand All @@ -1219,13 +1219,13 @@ describe("scaffold question", () => {
assert.deepEqual(questions, [
QuestionNames.ProjectType,
QuestionNames.Capabilities,
// QuestionNames.CustomCopilotRag,
QuestionNames.ProgrammingLanguage,
QuestionNames.LLMService,
QuestionNames.AzureOpenAIKey,
QuestionNames.AzureOpenAIEndpoint,
QuestionNames.Folder,
QuestionNames.AppName,
QuestionNames.CustomCopilotRag,
// QuestionNames.ProgrammingLanguage,
// QuestionNames.LLMService,
// QuestionNames.AzureOpenAIKey,
// QuestionNames.AzureOpenAIEndpoint,
// QuestionNames.Folder,
// QuestionNames.AppName,
]);
});

Expand All @@ -1251,18 +1251,18 @@ describe("scaffold question", () => {
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: CapabilityOptions.customCopilotRag().id });
} else if (question.name === QuestionNames.CustomCopilotRag) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 4);
assert.isTrue(options.length === 1);
return ok({ type: "success", result: CustomCopilotRagOptions.customize().id });
} else if (question.name === QuestionNames.ProgrammingLanguage) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
return ok({ type: "success", result: "typescript" });
assert.isTrue(options.length === 3);
return ok({ type: "success", result: "python" });
} else if (question.name === QuestionNames.LLMService) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
Expand All @@ -1283,7 +1283,7 @@ describe("scaffold question", () => {
assert.deepEqual(questions, [
QuestionNames.ProjectType,
QuestionNames.Capabilities,
// QuestionNames.CustomCopilotRag,
QuestionNames.CustomCopilotRag,
QuestionNames.ProgrammingLanguage,
QuestionNames.LLMService,
QuestionNames.AzureOpenAIKey,
Expand Down Expand Up @@ -1314,7 +1314,7 @@ describe("scaffold question", () => {
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: CapabilityOptions.customCopilotRag().id });
} else if (question.name === QuestionNames.CustomCopilotRag) {
const select = question as SingleSelectQuestion;
Expand Down Expand Up @@ -1354,15 +1354,15 @@ describe("scaffold question", () => {
assert.deepEqual(questions, [
QuestionNames.ProjectType,
QuestionNames.Capabilities,
// QuestionNames.CustomCopilotRag,
QuestionNames.CustomCopilotRag,
// QuestionNames.ApiSpecLocation,
// QuestionNames.ApiOperation,
QuestionNames.ProgrammingLanguage,
QuestionNames.LLMService,
QuestionNames.AzureOpenAIKey,
QuestionNames.AzureOpenAIEndpoint,
QuestionNames.Folder,
QuestionNames.AppName,
// QuestionNames.ProgrammingLanguage,
// QuestionNames.LLMService,
// QuestionNames.AzureOpenAIKey,
// QuestionNames.AzureOpenAIEndpoint,
// QuestionNames.Folder,
// QuestionNames.AppName,
]);
});

Expand All @@ -1388,7 +1388,7 @@ describe("scaffold question", () => {
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: CapabilityOptions.customCopilotRag().id });
} else if (question.name === QuestionNames.CustomCopilotRag) {
const select = question as SingleSelectQuestion;
Expand Down Expand Up @@ -1420,13 +1420,13 @@ describe("scaffold question", () => {
assert.deepEqual(questions, [
QuestionNames.ProjectType,
QuestionNames.Capabilities,
// QuestionNames.CustomCopilotRag,
QuestionNames.ProgrammingLanguage,
QuestionNames.LLMService,
QuestionNames.AzureOpenAIKey,
QuestionNames.AzureOpenAIEndpoint,
QuestionNames.Folder,
QuestionNames.AppName,
QuestionNames.CustomCopilotRag,
// QuestionNames.ProgrammingLanguage,
// QuestionNames.LLMService,
// QuestionNames.AzureOpenAIKey,
// QuestionNames.AzureOpenAIEndpoint,
// QuestionNames.Folder,
// QuestionNames.AppName,
]);
});

Expand All @@ -1452,7 +1452,7 @@ describe("scaffold question", () => {
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: CapabilityOptions.customCopilotAssistant().id });
} else if (question.name === QuestionNames.CustomCopilotAssistant) {
const select = question as SingleSelectQuestion;
Expand Down Expand Up @@ -1513,7 +1513,7 @@ describe("scaffold question", () => {
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 2);
assert.isTrue(options.length === 3);
return ok({ type: "success", result: CapabilityOptions.customCopilotAssistant().id });
} else if (question.name === QuestionNames.CustomCopilotAssistant) {
const select = question as SingleSelectQuestion;
Expand Down
15 changes: 15 additions & 0 deletions templates/python/custom-copilot-rag-azure-ai-search/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# TeamsFx files
env/.env.*.user
env/.env.local
env/.env.testtool
.env
appPackage/build

# python virtual environment
.venv/
__pycache__/

# others
.deployment/
node_modules/
devTools/*.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"TeamsDevApp.ms-teams-vscode-extension",
"ms-python.python"
]
}
Loading

0 comments on commit b0413b5

Please sign in to comment.