cheapmodel

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cheapmodel provides a minimal Anthropic Messages client used as the engine's injected extraction model. It implements engine.Model. (An OpenAI variant is a straightforward follow-up; the canonical model is Anthropic-shaped, so the Anthropic client is the natural first.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Usage

func Usage() (calls, inTokens, outTokens int64)

Usage returns the cumulative cheap-model usage (calls, input tokens, output tokens) since process start.

Types

type Anthropic

type Anthropic struct {
	BaseURL   string // default https://api.anthropic.com
	APIKey    string
	Model     string // e.g. claude-haiku-4-5
	MaxTokens int    // default 2048
	Client    *http.Client
	// AuthScheme selects how the API key is sent. "" or "x-api-key" sends the
	// x-api-key header (Anthropic default). "bearer" sends
	// Authorization: Bearer <APIKey> instead, for gateways (e.g. an IBM LiteLLM
	// Anthropic-compatible endpoint) that authenticate with a bearer token. The
	// anthropic-version header is sent in both cases.
	AuthScheme string
}

Anthropic calls a small Anthropic model with a single user prompt and returns the text of the first content block.

func (Anthropic) Complete

func (a Anthropic) Complete(ctx context.Context, prompt string) (string, error)

type OpenAI

type OpenAI struct {
	BaseURL   string // default https://api.openai.com
	APIKey    string
	Model     string // e.g. gpt-4o-mini
	MaxTokens int    // default 2048
	Client    *http.Client
}

OpenAI calls a small OpenAI chat-completions model with a single user prompt and returns the content of the first choice. It implements engine.Model.

func (OpenAI) Complete

func (o OpenAI) Complete(ctx context.Context, prompt string) (string, error)

Jump to

Keyboard shortcuts

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