Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue with Ollama version and response format #679

Open
windprince opened this issue Jan 15, 2025 · 1 comment
Open

Possible issue with Ollama version and response format #679

windprince opened this issue Jan 15, 2025 · 1 comment

Comments

@windprince
Copy link

windprince commented Jan 15, 2025

Describe your issue

model["name"] -> model.model due to version change in Ollama (0.5.0 -> 0.5.4)

How To Reproduce

Steps to reproduce the behavior (example):

  1. python devika.py
  2. bun run start --host
  3. go to http://localhost:3001/

Expected behavior

Browser should respond and allow user to select search engine, select model, etc.

Screenshots and logs

The log file/stderr in the 'python devika.py' terminal indicates an error:

File "/devika/devika.py", line 63, in data
models = LLM().list_models()

File "/devika/src/llm/llm.py", line 71, in init
self.models["OLLAMA"] = [(model["name"], model["name"]) for model in ollama.models]

File "/devika/.venv/lib/python3.12/site-packages/ollama/_types.py", line 33, in getitem
raise KeyError(key)
KeyError: 'name'

Configuration

- OS: Linux 24.04
- Python version: 3.12.3
- Node version: v18.19.1
- bun version: 1.1.43
- ollama version: 0.5.4
- search engine: N/A
- model: N/A

Additional context

Code modified slightly from:
if ollama.client:
self.models["OLLAMA"] = [(model["name"], model["name"]) for model in ollama.models]

To:
if ollama.client:
try:
# Create tuples using the model name attribute
self.models["OLLAMA"] = [(model.model, model.model) for model in ollama.models]
except Exception as e:
print(f"Error loading Ollama models: {e}")
# Initialize with empty list if there's an error
self.models["OLLAMA"] = []
@guanchao
Copy link

I works, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants