Learn R Programming

llmhelper (version 1.0.0)

llmhelper-package: llmhelper: Unified Interface for Large Language Model Interactions

Description

Provides a unified interface for interacting with Large Language Models (LLMs) through various providers including OpenAI https://platform.openai.com/docs/api-reference, Ollama https://ollama.com/, and other OpenAI-compatible APIs. Features include automatic connection testing, max_tokens limit auto-adjustment, structured JSON responses with schema validation, interactive JSON schema generation, prompt templating, and comprehensive diagnostics.

The llmhelper package provides a unified and user-friendly interface for interacting with Large Language Models (LLMs) through various providers including OpenAI, Ollama, and other OpenAI-compatible APIs.

Arguments

Main Functions

llm_provider

Create an OpenAI-compatible LLM provider

llm_ollama

Create an Ollama LLM provider

get_llm_response

Get text or JSON responses from LLM

build_prompt

Build prompts from templates

set_prompt

Create prompt objects

generate_json_schema

Interactively generate JSON schemas

diagnose_llm_connection

Debug connection issues

Ollama Functions

ollama_list_models

List available Ollama models

ollama_download_model

Download Ollama models

ollama_delete_model

Delete Ollama models

Environment Variables

The package uses the following environment variables:

LLM_API_KEY

Default API key for LLM providers

OPENAI_API_KEY

OpenAI API key

DEEPSEEK_API_KEY

DeepSeek API key

Author

Maintainer: Zaoqu Liu liuzaoqu@163.com (ORCID)

Zaoqu Liu liuzaoqu@163.com

See Also