Skip to content

[16.0][FIX] llm_ollama: ollama_models #35

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions llm_ollama/models/ollama_provider.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import datetime

import ollama

from odoo import api, models
Expand Down Expand Up @@ -68,18 +70,22 @@ def ollama_models(self):
for model in response.get("models", []):
# Basic model info
model_info = {
"name": model["name"],
"name": model.get("model", ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CristianoMafraJunior Hi, thank you for the lovely PR. I see in Ollama's doc that there is no key for model; rather, they return name.
https://github.com/ollama/ollama/blob/main/docs/api.md#response-25

Could you briefly let us know about your findings regarding this fix with docker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CristianoMafraJunior Hi, thank you for the lovely PR. I see in Ollama's doc that there is no key for model; rather, they return name. https://github.com/ollama/ollama/blob/main/docs/api.md#response-25

Could you briefly let us know about your findings regarding this fix with docker?

@adar2378 Everything we discovered running ollama on Docker is here in the issue #33 . Unfortunately, it doesn't bring the name information, but I will investigate this further.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CristianoMafraJunior maybe try to get name or model or "" as failsafe?

"details": {
"id": model["name"],
"id": model.get("model", ""),
"capabilities": ["chat"], # Default capability
"modified_at": model.get("modified_at"),
"modified_at": model.get("modified_at").strftime(
"%Y-%m-%dT%H:%M:%S.%fZ"
)
if isinstance(model.get("modified_at"), datetime)
else model.get("modified_at"),
"size": model.get("size"),
"digest": model.get("digest"),
},
}

# Add embedding capability if model name suggests it
if "embedding" in model["name"].lower():
if "embedding" in model["model"].lower():
model_info["details"]["capabilities"].append("embedding")

yield model_info