Version: 0.1.1
Title: R 'shiny' Interface for Chatting with Large Language Models Offline on Local with 'ollama'
Description: Chat with large language models on your machine without internet with complete privacy via 'ollama', powered by R 'shiny' interface. For more information on 'ollama', visit https://ollama.com.
Maintainer: Indraneel Chakraborty <hello.indraneel@gmail.com>
License: Apache License (≥ 2)
URL: https://www.indraneelchakraborty.com/shiny.ollama/, https://github.com/ineelhere/shiny.ollama
BugReports: https://github.com/ineelhere/shiny.ollama/issues
Encoding: UTF-8
Imports: shiny (≥ 1.7.0), bslib (≥ 0.4.0), httr (≥ 1.4.0), jsonlite (≥ 1.8.0), markdown, mockery
Depends: R (≥ 3.5.0)
Suggests: testthat (≥ 3.0.0), pkgdown (≥ 2.0.0)
Config/testthat/edition: 3
RoxygenNote: 7.3.2
Date: 2025-01-12
NeedsCompilation: no
Packaged: 2025-01-27 04:59:21 UTC; neel0
Author: Indraneel Chakraborty ORCID iD [aut, cre]
Repository: CRAN
Date/Publication: 2025-01-27 05:40:02 UTC

Create the Shiny server function for the chat interface

Description

Create the Shiny server function for the chat interface

Usage

create_chat_server()

Value

A Shiny server function


Create the Shiny UI for the chat interface

Description

Create the Shiny UI for the chat interface

Usage

create_chat_ui()

Value

A Shiny UI object


Fetch available models from Ollama API

Description

Fetch available models from Ollama API

Usage

fetch_models()

Value

Character vector of model names or an error message


Convert chat history to downloadable format

Description

Convert chat history to downloadable format

Usage

format_chat_history(messages, format = c("HTML", "CSV"))

Arguments

messages

List of chat messages

format

Character string specifying format ("HTML" or "CSV")

Value

Formatted chat history as a character string (HTML) or a data frame (CSV)


Format a message as markdown

Description

This helper function formats a message with a specified role (User, Assistant, or System) into a markdown-styled string.

Usage

format_message_md(role, content)

Arguments

role

A character string specifying the role (e.g., "User", "Assistant", "System").

content

A character string containing the message content.

Value

A character string formatted as markdown.


Parse a markdown-formatted message

Description

This function extracts the role and content from a markdown-formatted message.

Usage

parse_message(message)

Arguments

message

A character string containing the markdown-formatted message.

Value

A list with two elements:

role

A character string representing the role (e.g., "User", "Assistant", "System").

content

A character string containing the extracted message content.


Run shiny Application for Chat Interface

Description

Launches a shiny app for interacting with the Ollama API

Usage

run_app()

Value

No return value, called for side effects.


Send message to Ollama API and get response

Description

Send message to Ollama API and get response

Usage

send_ollama_message(message, model)

Arguments

message

Character string containing the user message

model

Character string specifying the model name

Value

A list with elements 'success' (logical) and either 'response' (character) or 'error' (character)