Skip to content

feat(chat): move to codegemma chat model #46

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

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/common/download/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,10 @@ const getModelInfo = async (
checksum:
"eb00372705e7d5d30442750e8a7c72919c8e243bee52e1cce97fcfc1008c6143",
},
"chat-small": {
url: "https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GGUF/resolve/main/deepseek-coder-1.3b-instruct.Q8_0.gguf",
checksum:
"36eb025121a50ee6d37fe900659393ff8fb5ea34adc0e3c11fc635e07624dcdb",
},
"chat-medium": {
url: "https://huggingface.co/TheBloke/deepseek-coder-6.7B-instruct-GGUF/resolve/main/deepseek-coder-6.7b-instruct.Q8_0.gguf",
checksum:
"02cd6ce7ccec670cf6d3dd147932f13e584f9e964d5a3297a74b401b658471ae",
},
"chat-large": {
url: "https://huggingface.co/TheBloke/deepseek-coder-33B-instruct-GGUF/resolve/main/deepseek-coder-33b-instruct.Q8_0.gguf",
url: "https://huggingface.co/lmstudio-community/codegemma-1.1-7b-it-GGUF/resolve/main/codegemma-1.1-7b-it-Q5_K_M.gguf",
checksum:
"86529f8eefc87a80bd20d62229ee5acdc32d5773be8575a143bc491924865c21",
"ec11bacb9e0b8c8e0f483f209c487939202b04bbf4f815f0a0945c5b256da895",
},
};

Expand Down
27 changes: 10 additions & 17 deletions src/common/prompt/promptChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,22 @@ export type Chat = {
title: string;
};

const promptBaseDefault = `You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.
`;

export const getPromptChat = (chatMessages: ChatMessage[]) => {
const systemPrompt =
chatMessages.find((message) => message.role === "system")?.content || "";
const promptHistory = chatMessages
.filter((chatMessage) => chatMessage.role !== "system")
.map((chatMessage) => {
.map((chatMessage, index) => {
const partOfPrompt =
chatMessage.role === "user" ? "### Instruction:\n" : "### Response:\n";
return (
partOfPrompt +
chatMessage.content +
"\n" +
(chatMessage.role === "ai" ? "<|EOT|>" : "")
);
index === 0 && chatMessage.role === "user"
? "<start_of_turn>user\n" + systemPrompt + "\n"
: chatMessage.role === "user"
? "<start_of_turn>user\n"
: "<start_of_turn>model\n";
return partOfPrompt + chatMessage.content + "<end_of_turn>\n";
})
.join("");

const promptBase =
chatMessages.find((message) => message.role === "system")?.content ??
promptBaseDefault;

const prompt = promptBase + promptHistory + "### Response:\n";

const prompt = "<bos>" + promptHistory + "<start_of_turn>model\n";
return prompt;
};
8 changes: 0 additions & 8 deletions src/common/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ const modelsBase = {
export type TypeModelsBase = keyof typeof modelsBase;

export const modelsChat = {
"chat-small": {
port: 39725,
},
"chat-medium": {
port: 39726,
},
"chat-large": {
port: 39727,
},
};

export type TypeModelsChat = keyof typeof modelsChat;
Expand Down Expand Up @@ -311,7 +305,5 @@ class Server {
export const servers = {
"base-small": new Server("base-small"),
"base-medium": new Server("base-medium"),
"chat-small": new Server("chat-small"),
"chat-medium": new Server("chat-medium"),
"chat-large": new Server("chat-large"),
};