tokenizer

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAI

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

func NewOpenAI

func NewOpenAI(modelName string) *OpenAI

func (*OpenAI) GetNumTokens

func (o *OpenAI) GetNumTokens(text string) (int, error)

func (*OpenAI) GetNumTokensFromMessage

func (o *OpenAI) GetNumTokensFromMessage(messages schema.ChatMessages) (int, error)

func (*OpenAI) GetTokenIDs

func (o *OpenAI) GetTokenIDs(text string) ([]int, error)

type Simple

type Simple struct{}

func NewSimple

func NewSimple() *Simple

func (*Simple) GetNumTokens

func (t *Simple) GetNumTokens(text string) (int, error)

func (*Simple) GetNumTokensFromMessage

func (t *Simple) GetNumTokensFromMessage(messages schema.ChatMessages) (int, error)

func (*Simple) GetTokenIDs

func (t *Simple) GetTokenIDs(text string) ([]int, error)

Jump to

Keyboard shortcuts

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