R/retro_chat_mock.R

Defines functions retro_chat_mock

Documented in retro_chat_mock

#' @title Mock chat constructor
#' @export
#' @family chats
#' @description Create an `ellmer` chat object that does not
#'   authenticate or connect to any real provider. Useful for
#'   testing and development without network access.
#' @details The returned chat supports registering tools, setting
#'   system prompts, and all other local operations. It will
#'   error only if you attempt to send a message to the model.
#' @return An `ellmer` chat object.
#' @examples
#'   chat <- retro_chat_mock()
#'   chat$get_system_prompt()
retro_chat_mock <- function() {
  ellmer::chat_openai_compatible(
    base_url = "http://localhost:57000",
    model = "mock"
  )
}

Try the retroglyph package in your browser

Any scripts or data that you put into this service are public.

retroglyph documentation built on Dec. 4, 2026, 1:07 a.m.