From c624f79512b4ef3d8987d84ea1e325590bc3522c Mon Sep 17 00:00:00 2001 From: presbrey Date: Sun, 25 Aug 2024 16:02:34 -0400 Subject: [PATCH] feat: add Farm() *Farm access method to *Ollama --- README.md | 1 + ollama.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68ffec7..ea36d79 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Note: When an Ollama instance goes offline, OllamaFarm automatically selects the ### Ollama Methods * `Client() *api.Client`: Returns the Ollama client. +* `Farm() *Farm`: Returns the Farm that this Ollama belongs to. * `Group() string`: Returns the Ollama's group. * `Online() bool`: Returns whether the Ollama is online. * `Priority() int`: Returns the Ollama's priority. diff --git a/ollama.go b/ollama.go index 2b8279e..9605dee 100644 --- a/ollama.go +++ b/ollama.go @@ -14,6 +14,11 @@ func (ollama *Ollama) Client() *api.Client { return ollama.client } +// Farm returns the Farm that this Ollama belongs to. +func (ollama *Ollama) Farm() *Farm { + return ollama.farm +} + // Group returns the Ollama's group. func (ollama *Ollama) Group() string { ollama.farm.mu.RLock() @@ -21,7 +26,7 @@ func (ollama *Ollama) Group() string { return ollama.properties.Group } -// Offline returns whether the Ollama is online. +// Online returns whether the Ollama is online. func (ollama *Ollama) Online() bool { ollama.farm.mu.RLock() defer ollama.farm.mu.RUnlock()