ai-shell icon indicating copy to clipboard operation
ai-shell copied to clipboard

Use local LLM via Ollama

Open Norfeldt opened this issue 1 year ago • 6 comments

Is it possible to use a local LLM via Ollama. If, what's the setup and what's the requirement for which LLM I can use (guessing it has to use openai api syntax)?

Norfeldt avatar Jul 31 '24 18:07 Norfeldt

  1. ai config a. change openai api endpoint to http://{your ollama ip:port}/v1 b. if step a is done properly, then when you select 'Model ', you can see all models in your ollama, just select your prefer one (if not working, check if OLLAMA_ORIGINS=* has been setup correctly)

  2. next will be a trick, looks still ai shell will look for 'gpt-3.5-turbo' model, then let's create one fake one in ollama to cheat ai shell for example: ollama show llama3.1:latest --modelfile > /tmp/llama3.1.modelfile ollama create gpt-3.5-turbo --file /tmp/llama3.1.modelfile ollama list

  3. test ai list files

Done.

netcaster1 avatar Aug 10 '24 04:08 netcaster1

It starts writing out the command but then cancels itself and says this:

Request to OpenAI failed with status 404:

{ "error": { "message": "model "gpt-3.5-turbo" not found, try pulling it first", "type": "api_error", "param": null, "code": null } }

Ajaymamtora avatar Aug 11 '24 15:08 Ajaymamtora

@Ajaymamtora This was fixed in #115 but a new version is not released yet. @steve8708 could you help us with that?

mxl avatar Sep 21 '24 06:09 mxl

published!

steve8708 avatar Oct 01 '24 18:10 steve8708

so is this feature implemented? I just wanna know if I can run this with ollama models.

ibrahim-string avatar Dec 21 '24 11:12 ibrahim-string

in my case worked my .ai-shell is:

OPENAI_KEY=ollama
MODEL=deepseek-r1:latest
OPENAI_API_ENDPOINT=http://localhost:11434/v1
LANGUAGE=zh-Hant
OLLAMA_ORIGINS=*

iHad168 avatar Apr 23 '25 10:04 iHad168