Rag Nova Lite Bedrock
RAG with AWS Nova Lite on Bedrock and Weaviate
This notebook will show you how to use the dynamic RAG API to define the model provider at query time. This enables you to change between different models and model settings at query time.
Dependencies
Step 1: Connect to Weaviate
Connect to your running Weaviate cluster (choose one option)
- You can create a 14-day free sandbox on WCD
- Embedded Weaviate
- Local deployment
- Other options
Option 1: Weaviate Cloud
True
Option 2: Weaviate Embedded
Option 3: Weaviate local host
Create a collection
Collection stores your data and vector embeddings.
Rather than defining the generative model provider at collection creation, we will define the provider at query time.
Import the Data
Generative Search Queries
We will define the generative model at query time. Notice how we're using two different models for each query.
Single Result
Single Result makes a generation for each individual search result.
In the below example, I want to create a Facebook ad from the Jeopardy question about Elephants.
{
"category": "ANIMALS",
"question": "It's the only living mammal in the order Proboseidea",
"answer": "Elephant"
}
-----vvvvvv-----
**π Discover the Marvel of Nature! π**
π Did you know there's only one living mammal in the order Proboscidea? π
Introducing the majestic **Elephant**! πΏπ
π From the ancient forests to modern savannas, elephants have roamed the Earth for millions of years. They are the largest land animals on our planet, known for their incredible intelligence, deep social bonds, and unique trunk that serves as a nose, a hand, and a tool for survival.
π Join us in celebrating these gentle giants and learn more about their fascinating lives and the importance of protecting their habitats.
π± **Support Conservation Efforts Today!** π±
π Click the link to learn more and contribute to the preservation of these incredible creatures!
π [Learn More & Donate]
#Elephants #WildlifeConservation #NatureLovers #Proboscidea #ProtectOurPlanet
-----^^^^^^-----
{
"category": "ANIMALS",
"question": "Weighing around a ton, the eland is the largest species of this animal in Africa",
"answer": "Antelope"
}
-----vvvvvv-----
ππ¦ Discover the Majestic Giants of Africa! π¦π
Are you ready to embark on an unforgettable adventure through the heart of Africa? π΄β¨
π Introducing the Eland - Africa's Largest Antelope! π
Weighing around a ton, the eland is the largest species of antelope found in the African wilderness. Imagine standing face-to-face with this magnificent creature, its majestic presence leaving you in awe!
π Why Choose an African Safari? π
πΏ Experience the breathtaking beauty of Africa's diverse landscapes, from vast savannas to lush forests.
π¦ Encounter incredible wildlife, including lions, elephants, and giraffes, all in their natural habitat.
π
Witness unforgettable sunsets and sunrises, painting the sky with vibrant colors as you witness the magic of Africa.
π Join us on an adventure of a lifetime and create memories that will last forever! π
π
Book your African Safari now and immerse yourself in the wonders of the wild! ππ¦
π [Insert link to booking page]
Don't miss out on this incredible opportunity to witness the largest antelope in Africa and so much more! ππ¦
#AfricanSafari #WildlifeAdventure #ElandAntelope #DiscoverAfrica #UnforgettableExperiences
-----^^^^^^-----
Grouped Result
Grouped Result generates a single response from all the search results.
The below example is creating a Facebook ad from the 2 retrieved Jeoprady questions about animals.
The questions provided are categorized under "ANIMALS" for several reasons: 1. **Content Focus**: Each question directly pertains to a specific animal or a characteristic of an animal. The questions ask about elephants, the anatomical feature of the gavial (a type of crocodile), and antelopes, all of which are animals. 2. **Biological Classification**: The first question references the biological classification of the elephant, which is a mammal in the order Proboseidea. This type of question requires knowledge of zoology and animal taxonomy. 3. **Anatomical Features**: The second question discusses a specific anatomical feature of the gavial, which is a type of crocodile. This again requires knowledge about animal anatomy and differences between species. 4. **Species Identification**: The third question is about the eland, a species of antelope, and its relative size compared to other antelopes in Africa. This involves knowledge of animal species and their habitats. Given these points, the categorization of these questions under "ANIMALS" is appropriate because they all deal with specific animals or their characteristics, making them relevant to the study and knowledge of animals.