llm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 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.

Example
package main

import (
	"context"
	"fmt"

	"github.com/primandproper/platform/llm"
	llmnoop "github.com/primandproper/platform/llm/noop"
)

func main() {
	provider := llmnoop.NewProvider()

	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: ""

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.

Directories

Path Synopsis
Package mock provides mock implementations of the llm package's interfaces.
Package mock provides mock implementations of the llm package's interfaces.

Jump to

Keyboard shortcuts

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