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

(FE) Implement CodePair AI Assistant #123

Merged
merged 24 commits into from
Feb 1, 2024
Merged
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: 1 addition & 1 deletion backend/src/intelligence/prompt/followup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatPromptTemplate, MessagesPlaceholder } from "langchain/prompts";
import { ChatPromptTemplate, MessagesPlaceholder } from "@langchain/core/prompts";

export const followUpPromptTemplate = ChatPromptTemplate.fromMessages([
[
9 changes: 5 additions & 4 deletions backend/src/intelligence/prompt/github-issue.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "langchain/prompts";
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "@langchain/core/prompts";

const examplePrompt = ChatPromptTemplate.fromTemplate(
"## Title\n{title}\n## Issue Type\n{issueType}\n## Content\n{content}"
"[Example]\n## Title\n{title}\n## Issue Type\n{issueType}\n## Content\n{content}"
);

const examples = [
@@ -73,8 +73,9 @@ Keep the product simple`,
];

export const githubIssuePromptTemplate = new FewShotChatMessagePromptTemplate({
prefix: `I want you to act as a GitHub Issue writer. I will provide brief information about the GitHub issue I want to create, and you should write the GitHub issue based on the examples I provide.
The types of issues you can write are bug 🐞 or enhancement 🌟. Please ensure that you follow the template used in each type of issue example provided. Please write your responses in English.`,
prefix: `I want you to act as a GitHub Issue writer. I will provide brief information about the GitHub issue I want to create, and you should write the GitHub issue.
The types of issues you can write are bug 🐞 or enhancement 🌟. Please ensure that you follow the template used in each type of issue example provided. Do not provide the example as it is. Please write your responses in English.
If there is insufficient information to create the issue, request additional information.`,
suffix: "Brief information about the GitHub issue: {content}",
examplePrompt,
examples,
13 changes: 7 additions & 6 deletions backend/src/intelligence/prompt/github-pr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "langchain/prompts";
import { ChatPromptTemplate, FewShotChatMessagePromptTemplate } from "@langchain/core/prompts";

const examplePrompt = ChatPromptTemplate.fromTemplate("## Title\n{title}\n## Content\n{content}");
const examplePrompt = ChatPromptTemplate.fromTemplate(
"[Example]\n## Title\n{title}\n## Content\n{content}"
);

const examples = [
{
@@ -100,10 +102,9 @@ Fixes #
];

export const githubPrPromptTemplate = new FewShotChatMessagePromptTemplate({
prefix: `I want you to act as a GitHub PR Writer for me. I'll provide you with brief notes about GitHub PR, and you just need to write the PR using the examples I've provided.
Make sure to adhere to the template that we commonly follow in Example.
If the information is not provided by the user, please refrain from attaching document links found elsewhere. Please respond in English.
Please refer to the example for guidance, but generate results based on the information provided in the Brief Information section.`,
prefix: `I want you to act as a GitHub PR Writer for me. I'll provide you with brief notes about GitHub PR, and you just need to write the PR.
Please ensure that you follow the template used in example provided. Do not provide the example as it is. Please write your responses in English.
If there is insufficient information to create the PR, request additional information.`,
suffix: "Brief information about the GitHub PR: {content}",
examplePrompt,
examples,
Loading