llm

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package llm provides a language model completion interface with implementations for Anthropic and OpenAI providers.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletionParams

type CompletionParams struct {
	Model    string
	Messages []Message
}

CompletionParams represents parameters for a completion request.

type CompletionResult

type CompletionResult struct {
	Content string
}

CompletionResult represents the result of a completion request.

type Message

type Message struct {
	Role    string // "user", "assistant", "system", "tool"
	Content string
}

Message represents a chat message.

type Provider

type Provider interface {
	Completion(ctx context.Context, params CompletionParams) (*CompletionResult, error)
}

Provider is the interface for LLM providers.

func NewNoopProvider

func NewNoopProvider() Provider

NewNoopProvider returns a no-op provider that returns empty responses.

Example
package main

import (
	"context"
	"fmt"

	"github.com/verygoodsoftwarenotvirus/platform/v2/llm"
)

func main() {
	provider := llm.NewNoopProvider()

	result, err := provider.Completion(context.Background(), llm.CompletionParams{
		Model: "example-model",
		Messages: []llm.Message{
			{Role: "user", Content: "Hello!"},
		},
	})
	if err != nil {
		panic(err)
	}

	fmt.Printf("content: %q\n", result.Content)
}
Output:

content: ""

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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