Skip to content

Commit

Permalink
feat: add Farm() *Farm access method to *Ollama
Browse files Browse the repository at this point in the history
  • Loading branch information
presbrey committed Aug 25, 2024
1 parent 5a5db29 commit c624f79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion ollama.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ 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()
defer ollama.farm.mu.RUnlock()
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()
Expand Down

0 comments on commit c624f79

Please sign in to comment.