Learn R Programming

firmmatchr (version 0.1.3)

openai_chat_request: Internal OpenAI/Local LLM Chat Completion Wrapper

Description

Sends a request to a standard OpenAI-compatible endpoint (e.g. /v1/chat/completions). Used for both OpenAI's official API and local LLMs (Ollama, LM Studio, vLLM).

Usage

openai_chat_request(system_msg, user_msg, endpoint, api_key, model)

Value

A character string (the JSON response) or NULL on failure.

Arguments

system_msg

String. The instructions for the LLM.

user_msg

String. The specific case to evaluate.

endpoint

String. Base URL (e.g., "http://localhost:11434/v1").

api_key

String. API Key. Often not required for local LLMs.

model

String. Model name.