Skip to content

Commit

Permalink
Merge pull request #199 from griptape-ai:remove-ollama-check
Browse files Browse the repository at this point in the history
Remove-ollama-check
  • Loading branch information
shhlife authored Dec 23, 2024
2 parents ca525ad + ef12c37 commit e9b67b9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 34 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ You can previous and download more examples [here](examples/README.md).

### Dec 24, 2024
* Fixed missing api key for OpenAI when getting a list of available models.
* Removed Ollama's model check using the library in favor of a javascript option.

### Dec 21, 2024
* Fixed issue where Griptape Agent Config: Custom Structure node was still requiring OPENAI_API_KEY.
Expand Down
6 changes: 3 additions & 3 deletions js/ConfigurationNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export function setupConfigurationNodes(nodeType, nodeData, app) {


let engine = null;
// if ((nodeData.name.includes("Ollama")) || (nodeData.name.includes("Griptape Util: Create Agent Modelfile"))) {
// engine="ollama"
// }
if ((nodeData.name.includes("Ollama")) || (nodeData.name.includes("Griptape Util: Create Agent Modelfile"))) {
engine="ollama"
}
if (nodeData.name.includes("LM Studio")) {
engine="lmstudio"
}
Expand Down
2 changes: 1 addition & 1 deletion js/versions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const versions = {
version: "2.0.6",
version: "2.0.7",
releaseDate: "2024-12-24",
name: "ComfyUI-Griptape",
description: "Griptape integration for ComfyUI",
Expand Down
17 changes: 8 additions & 9 deletions nodes/drivers/gtUIOllamaEmbeddingDriver.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from griptape.drivers import DummyEmbeddingDriver, OllamaEmbeddingDriver

from ..utils.ollama_utils import get_available_models
from .gtUIBaseEmbeddingDriver import gtUIBaseEmbeddingDriver

default_port = "11434"
default_base_url = "http://127.0.0.1"

models = get_available_models()
DEFAULT_MODEL = ""
for model in models:
if "embed" in model.lower():
DEFAULT_MODEL = model
break
# models = get_available_models()
# DEFAULT_MODEL = ""
# for model in models:
# if "embed" in model.lower():
# DEFAULT_MODEL = model
# break


class gtUIOllamaEmbeddingDriver(gtUIBaseEmbeddingDriver):
Expand Down Expand Up @@ -40,8 +39,8 @@ def INPUT_TYPES(s):
inputs["optional"].update(
{
"embedding_model": (
models,
{"default": DEFAULT_MODEL, "tooltip": "The embedding model to use"},
(),
{"tooltip": "The embedding model to use"},
),
}
)
Expand Down
13 changes: 6 additions & 7 deletions nodes/drivers/gtUIOllamaPromptDriver.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from griptape.drivers import OllamaPromptDriver

from ..utils.ollama_utils import get_available_models
from .gtUIBasePromptDriver import gtUIBasePromptDriver

default_port = "11434"
default_base_url = "http://127.0.0.1"

models = get_available_models()
DEFAULT_MODEL = ""
if len(models) > 0:
DEFAULT_MODEL = models[0]
# models = get_available_models()
# DEFAULT_MODEL = ""
# if len(models) > 0:
# DEFAULT_MODEL = models[0]


class gtUIOllamaPromptDriver(gtUIBasePromptDriver):
Expand Down Expand Up @@ -51,8 +50,8 @@ def INPUT_TYPES(s):
inputs["optional"].update(base_optional_inputs)
# inputs["optional"]["model"] = ((), {"tooltip": "The prompt model to use"})
inputs["optional"]["model"] = (
models,
{"default": DEFAULT_MODEL, "tooltip": "The prompt model to use"},
(),
{"tooltip": "The prompt model to use"},
)
inputs["optional"]["keep_alive"] = (
"INT",
Expand Down
14 changes: 7 additions & 7 deletions nodes/utils/gtUICreateAgentModelfile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from ..utils.ollama_utils import check_ollama_installed, get_available_models
from ..utils.ollama_utils import check_ollama_installed

default_port = "11434"
default_base_url = "http://127.0.0.1"

models = get_available_models()
DEFAULT_MODEL = ""
if len(models) > 0:
DEFAULT_MODEL = models[0]
# models = get_available_models()
# DEFAULT_MODEL = ""
# if len(models) > 0:
# DEFAULT_MODEL = models[0]


class gtUICreateAgentModelfile:
Expand All @@ -31,8 +31,8 @@ def INPUT_TYPES(s):
},
),
"base_model": (
models,
{"default": DEFAULT_MODEL, "tooltip": "The base model to use"},
(),
{"tooltip": "The base model to use"},
),
"agent": ("AGENT", {}),
"include_conversation_memory": ("BOOLEAN", {"default": True}),
Expand Down
13 changes: 6 additions & 7 deletions nodes/utils/gtUIRemoveOllamaModel.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from .ollama_utils import (
check_ollama_installed,
clean_result,
get_available_models,
run_ollama_command,
)

default_port = "11434"
default_base_url = "http://127.0.0.1"

models = get_available_models()
DEFAULT_MODEL = ""
if len(models) > 0:
DEFAULT_MODEL = models[0]
# models = get_available_models()
# DEFAULT_MODEL = ""
# if len(models) > 0:
# DEFAULT_MODEL = models[0]


class gtUIRemoveOllamaModel:
Expand All @@ -36,8 +35,8 @@ def INPUT_TYPES(s):
},
),
"model": (
models,
{"default": DEFAULT_MODEL, "tooltip": "The model to remove"},
(),
{"tooltip": "The model to remove"},
),
}
}
Expand Down

0 comments on commit e9b67b9

Please sign in to comment.