Documentation ¶
Overview ¶
Package tokenizer provides utilities for tokenizing text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claude ¶ added in v0.0.47
type Claude struct {
// contains filtered or unexported fields
}
func (*Claude) GetNumTokens ¶ added in v0.0.47
GetNumTokens returns the number of tokens in the provided text.
func (*Claude) GetNumTokensFromMessage ¶ added in v0.0.47
func (t *Claude) GetNumTokensFromMessage(ctx context.Context, messages schema.ChatMessages) (uint, error)
GetNumTokensFromMessage returns the number of tokens in the provided chat messages.
type Cohere ¶ added in v0.0.30
type Cohere struct {
// contains filtered or unexported fields
}
func (*Cohere) GetNumTokens ¶ added in v0.0.30
GetNumTokens returns the number of tokens in the provided text.
func (*Cohere) GetNumTokensFromMessage ¶ added in v0.0.30
func (t *Cohere) GetNumTokensFromMessage(ctx context.Context, messages schema.ChatMessages) (uint, error)
GetNumTokensFromMessage returns the number of tokens in the provided chat messages.
type GPT2 ¶ added in v0.0.24
type GPT2 struct {
// contains filtered or unexported fields
}
func (*GPT2) GetNumTokens ¶ added in v0.0.24
GetNumTokens returns the number of tokens in the provided text.
func (*GPT2) GetNumTokensFromMessage ¶ added in v0.0.24
func (t *GPT2) GetNumTokensFromMessage(ctx context.Context, messages schema.ChatMessages) (uint, error)
GetNumTokensFromMessage returns the number of tokens in the provided chat messages.
type GoogleGenAI ¶ added in v0.0.92
type GoogleGenAI struct {
// contains filtered or unexported fields
}
func NewGoogleGenAI ¶ added in v0.0.92
func NewGoogleGenAI(client GoogleGenAIClient, model string) *GoogleGenAI
func (*GoogleGenAI) GetNumTokens ¶ added in v0.0.92
GetNumTokens returns the number of tokens in the provided text.
func (*GoogleGenAI) GetNumTokensFromMessage ¶ added in v0.0.92
func (t *GoogleGenAI) GetNumTokensFromMessage(ctx context.Context, messages schema.ChatMessages) (uint, error)
GetNumTokensFromMessage returns the number of tokens in the provided chat messages.
type GoogleGenAIClient ¶ added in v0.0.92
type GoogleGenAIClient interface {
CountTokens(context.Context, *generativelanguagepb.CountTokensRequest, ...gax.CallOption) (*generativelanguagepb.CountTokensResponse, error)
}
GoogleGenAIClient is an interface for the GoogleGenAI model client.
type OpenAI ¶
type OpenAI struct {
// contains filtered or unexported fields
}
func (*OpenAI) GetNumTokens ¶
GetNumTokens returns the number of tokens in the provided text.
func (*OpenAI) GetNumTokensFromMessage ¶
func (t *OpenAI) GetNumTokensFromMessage(ctx context.Context, messages schema.ChatMessages) (uint, error)
GetNumTokensFromMessage returns the number of tokens in the provided chat messages.