tmokmss / bedrock-pr-reviewer

AI-based Pull Request Summarizer and Reviewer with Chat Capabilities.
MIT License
38 stars 9 forks source link

Add Support for Bedrock Claude 3 #7

Closed mrsaiz closed 5 months ago

mrsaiz commented 5 months ago

Hello,

AWS recently released Claude 3 on BedRock but the way it is consumed from the API is different.

Bedrock API Request for claude-instant-v1, claude-v2 and claude-v2:1

{
  "modelId": "anthropic.claude-XXX",
  "contentType": "application/json",
  "accept": "*/*",
  "body": "{\"prompt\":\"\\n\\nHuman: Hello world\\n\\nAssistant:\",\"max_tokens_to_sample\":300,\"temperature\":0.5,\"top_k\":250,\"top_p\":1,\"stop_sequences\":[\"\\n\\nHuman:\"],\"anthropic_version\":\"bedrock-2023-05-31\"}"
}

Bedrock API Request for claude-v3

{
  "modelId": "anthropic.claude-3-haiku-20240307-v1:0",
  "contentType": "application/json",
  "accept": "application/json",
  "body": {
    "anthropic_version": "bedrock-2023-05-31",
    "max_tokens": 1000,
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "image",
            "source": {
              "type": "base64",
              "media_type": "image/jpeg",
              "data": "iVBORw..."
            }
          },
          {
            "type": "text",
            "text": "What's in this image?"
          }
        ]
      }
    ]
  }
}

It should be great if we can use Claude3 to analyze the code as is much more powerful.

image Source: https://www.anthropic.com/news/claude-3-family

tmokmss commented 5 months ago

Thanks for the feature request. It's fixed in #8.