
POST a chat-completion request to an OpenAI-compatible endpoint
Source:R/llm.R
morie_llm_request_completion.RdPOST a chat-completion request to an OpenAI-compatible endpoint
Examples
# \donttest{
msgs <- list(list(role = "user", content = "Say hello"))
# Second arg is whatever model your Ollama server serves (see `ollama list`).
res <- try(morie_llm_request_completion("http://localhost:11434", "your-model", msgs))
#> Error in httr2::req_perform(req) : Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! Couldn't connect to server [localhost]:
#> Failed to connect to localhost port 11434 after 0 ms: Couldn't connect to server
# }