Find answers from the community

Updated 9 months ago

Without all the generative fluff

Without all the generative fluff
L
b
2 comments
Yes --

Plain Text
from llama_index import VectorStoreIndex
from llama_index.schema import TextNode

list_of_sentences = ["one", "two"]
nodes = [TextNode(text=x) for x in linst_of_sentences]

index = VectorStoreIndex(nodes=nodes)

retriever = index.as_retriever(similarity_top_k=2)
source_nodes = retriever.retrieve("query")
Appreciate it, that's all I needed🙏
Add a reply
Sign up and join the conversation on Discord