You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
I have this basic code for RAG using Auto-Merge technique wthin llamaindex
node_parser = HierarchicalNodeParser.from_defaults(chunk_sizes=chunk_size)
nodes = node_parser.get_nodes_from_documents([doc])
storage_context = StorageContext.from_defaults()
storage_context.docstore.add_documents(nodes)
index = VectorStoreIndex(nodes, storage_context=storage_context , embed_model=embed_model)
postproc = None
reranker = SentenceTransformerRerank(model="cross-encoder/ms-marco-MiniLM-L-2-v2", top_n=3)
retriever = index.as_retriever(similarity_top_k=retrieval_metadata_similarity)
retriever = AutoMergingRetriever(retriever,index.storage_context,verbose=True)
response_synthesizer = get_response_synthesizer(response_mode=response_mode)
node_postprocessors = [postproc, reranker]
node_postprocessors = [processor for processor in node_postprocessors if processor is not None]
query_engine = RetrieverQueryEngine(retriever, node_postprocessors=node_postprocessors)
Now, I want to use nominic-embeddings via lmstudio, whose basic code is this
Make sure to pip install openai first
from openai import OpenAI
client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio")
def get_embedding(text, model="nomic-ai/nomic-embed-text-v1.5-GGUF"):
text = text.replace("\n", " ")
return client.embeddings.create(input = [text], model=model).data[0].embedding
print(get_embedding("Once upon a time, there was a cat."))
However, this gives me embeddings directly, whereas I want to use in the above code (specifically in place of vectorstoreindex)
How can I do that?
The text was updated successfully, but these errors were encountered:
I have this basic code for RAG using Auto-Merge technique wthin llamaindex
Now, I want to use nominic-embeddings via lmstudio, whose basic code is this
Make sure to
pip install openai
firstHowever, this gives me embeddings directly, whereas I want to use in the above code (specifically in place of vectorstoreindex)
How can I do that?
The text was updated successfully, but these errors were encountered: