Find answers from the community

Updated 3 months ago

How do I find an old thread I was on?

How do I find an old thread I was on?
L
d
46 comments
You can use the search above and search for your name πŸ€”
Ok so funny thing is the thread I was looking for actually had the solution or part of it suggested by you. It was about how to use a locally running llama.cpp server in llamaindex and how to do it... would it be alright if I asked how to do it or where to start?
I just don't understand the syntax for including a local llm
Right so, I think you just need to use the OpenAILike to connect to the llama-cpp server

Plain Text
from llama_index.llms import OpenAILike
from llama_index import ServiceContext, set_global_service_context

llm = OpenAILike(model="..", api_base="http://127.0.0.1:8000/api/v1", api_key="fake", context_window=4096, is_chat_model=False)

service_context = ServiceContext.from_defaults(llm=llm, embed_model=...)
set_global_service_context(service_context)
Depending on the llm you are using, you might need to setup some prompt formatting stuff, but it depends
So I did see that part but I'm confused about how to implement that into the five lines of code example
Like sort of where it goes
Do I just add these lines into the five lines of code example?
pretty much πŸ™‚ I skipped setting up an embedding model, you can set embed_model="local" or configure whatever embedding you need
And if so, do my documents still get uploaded to the embedding model? I'm trying to make everything local
so for the embed model, where can I direct it to the path of the embedding model?
I can just download the BAAI model and keep it on my laptop right?
You can put embed_model="local:BAAI/bge-base-en-v1.5" and it will automatically cache it

If you want to provide it a specific path, you gotta pull out the embedding class πŸ˜…

Plain Text
from llama_index.embeddings import HuggingFaceEmbedding
embed_model = HuggingFaceEmbedding(modal_name="<path_to_my_model>")
I will try that and get back to you... thank you so much!!
I'm trying a project which requires absolutely no data be transferred online, hence the questions... I'm trying to avoid using any OpenAI or other cloud based LLM sources
Is there a way for me to pin this thread for myself?
hmmm I don't think so πŸ€” Probably best to save this info somewhere lol
I'm always around to answer more as well haha
Ok gotcha, I've got the screenshots
Of course thank you!
Sorry to be back so soon, how do I download the BAAI model? It doesn't seem to be a single gguf file. Should I download it and quantize it and convert it like I do with the raw LLama2 model>
embed_model = HuggingFaceEmbedding(modal_name="BAAI/bge-base-en-v1.5") will download the model at cache it for you

Atlernatively, you can clone and download any huggingface model using something like
Plain Text
git lfs install
git clone https://huggingface.co/BAAI/bge-base-en-v1.5


Embedding models usually aren't gguf, they are usually a collection of stuff needed for huggingface and pytorch to load the model
Oh ok so I can just refer to the folder in the code then?
And yeah I did that and I suppose its not causing any error because the error I'm getting refers to the lack on an OpenAI api key. I'm trying to use the Llamacpp integration for the llm but I suppose I've done something wrong.
Can you share the code?
ah, move the service_context and set_global_service_context to before creating the index
Oh sorry deleted it by accident
was trying to reformat it as code
I think its working... I'll play around it a bit
So the service_context is needed because it defines the llm or embedding model which is used in creating the index right?
exactly πŸ™‚
(in the future, this will be a lot easier to do! I realize its a tad clunky)
No its alright. I had previously looked in on the documentation about a month or two ago and things are already better... the community also seems to be pretty active
and tbh as long as it work
Add a reply
Sign up and join the conversation on Discord