Find answers from the community

Updated 3 months ago

I am impressed with the llama index Now

I am impressed with the llama index. Now, I have tried to implement a multi-step query engine with a metadata extractor, but I am facing issues related to the significant cost of embedding with OpenAI.

Can I use different llama indexes for text embedding and the query engine? My plan is to use Hugging Face for text embedding and OpenAI for the query engine. Could you provide some insights and example code? I tried looking in the documentation but couldn't find it. Thank you.
W
f
3 comments
Yes you can use HF embeddings for text, You just need to pass it in the service context.

Plain Text
from llama_index import LangchainEmbedding
from langchain.embeddings.huggingface import HuggingFaceEmbeddings

embed_model = LangchainEmbedding(HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2"))
service_context = ServiceContext.from_defaults( embed_model=embed_model)


This will help you to use HF embeddings and use OpenAI for query engine.
Okay, thank you. I will try it out.

I have one more question regarding the query engine. I want to create a chatbot that can make queries to the context stored in the vector store. The results from these queries should also be combined as follow-ups for discussions/chats with the OpenAI chat model. This way, I can get results from my own dataset along with GPT-3.5 context to gain broader insights.

For this purpose, what kind of query engine should I use?
Add a reply
Sign up and join the conversation on Discord