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: summarization logic regarding Anthropic #4540

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Latex block: $$e=mc^2$$

export const SUMMARIZE_MODEL = "gpt-3.5-turbo";
export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
export const ANTHROPIC_SUMMARIZE_MODEL = "claude-3-haiku-20240307"

export const KnowledgeCutOffDate: Record<string, string> = {
default: "2021-09",
Expand Down
4 changes: 4 additions & 0 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
StoreKey,
SUMMARIZE_MODEL,
GEMINI_SUMMARIZE_MODEL,
ANTHROPIC_SUMMARIZE_MODEL,
} from "../constant";
import { ClientApi, RequestMessage, MultimodalContent } from "../client/api";
import { ChatControllerPool } from "../client/controller";
Expand Down Expand Up @@ -92,6 +93,9 @@ function getSummarizeModel(currentModel: string) {
if (currentModel.startsWith("gemini-pro")) {
return GEMINI_SUMMARIZE_MODEL;
}
if (currentModel.startsWith("claude")){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentlly,only internal Claude Models supported,so just identifying claude models by prefix 'claude' is not right

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciation for the review! However, I was a little confused; Are 'internal Claude models' these?

const anthropicModels = [
  "claude-instant-1.2",
  "claude-2.0",
  "claude-2.1",
  "claude-3-sonnet-20240229",
  "claude-3-opus-20240229",
  "claude-3-haiku-20240307",
];

In that case, I didn't see identifying via prefix has any problem...
If that means custom models (some users may be using reverse proxy for claude but with OpenAI API) should be supported as well, will using includes or regex be appropriate?

includes

if (currentModel.toLowerCase().includes("claude") || currentModel.toLowerCase().includes("anthropic")){
    return ANTHROPIC_SUMMARIZE_MODEL;
}

regex

if (/claude|anthropic/i.test(currentModel)) {
    return ANTHROPIC_SUMMARIZE_MODEL;
}

return ANTHROPIC_SUMMARIZE_MODEL;
}
return currentModel;
}

Expand Down