Find answers from the community

Updated 2 months ago

give me a hybrid search example

give me a hybrid search example
k
V
L
8 comments
Please stand by @V as I search the knowledge base. We are experiencing especially high traffic right now and might take longer than usual. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, you can find more information and examples in the GPT index documentation here (https://gpt-index.readthedocs.io/en/latest).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
@kapa.ai example of percentile_cutoff usage in optimizer
Let me check the knowledge base for you. One moment! :books:
----------------------
Here's an example of using percentile_cutoff with the SentenceEmbeddingOptimizer in GPT index:

Plain Text
from llama_index import GPTSimpleVectorIndex
from llama_index.optimization.optimizer import SentenceEmbeddingOptimizer

# load from disk
index = GPTSimpleVectorIndex.load_from_disk('simple_vector_index.json')

print("Without optimization")
start_time = time.time()
res = index.query("What is the population of Berlin?")
end_time = time.time()
print("Total time elapsed: {}".format(end_time - start_time))
print("Answer: {}".format(res))

print("With optimization")
start_time = time.time()
res = index.query("What is the population of Berlin?", optimizer=SentenceEmbeddingOptimizer(percentile_cutoff=0.5))
end_time = time.time()
print("Total time elapsed: {}".format(end_time - start_time))
print("Answer: {}".format(res))


In this example, the percentile_cutoff is set to 0.5, which means that the optimizer will only consider the top 50% of sentences based on their similarity to the query when optimizing the input text.

Source: (https://gpt-index.readthedocs.io/en/latest/how_to/analysis/optimizers.html)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
@Logan M hi, do you have hybrid search (semantic & keyword search together I think)example? it's said that 6.0 comes with this feature. and I tried percentile_cutoff optimizer, I don't see the difference, it seems the same query still get the same response nodes in nodes_with_score output as before(without optimizer). thanks !
The hybrid search is implemented using a custom retriever. You can see the example here! πŸ‘

https://github.com/jerryjliu/llama_index/blob/main/examples/query/CustomRetrievers.ipynb
thanks!!!
Add a reply
Sign up and join the conversation on Discord