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

Conversation

Illusion2-1
Copy link
Contributor

Users using the Claude model provided by Anthropic may find that they are using the same summary model as the dialogue model, which generally results in additional costs.

This PR adds summary model judgement logic that was missing when using the Claude model, and by default the user's dialogue will be summarised using the haiku, which is the least costly one.

Of course, if the user wishes to use a different summarisation model, they can change it themselves.
ANTHROPIC_SUMMARIZE_MODEL.

Copy link

vercel bot commented Apr 18, 2024

@Illusion2-1 is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

Your build has completed!

Preview deployment

@@ -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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants