Notebooks
W
Weaviate
Hybrid Search Embed English V3 Bedrock

Hybrid Search Embed English V3 Bedrock

vector-searchvector-databaseretrieval-augmented-generationllm-frameworksweaviate-featuresfunction-callingcohereweaviate-recipesmodel-providersPythongenerative-ai

Open In Colab

Dependencies

[ ]

Connect to Weaviate

[ ]

Create a collection

Collection stores your data and vector embeddings.

[ ]

Import the Data

[ ]

Hybrid Search

The alpha parameter determines the weight given to the sparse and dense search methods. alpha = 0 is pure sparse (bm25) search, whereas alpha = 1 is pure dense (vector) search.

Alpha is an optional parameter. The default is set to 0.75.

Hybrid Search only

The below query is finding Jeopardy questions about animals and is limiting the output to only two results. Notice alpha is set to 0.80, which means it is weighing the vector search results more than bm25. If you were to set alpha = 0.25, you would get different results.

[ ]

Hybrid Search on a specific property

The properties parameter allows you to list the properties that you want bm25 to search on.

[ ]

Hybrid Search with a where filter

Find Jeopardy questions about elephants, where the category is set to Animals.

[ ]

Hybrid Search with a custom vector

You can pass in your own vector as input into the hybrid query, by using the vector parameter.

[25]
ID: 321a36ce-693b-402f-89c6-efdd3344d982
Data: {
  "answer": "Antelope",
  "question": "Weighing around a ton, the eland is the largest species of this animal in Africa",
  "category": "ANIMALS"
} 

ID: d471e1e0-2420-417b-9256-594a7b4b5817
Data: {
  "answer": "Elephant",
  "question": "It's the only living mammal in the order Proboseidea",
  "category": "ANIMALS"
}