ollamatokenizer

package
v1.0.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 9 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigHTTP

type ConfigHTTP struct {
	BaseURL string
}

type EstimateTokenizer

type EstimateTokenizer struct{}

func NewEstimateTokenizer

func NewEstimateTokenizer() *EstimateTokenizer

func (*EstimateTokenizer) CountTokens

func (e *EstimateTokenizer) CountTokens(ctx context.Context, modelName string, prompt string) (int, error)

func (*EstimateTokenizer) OptimalModel

func (e *EstimateTokenizer) OptimalModel(ctx context.Context, baseModel string) (string, error)

func (*EstimateTokenizer) Tokenize

func (e *EstimateTokenizer) Tokenize(ctx context.Context, modelName string, prompt string) ([]int, error)

type HTTPClient

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

func (*HTTPClient) CountTokens

func (c *HTTPClient) CountTokens(ctx context.Context, modelName string, prompt string) (int, error)

func (*HTTPClient) OptimalModel

func (c *HTTPClient) OptimalModel(ctx context.Context, baseModel string) (string, error)

func (*HTTPClient) Tokenize

func (c *HTTPClient) Tokenize(ctx context.Context, modelName string, prompt string) ([]int, error)

type MockTokenizer

type MockTokenizer struct {
	FixedTokenCount int
	FixedModel      string
	CustomTokens    map[string][]int
}

func (MockTokenizer) CountTokens

func (m MockTokenizer) CountTokens(ctx context.Context, modelName string, prompt string) (int, error)

func (MockTokenizer) OptimalModel

func (m MockTokenizer) OptimalModel(ctx context.Context, baseModel string) (string, error)

func (MockTokenizer) Tokenize

func (m MockTokenizer) Tokenize(ctx context.Context, modelName string, prompt string) ([]int, error)

type Tokenizer

type Tokenizer interface {
	Tokenize(ctx context.Context, modelName string, prompt string) ([]int, error)
	CountTokens(ctx context.Context, modelName string, prompt string) (int, error)
	OptimalModel(ctx context.Context, baseModel string) (string, error)
}

func NewHTTPClient

func NewHTTPClient(ctx context.Context, cfg ConfigHTTP) (Tokenizer, func() error, error)

func WithActivityTracker

func WithActivityTracker(client Tokenizer, tracker libtracker.ActivityTracker) Tokenizer

Jump to

Keyboard shortcuts

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