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
names= [line.split()[0].replace(":latest", "") forlineinlines[1:] ifline.strip()] # Extract names, trim out ":latest", skip header
202
+
returnnames
199
203
200
-
# If there are no downloaded models, prompt them to download a model and try again
201
-
ifnotnames:
202
-
time.sleep(1)
203
-
204
-
interpreter.display_message(f"\nYou don't have any Ollama models downloaded. To download a new model, run `ollama run <model-name>`, then start a new interpreter session. \n\n For a full list of downloadable models, check out [https://ollama.com/library](https://ollama.com/library) \n")
205
-
206
-
print("Please download a model then try again\n")
207
-
time.sleep(2)
208
-
sys.exit(1)
204
+
llama3_installed=True
205
+
names=list_ollama_models()
206
+
if"llama3"notinnames:
207
+
# If a user has other models installed but not llama3, let's display the correct message
208
+
ifnotnames:
209
+
llama3_installed=False
210
+
names.insert(0, "llama3")
209
211
210
212
# If there are models, prompt them to select one
211
-
else:
212
-
time.sleep(1)
213
+
time.sleep(1)
214
+
215
+
ifllama3_installed:
213
216
interpreter.display_message(f"**{len(names)} Ollama model{'s'iflen(names) !=1else''} found.** To download a new model, run `ollama run <model-name>`, then start a new interpreter session. \n\n For a full list of downloadable models, check out [https://ollama.com/library](https://ollama.com/library) \n")
214
217
215
-
# Create a new inquirer selection from the names
216
-
name_question= [
217
-
inquirer.List('name', message="Select a downloaded Ollama model", choices=names),
0 commit comments