langchain

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = PredictOptions{
	Model:       "gpt2",
	MaxTokens:   200,
	Temperature: 0.96,
	StopWords:   nil,
}

Functions

This section is empty.

Types

type HuggingFace

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

func NewHuggingFace

func NewHuggingFace(repoId string) (*HuggingFace, error)

func (*HuggingFace) PredictHuggingFace

func (s *HuggingFace) PredictHuggingFace(text string, opts ...PredictOption) (*Predict, error)

type Predict

type Predict struct {
	Completion string
}

type PredictOption

type PredictOption func(p *PredictOptions)

func SetMaxTokens

func SetMaxTokens(maxTokens int) PredictOption

func SetModel

func SetModel(model string) PredictOption

func SetStopWords

func SetStopWords(stopWords []string) PredictOption

func SetTemperature

func SetTemperature(temperature float64) PredictOption

type PredictOptions

type PredictOptions struct {
	Model string `json:"model"`
	// MaxTokens is the maximum number of tokens to generate.
	MaxTokens int `json:"max_tokens"`
	// Temperature is the temperature for sampling, between 0 and 1.
	Temperature float64 `json:"temperature"`
	// StopWords is a list of words to stop on.
	StopWords []string `json:"stop_words"`
}

func NewPredictOptions

func NewPredictOptions(opts ...PredictOption) PredictOptions

NewPredictOptions Create a new PredictOptions object with the given options.

Jump to

Keyboard shortcuts

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