tokenizer

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cohere added in v0.0.30

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

func NewCohere added in v0.0.30

func NewCohere(modelName string) (*Cohere, error)

func (*Cohere) GetNumTokens added in v0.0.30

func (t *Cohere) GetNumTokens(text string) (uint, error)

GetNumTokens returns the number of tokens in the provided text.

func (*Cohere) GetNumTokensFromMessage added in v0.0.30

func (t *Cohere) GetNumTokensFromMessage(messages schema.ChatMessages) (uint, error)

GetNumTokensFromMessage returns the number of tokens in the provided chat messages.

func (*Cohere) GetTokenIDs added in v0.0.30

func (t *Cohere) GetTokenIDs(text string) ([]uint, error)

GetTokenIDs returns the token IDs corresponding to the provided text.

type GPT2 added in v0.0.24

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

func NewGPT2 added in v0.0.24

func NewGPT2() (*GPT2, error)

func (*GPT2) GetNumTokens added in v0.0.24

func (t *GPT2) GetNumTokens(text string) (uint, error)

GetNumTokens returns the number of tokens in the provided text.

func (*GPT2) GetNumTokensFromMessage added in v0.0.24

func (t *GPT2) GetNumTokensFromMessage(messages schema.ChatMessages) (uint, error)

GetNumTokensFromMessage returns the number of tokens in the provided chat messages.

func (*GPT2) GetTokenIDs added in v0.0.24

func (t *GPT2) GetTokenIDs(text string) ([]uint, error)

GetTokenIDs returns the token IDs corresponding to the provided text.

type OpenAI

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

func NewOpenAI

func NewOpenAI(modelName string) *OpenAI

func (*OpenAI) GetNumTokens

func (t *OpenAI) GetNumTokens(text string) (uint, error)

GetNumTokens returns the number of tokens in the provided text.

func (*OpenAI) GetNumTokensFromMessage

func (t *OpenAI) GetNumTokensFromMessage(messages schema.ChatMessages) (uint, error)

GetNumTokensFromMessage returns the number of tokens in the provided chat messages.

func (*OpenAI) GetTokenIDs

func (t *OpenAI) GetTokenIDs(text string) ([]uint, error)

GetTokenIDs returns the token IDs corresponding to the provided text.

Jump to

Keyboard shortcuts

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