It is impossible to use any other LLM than OpenAI for querying SQL
Even though the manual says you can use ollama to load other LLMs such as Llama 2 and use the following commands to use it: llm = Ollama(model="llama2") service_context = ServiceContext.from_defaults(llm=llm)
As soon it finds and openai.api_key it just uses openAI and disregards the above. Also, it downloads the BAAI--bge-small-en model for no reason, as it cannot use it if we remove the open ai key, as it throws the message: _Exception ignored in: <function _LlamaContext.del at 0x7f4d507ddaf0> Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/llama_cpp/llama.py", line 422, in del TypeError: 'NoneType' object is not callable Exception ignored in: <function _LlamaModel.del at 0x7f4d507dbb80> Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/llama_cpp/llama.py", line 240, in del TypeError: 'NoneType' object is not callable Exception ignored in: <function LlamaBatch.del at 0x7f4d507dfe50> Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/llama_cpp/llama.py", line 670, in del TypeError: 'NoneType' object is not callable