aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
187 stars 64 forks source link

ai.model("Claude 3.5 Haiku") from @aws-amplify/backend links to the wrong ModelId #2270

Open victoravr opened 2 days ago

victoravr commented 2 days ago

Environment information

Binaries:
  Node: 23.3.0 - /opt/homebrew/bin/node
  Yarn: undefined - undefined
  npm: 10.9.0 - /opt/homebrew/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.5.0
  @aws-amplify/backend: 1.8.0
  @aws-amplify/backend-auth: 1.4.1
  @aws-amplify/backend-cli: 1.4.2
  @aws-amplify/backend-data: 1.2.1
  @aws-amplify/backend-deployer: 1.1.9
  @aws-amplify/backend-function: 1.8.0
  @aws-amplify/backend-output-schemas: 1.4.0
  @aws-amplify/backend-output-storage: 1.1.3
  @aws-amplify/backend-secret: 1.1.5
  @aws-amplify/backend-storage: 1.2.3
  @aws-amplify/cli-core: 1.2.0
  @aws-amplify/client-config: 1.5.2
  @aws-amplify/deployed-backend-client: 1.4.2
  @aws-amplify/form-generator: 1.0.3
  @aws-amplify/model-generator: 1.0.9
  @aws-amplify/platform-core: 1.2.1
  @aws-amplify/plugin-types: 1.5.0
  @aws-amplify/sandbox: 1.2.6
  @aws-amplify/schema-generator: 1.2.5
  aws-amplify: 6.9.0
  aws-cdk: 2.170.0
  aws-cdk-lib: 2.170.0
  typescript: 5.7.2

Describe the bug

Instead of auto generated:
... resourcePath: '/model/anthropic.claude-3-5-haiku-20241022-v1:0/converse', It should be: ... resourcePath: '/model/anthropic.claude-3-haiku-20240307-v1:0/converse',

as per currently supported https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html ModelId: anthropic.claude-3-haiku-20240307-v1:0

Reproduction steps

import { type ClientSchema, a, defineData } from "@aws-amplify/backend"

const schema = a.schema({
  placeholder: a
    .generation({
      aiModel: a.ai.model("Claude 3.5 Haiku"),
      systemPrompt:
        "You are an assistant...",
    })
    .arguments({
      text: a.string(),
    })
    .returns(a.string())
    .authorization((allow) => allow.guest()),
})
ykethan commented 1 day ago

Hey @victoravr, thank you for reaching out. The Amplify AI kit does support both Claude 3.5 Haiku and Claude 3 Haiku Claude 3.5 Haiku | anthropic.claude-3-5-haiku-20241022-v1:0 Claude 3 Haiku | anthropic.claude-3-haiku-20240307-v1:0

https://docs.amplify.aws/react/ai/concepts/models/#anthropic

If you are looking to use Claude 3 Haiku you should be able to to update the Data schema to a.ai.model("Claude 3 Haiku"),