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

Added getMessage function under ai subpath #1709

Closed
wants to merge 12 commits into from

Conversation

yuhengshs
Copy link

Problem

Issue number, if available:

Changes

  • Added getMessage function to leverage ConverseCommand from Bedrock API
  • Added types to align with ConverseCommand use case.
  • Added unit tests for Valid input handling, Different content types processing, Multiple message conversation handling and Invalid input error throwing

Corresponding docs PR, if applicable:

Validation

Checklist

  • If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change.
  • If this PR requires a change to the Project Architecture README, I have included that update in this PR.
  • If this PR requires a docs update, I have linked to that docs PR above.
  • If this PR modifies E2E tests, makes changes to resource provisioning, or makes SDK calls, I have run the PR checks with the run-e2e label set.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

changeset-bot bot commented Jul 2, 2024

🦋 Changeset detected

Latest commit: 5f7472c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@aws-amplify/backend-ai Minor
@aws-amplify/backend Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

@dbanksdesign dbanksdesign left a comment

Choose a reason for hiding this comment

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

Great start! Left a few comments/questions

packages/backend-ai/src/get_message.test.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/types.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/types.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Show resolved Hide resolved
packages/backend-ai/src/types.ts Outdated Show resolved Hide resolved
.changeset/smart-forks-pay.md Show resolved Hide resolved
Copy link
Contributor

@Amplifiyer Amplifiyer left a comment

Choose a reason for hiding this comment

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

Maybe I'm missing some context, but why is this functionality here and not in the frontend libraries? There is no backend being created/provisioned which is the sole purpose of this library.

packages/backend/src/at.ts Outdated Show resolved Hide resolved
packages/backend-ai/README.md Outdated Show resolved Hide resolved
.changeset/smart-forks-pay.md Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.test.ts Outdated Show resolved Hide resolved
* @returns The response from the AI model.
* @throws Eror If the response from the AI model does not contain a message.
*/
export const getMessage = async ({
Copy link
Contributor

Choose a reason for hiding this comment

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

How are customers expected to consume this function? Do they import it in their lambda function code? Could we just expose some prefilled defineFunction definitions that they could use directly and not have to touch lambda code at all?

Copy link
Author

Choose a reason for hiding this comment

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

I believe we expect to have a lot of customizable within the lambda execution.

@yuhengshs yuhengshs force-pushed the yuhengsh-ai-getMessage branch from 4232af5 to a3bde1c Compare July 5, 2024 18:15
* BedrockMessageHandler
*/
export class BedrockMessageHandler {
private client = new BedrockRuntimeClient();

Check warning

Code scanning / CodeQL

Useless assignment to property

This write to property 'client' is useless, since [another property write](1) always overrides it.
@yuhengshs yuhengshs force-pushed the yuhengsh-ai-getMessage branch from bb975a1 to a3bde1c Compare July 5, 2024 18:25
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
packages/backend-ai/src/get_message.ts Outdated Show resolved Hide resolved
yuhengshs added 3 commits July 5, 2024 16:25
…dded handleToolUseStrategy method to handle toolUseStrategy logic
…ups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),701(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae),702(com.apple.sharepoint.group.2) and
@sobolk sobolk closed this Aug 23, 2024
@sobolk sobolk deleted the yuhengsh-ai-getMessage branch November 12, 2024 15:26
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.

6 participants