aws-samples / bedrock-claude-chat

AWS-native chatbot using Bedrock + Claude (+Mistral)
MIT No Attribution
698 stars 240 forks source link

[BUG] Chat History Defaults to Spanish Despite English Language Selected #240

Open marcwojcik opened 2 months ago

marcwojcik commented 2 months ago

Describe the bug

The Bedrock-Claude-Chat application is displaying the chat history in Spanish, despite the user selecting a different language (e.g., English) in the Menu settings.

To Reproduce

Open a new chat and the history will always come up default to Spanish.

Screenshots

2024-04-11_17-20-55

Additional context

Add any other context about the problem here.

statefb commented 2 months ago

Possible solution

Pass language explicitly to:

statefb commented 2 months ago

PR merged but leave the issue still open because enough evidence was not provided on #247. Please leave your comment below if you have still same issue.

josephedward commented 2 months ago

I got this error, even though my backend had the update (ie "- Title must be in the same language as the conversation.")

Maybe interpolate a preferred/default language in the parameter for the prompt string? ie

def propose_conversation_title(
    user_id: str,
    conversation_id: str,
    language: str,
    model: Literal[
        "claude-instant-v1",
        "claude-v2",
        "claude-v3-opus",
        "claude-v3-sonnet",
        "claude-v3-haiku",
    ] = "claude-v3-haiku",
) -> str:
    PROMPT = f"""Reading the conversation above, what is the appropriate title for the conversation? When answering the title, please follow the rules below:
<rules>
- Title must be in {language}.
- Title length must be from 15 to 20 characters.
- Prefer more specific title than general. Your title should always be distinct from others.
- Return the conversation title only. DO NOT include any strings other than the title.
</rules>
"""
statefb commented 2 months ago

@josephedward I believe your proposal is one of the simplest and effective ways to address the root cause. It would be greatly appreciated if you could take the trouble to create a Pull Request. Thank you!