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

chore: cleanup outdated model & upgrade model #7739

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
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
30 changes: 6 additions & 24 deletions packages/backend/server/src/plugins/copilot/prompt/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,6 @@ const workflows: Prompt[] = [
];

const actions: Prompt[] = [
{
name: 'debug:action:gpt4',
action: 'text',
model: 'gpt-4o',
messages: [],
},
{
name: 'debug:action:vision4',
action: 'text',
model: 'gpt-4o',
messages: [],
},
{
name: 'debug:action:dalle3',
action: 'image',
Expand All @@ -302,12 +290,6 @@ const actions: Prompt[] = [
model: 'lcm-sd15-i2i',
messages: [],
},
{
name: 'debug:action:fal-sdturbo',
action: 'image',
model: 'fast-turbo-diffusion',
messages: [],
},
{
name: 'debug:action:fal-upscaler',
action: 'Clearer',
Expand All @@ -332,14 +314,14 @@ const actions: Prompt[] = [
messages: [],
},
{
name: 'debug:action:fal-summary-caption',
name: 'Generate a caption',
action: 'Generate a caption',
model: 'llava-next',
model: 'gpt-4o-mini',
messages: [
{
role: 'user',
content:
'Please understand this image and generate a short caption. Limit it to 20 words. {{content}}',
'Please understand this image and generate a short caption that can summarize the content of the image. Limit it to up 20 words. {{content}}',
},
],
},
Expand Down Expand Up @@ -393,7 +375,7 @@ content: {{content}}`,
{
name: 'Explain this image',
action: 'Explain this image',
model: 'gpt-4-vision-preview',
model: 'gpt-4o',
messages: [
{
role: 'user',
Expand Down Expand Up @@ -692,7 +674,7 @@ content: {{content}}`,
{
name: 'Make it real',
action: 'Make it real',
model: 'gpt-4-vision-preview',
model: 'gpt-4o',
messages: [
{
role: 'user',
Expand Down Expand Up @@ -731,7 +713,7 @@ content: {{content}}`,
{
name: 'Make it real with text',
action: 'Make it real with text',
model: 'gpt-4-vision-preview',
model: 'gpt-4o',
messages: [
{
role: 'user',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ export class OpenAIProvider
// text to text
'gpt-4o',
'gpt-4o-mini',
'gpt-4-vision-preview',
'gpt-4-turbo-preview',
'gpt-3.5-turbo',
// embeddings
'text-embedding-3-large',
'text-embedding-3-small',
Expand Down Expand Up @@ -203,7 +200,7 @@ export class OpenAIProvider
// ====== text to text ======
async generateText(
messages: PromptMessage[],
model: string = 'gpt-3.5-turbo',
model: string = 'gpt-4o-mini',
options: CopilotChatOptions = {}
): Promise<string> {
this.checkParams({ messages, model, options });
Expand Down Expand Up @@ -232,7 +229,7 @@ export class OpenAIProvider

async *generateTextStream(
messages: PromptMessage[],
model: string = 'gpt-3.5-turbo',
model: string = 'gpt-4o-mini',
options: CopilotChatOptions = {}
): AsyncIterable<string> {
this.checkParams({ messages, model, options });
Expand Down
7 changes: 3 additions & 4 deletions packages/backend/server/src/plugins/copilot/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import type { ChatPrompt } from './prompt';
export enum AvailableModels {
// text to text
Gpt4Omni = 'gpt-4o',
Gpt4VisionPreview = 'gpt-4-vision-preview',
Gpt4TurboPreview = 'gpt-4-turbo-preview',
Gpt35Turbo = 'gpt-3.5-turbo',
Gpt4OmniMini = 'gpt-4o-mini',
// embeddings
TextEmbedding3Large = 'text-embedding-3-large',
TextEmbedding3Small = 'text-embedding-3-small',
Expand All @@ -34,7 +32,8 @@ export function getTokenEncoder(model?: string | null): Tokenizer | null {
// dalle don't need to calc the token
return null;
} else {
return fromModelName('gpt-4-turbo-preview');
// c100k based model
return fromModelName('gpt-4');
}
}

Expand Down
4 changes: 1 addition & 3 deletions packages/backend/server/src/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ type CopilotMessageNotFoundDataType {
enum CopilotModels {
DallE3
Gpt4Omni
Gpt4TurboPreview
Gpt4VisionPreview
Gpt35Turbo
Gpt4OmniMini
TextEmbedding3Large
TextEmbedding3Small
TextEmbeddingAda002
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/server/tests/utils/copilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class MockCopilotTestProvider

override async *generateTextStream(
messages: PromptMessage[],
model: string = 'gpt-3.5-turbo',
model: string = 'gpt-4o-mini',
options: CopilotChatOptions = {}
): AsyncIterable<string> {
this.checkParams({ messages, model, options });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
// TODO(@Peng): automate this
export const promptKeys = [
'debug:chat:gpt4',
'debug:action:gpt4',
'debug:action:vision4',
'debug:action:dalle3',
'debug:action:fal-sd15',
'debug:action:fal-upscaler',
'debug:action:fal-remove-bg',
'debug:action:fal-face-to-sticker',
'debug:action:fal-summary-caption',
'chat:gpt4',
'Summary',
'Generate a caption',
'Summary the webpage',
'Explain this',
'Explain this image',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Could you make a new website based on these notes and send back just the html fi
return textToText({
...options,
content: options.input,
promptName: 'debug:action:fal-summary-caption',
promptName: 'Generate a caption',
});
});

Expand Down
4 changes: 1 addition & 3 deletions packages/frontend/graphql/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ export interface CopilotMessageNotFoundDataType {
export enum CopilotModels {
DallE3 = 'DallE3',
Gpt4Omni = 'Gpt4Omni',
Gpt4TurboPreview = 'Gpt4TurboPreview',
Gpt4VisionPreview = 'Gpt4VisionPreview',
Gpt35Turbo = 'Gpt35Turbo',
Gpt4OmniMini = 'Gpt4OmniMini',
TextEmbedding3Large = 'TextEmbedding3Large',
TextEmbedding3Small = 'TextEmbedding3Small',
TextEmbeddingAda002 = 'TextEmbeddingAda002',
Expand Down
Loading