Skip to contents

Tests whether the Ollama server is running or not.

Usage

test_connection(url = "http://localhost:11434", logical = FALSE)

Arguments

url

The URL of the Ollama server. Default is http://localhost:11434

logical

Logical. If TRUE, returns a boolean value. Default is FALSE.

Value

Boolean value or httr2 response object, where status_code is either 200 (success) or 503 (error).

Examples

test_connection(logical = TRUE)
#> Ollama local server not running or wrong server.
#> Download and launch Ollama app to run the server. Visit https://ollama.com or https://github.com/ollama/ollama
#> [1] FALSE
test_connection("http://localhost:11434") # default url
#> Ollama local server not running or wrong server.
#> Download and launch Ollama app to run the server. Visit https://ollama.com or https://github.com/ollama/ollama
#> <httr2_response>
#> GET http://localhost:11434
#> Status: 503 Service Unavailable
#> Body: None
test_connection("http://127.0.0.1:11434")
#> Ollama local server not running or wrong server.
#> Download and launch Ollama app to run the server. Visit https://ollama.com or https://github.com/ollama/ollama
#> <httr2_response>
#> GET http://127.0.0.1:11434
#> Status: 503 Service Unavailable
#> Body: None