openaicompat

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package openaicompat provides a lightweight client for any OpenAI-compatible chat completions API (llama.cpp, vLLM, LM Studio, Ollama /v1, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls a single OpenAI-compatible /v1/chat/completions endpoint.

func NewClient

func NewClient(baseURL, model, apiKey string) *Client

NewClient creates a Client for the given base URL (e.g. "http://localhost:8080"). apiKey may be empty for unauthenticated local servers.

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, systemPrompt, userPrompt string, temperature float64, maxTokens int) (string, error)

Complete sends a single user message to the model and returns the assistant reply. systemPrompt may be empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL