-
Notifications
You must be signed in to change notification settings - Fork 299
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
Amplify AI RFC #5773
Comments
|
I also tried AI generation in a separate app to generate jokes. However I can't figure out settings that makes the jokes funny! As it is, I can't seem to find a humorous ai configuration. I hope image generation is also on the roadmap! |
2a. Looks like a great way to add a VERY simple chat function to an app. 2b. Glad to see the message history is stored in one row per interaction for linear observability.
3a. The initial example didn't work, I received a compile error: ./node_modules/@aws-amplify/ui-react-core/dist/esm/components/FormCore/FormProvider.mjs Since Amplify uses NextJS by default, "use client"; is required and was not provided in the example. Clarity around the examples would be helpful as there are too many options and nuances in the front end ecosystem. 3b. I was already using Tool is my data model. It seems like any reserved words should be prefixed with a Namespace to prevent conflict. 3c. For a chat use case, streaming should be supported out of the box as well as animations to show something is happening in the background. This is already implemented in other chatbots in the aws-examples repos. Perhaps this is already in progress... 3d. The existing routes are great for very simple use cases, but feel a little too opinionated. The underlying data model for the message history is a great start, but should allow custom data fields. The route interface should provide access to the API response metadata such as usage, metrics, and stopReason, and should also store that information in the message history. This allows for cost accounting, and exception handling if a response stopped for any other reason that "end_turn". Having access to the chat session ID would be useful if we want to relate that to other data stored elsewhere. 3e. Will we have access to GuardRails and Knowledgebases? Custom headers such as Anthropic's context caching (currently in Beta, not available in Bedrock). 3f. The model identifiers are generic compared to the versioned modelds used in the API. This may reduce options, not to mention cause some confusion with yet-another-way-to-refer-to-a-model. 3g. More documentation. The Gen 2 ecosystem is already very difficult to navigate, and the documentation feels very sparse while introducing new concepts without enough definitive examples. I know this is super early for this AI feature, but the more transparent you can be with what is supported under the hood, the more meaningful our experimentation can be without digging into the underlying source code. 3h. I feel like for any significant AI use case, the current approach is too limited. Aligning more with the full capabilities of the underlying API and setting reasonable defaults seems like the best approach. Being able to make use of the message history and ability to do evals would prevent plug-and-pray use of AI. 3i. Wishlist:
|
I used the Chat feature. It's excellent that it can be implemented quickly and easily, as expected from Gen2🚀 Desired features:
Looking forward to GA. |
So I recently experimented with SST ion with create a next app and did some ai sdk (https://sdk.vercel.ai/) . Pretty impressive. For me, it looks like this new amplify AI functionality looks for the same/similar experience, right? Yeah, I definitely would need the AI streaming response as well. |
From what I've seen so far, AmplfyAI is an awesome extension of Amplify. Great for developers who want to accelerate the release of new features. In my Amplify app, I generate RAG-style context locally, in-app, before I send queries (with context) to Bedrock or openAI. It would be great if Amplify AI could provide that functionality as a callable service. This is what I am currently doing: I run a js transformer in-app to extract embeddings (using a Huggingface LLM) and store them (with Amplify DataStore). This processes whenever data changes in my app so that the vectors are always updated. When I need to query a GPT provider (Bedrock, openAI), I generate RAG context by calculating against the previously stored embeddings (e.g., cosine similarity). (DataStore is great for this design, as it means I can process rapidly, cheaply, and offline.) If AmplifyAI could do the above as a callable service, that would be great. For example, one could enable AmplifyAI to automatically generate embeddings and indexes based on data stored within Amplify (DynamoDB). Then, when RAG-style queries are needed, one could use AmplifyAI to run calculations against the app's data set to return the RAG context that is included in the GPT query. Or...one could use the indexes for other in-app functionality that uses vectorized embeddings directly. |
Hi team! Example schema
|
@amuresia we are working on having model tools work like how you have in your code, but for now what you can do is change the ref to "list[model name]s" so |
I came across a limitation in trying to show the conversation history by using the TypeScript client. We can see that the |
Hi team, could we please get an update on how to continue testing as for me things have stopped working last week after upgrading to the latest aws-amplify libraries.
I noticed that the
I reviewed https://github.com/aws-amplify/docs/pull/8094/files to check my implementation but I can't see anything out of the ordinary that could explain the above. I also cloned https://github.com/aws-samples/amplify-ai-examples and ran but the Assistant never replies, the spinner doesn't stop turning. I see no errors in the console logs. |
Closing the RFC, thanks to everyone who commented and followed! |
The purpose of this RFC is to get early feedback on this new full-stack AI functionality in Amplify. This functionality is currently in developer preview while we get feedback and iterate on it. There will likely be changes and potentially some breaking changes before going general availability (GA). We will keep this issue updated as we add functionality/address feedback so stay tuned!
Overview
We are introducing a new AI category to Amplify Gen 2 with backend definitions, client libraries, and UI components. With Amplify AI you can define full-stack AI functionality in their Amplify Gen 2 applications with tight integration for auth and data, allowing for easy authorization logic and using existing Amplify data as context for AI requests (like asking a chatbot about data in your applications) and generating data records with AI. Also, with Amplify Gen 2’s infrastructure-from-code approach built on top of CDK, developers can have cloud sandboxes that are deployed during local development and fully deployed with Amplify CD when a git branch is pushed.
Amplify AI is built around the idea of “routes”. An AI route is like an API endpoint for interacting with backend AI functionality. AI routes are configured in an Amplify backend where you can define the authorization rules, what type of route (generation or conversation), AI model and inference configuration like temperature, what are the inputs and outputs, and what data it has access to. There are 2 types of AI routes we are focusing on for dev preview:
Setup
First, make sure your AWS account has access to the model you wish to use. You can do that by going in to the Bedrock console and requesting access.
Also, make sure your account is set up for Amplify: https://docs.amplify.aws/react/start/account-setup/
Quickstart
You can use this repo as a template: https://github.com/dbanksdesign/amplify-ai-starter to get started. Create a new Github repository from it and clone it locally and follow the steps in the README
Installation
Adding to an existing app
If you have an existing Amplify Gen2 application, install the latest Amplify dependencies:
You will need to directly depend on "@aws-sdk/client-bedrock-runtime" as a devDependency right now. We plan on addressing this issue as soon as possible.
Creating a new app
You can follow the quickstart guide here: https://docs.amplify.aws/react/start/quickstart/ or create a new app using the CLI:
If you are using React, we have a new React AI package you can install that will have React hooks and components for using AI functionality.
Usage
Building a chatbot
1. Backend definition
To get started adding AI functionality to your Amplify application, open your amplify/data/resource.ts and add a new entry in your schema using
a.conversation
which will add a conversation route to your data backend.2. Frontend
Then in your React code you can import and use the
AIConversation
componentIf you are not using React in your frontend, check out the section for using the Amplify Javascript libraries.
You should now be able to see a chatbot component!
4. Adding tools
Tools are functions/APIs that LLMs can choose to invoke to get information/data about the world. This allows them to be able to answer questions that were not in their training data (like the current weather or information, application-specific data, etc.). The default way you can define “tools” for the assistant to use is with data models and custom queries in your data schema.
In your amplify/data/resource.ts file, lets add a custom query our chatbot can use:
And then we will need to create the getWeather function:
Now if we ask our chatbot what the weather is like in San Jose, it can respond! Although this functionality is mocked, you can use a library like https://agentic.so/ to handle calling APIs or performing math equations.
5 Adding context
The client can send back “context” to the assistant so that it can provide better answers to the user. This context can really be any unstructured data that might be helpful. Some examples include:
This context gets passed into the system prompt of the request to the LLM.
6. Adding custom UI responses
Wouldn’t it be cool if our chatbot could respond with custom UI components? On the AIConversation component you can add a responseComponents prop that tells the LLM it can respond with those React components and they will render in the chat history.
Recipe generator
1 Backend
Add a new generation route in your data schema in amplify/data/resource.ts file:
2. Frontend
Detailed usage
Backend definition
Javascript/TypeScript client
To interact with the AI backed in your frontend application, you can use the Amplify Data client. There are 2 new namespaces on the client:
conversations
andgenerations
. These are properly typed based on your backend definition so if you have conversation and generation routes defined, they will show up in these namespaces.Feedback
Amplify AI functionality is currently in developer preview and we would like feedback to fix any bugs, improve the APIs, and add missing functionality before going to general availability (GA). Please comment on this ticket with any suggestions you have for Amplify AI. We will be keeping this issue up to date as we make changes.
Thank you to all the people who have worked tirelessly on this project including, but not limited to: @atierian @cshfang @thaddmt @sobolk
The text was updated successfully, but these errors were encountered: