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

Use different display name for anthropic/claude-2 #635

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

mkondratek
Copy link
Contributor

@mkondratek mkondratek commented Feb 13, 2024

Fixes #630.

Test plan

  1. try chat on a pro account

@mkondratek mkondratek self-assigned this Feb 13, 2024
Copy link
Contributor

@kalanchan kalanchan left a comment

Choose a reason for hiding this comment

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

approving to get this out into the next build.

@mkondratek Could you explain how a user would even select Claude 2 if it's not part of the LLM dropdown?

@mkondratek
Copy link
Contributor Author

mkondratek commented Feb 13, 2024

approving to get this out into the next build.

@mkondratek Could you explain how a user would even select Claude 2 if it's not part of the LLM dropdown?

On sendMessege, in the beginning of the method's body we take the chosen model with this method:

private fun fetchModelFromDropdown(): ChatModel {
    return if (chatPanel.modelDropdown.selectedItem != null) {
      val selectedItem = chatPanel.modelDropdown.selectedItem
      val displayModelName = (selectedItem as CodyModelComboboxItem).name
      ChatModel.fromDisplayName(displayModelName) // <- HERE
    } else {
      ChatModel.UNKNOWN_MODEL
    }
  }
enum class ChatModel(val icon: Icon, val displayName: String, val agentName: String) {
  UNKNOWN_MODEL(Icons.CodyLogo, "", ""),
  ANTHROPIC_CLAUDE_2(Icons.LLM.Anthropic, "Claude 2.0 by Anthropic", "anthropic/claude-2"), // <- the old code
  ANTHROPIC_CLAUDE_2_0(Icons.LLM.Anthropic, "Claude 2.0 by Anthropic", "anthropic/claude-2.0"),
  // ...
  
companion object {
    // ...
    fun fromDisplayName(displayName: String): ChatModel =
        ChatModel.values().firstOrNull { it.displayName == displayName } ?: UNKNOWN_MODEL
    // ...
  }
}  

The problem was that displayName that we are matching in ChatModel.fromDisplayName(displayModelName) is the same: "Claude 2.0 by Anthropic" for both models anthropic/claude-2 and anthropic/claude-2.0.

@mkondratek
Copy link
Contributor Author

My solution is rather a quick fix only. We must rethink how we store the models (probably we should not use enums at all).

@mkondratek mkondratek merged commit 8a3f6de into main Feb 13, 2024
2 checks passed
@mkondratek mkondratek deleted the mkondratek/fix/cloude-2 branch February 13, 2024 20:13
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.

JetBrains: Cody stops responding to natural questions.
2 participants