transformer

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VoyageRerankScoreMetdataKey = "voyage-rerank-score"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CohereRerank added in v0.0.10

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

func NewCohereRerank added in v0.0.10

func NewCohereRerank() *CohereRerank

func (*CohereRerank) Rerank added in v0.0.10

func (c *CohereRerank) Rerank(
	ctx context.Context,
	query string, documents []document.Document,
) ([]document.Document, error)

func (*CohereRerank) WithAPIKey added in v0.0.10

func (c *CohereRerank) WithAPIKey(apiKey string) *CohereRerank

func (*CohereRerank) WithMaxChunksPerDoc added in v0.0.10

func (c *CohereRerank) WithMaxChunksPerDoc(maxChunksPerDoc int) *CohereRerank

func (*CohereRerank) WithModel added in v0.0.10

func (c *CohereRerank) WithModel(model CohereRerankModel) *CohereRerank

func (*CohereRerank) WithTopN added in v0.0.10

func (c *CohereRerank) WithTopN(topN int) *CohereRerank

type CohereRerankModel added in v0.0.10

type CohereRerankModel = model.RerankModel
const (
	CohereRerankScoreMetdataKey = "cohere-rerank-score"

	CohereRerankModelEnglishV20      CohereRerankModel = model.RerankModelEnglishV20
	CohereRerankModelMultilingualV20 CohereRerankModel = model.RerankModelMultilingualV20
)

type DallE

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

func NewDallE

func NewDallE() *DallE

func (*DallE) AsFile

func (d *DallE) AsFile(path string) *DallE

func (*DallE) AsImage

func (d *DallE) AsImage() *DallE

func (*DallE) AsURL

func (d *DallE) AsURL() *DallE

func (*DallE) Transform

func (d *DallE) Transform(ctx context.Context, input string) (any, error)

func (*DallE) WithClient

func (d *DallE) WithClient(client *openai.Client) *DallE

func (*DallE) WithImageSize

func (d *DallE) WithImageSize(imageSize DallEImageSize) *DallE

type DallEImageFormat

type DallEImageFormat string
const (
	DallEImageFormatURL   DallEImageFormat = "url"
	DallEImageFormatFile  DallEImageFormat = "file"
	DallEImageFormatImage DallEImageFormat = "image"
)

type DallEImageOutput

type DallEImageOutput any

type DallEImageSize

type DallEImageSize string
const (
	DallEImageSize256  DallEImageSize = openai.CreateImageSize256x256
	DallEImageSize512  DallEImageSize = openai.CreateImageSize512x512
	DallEImageSize1024 DallEImageSize = openai.CreateImageSize1024x1024
)

type HFTextToImage added in v0.1.0

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

func NewHFTextToImage added in v0.1.0

func NewHFTextToImage() *HFTextToImage

func (*HFTextToImage) Transform added in v0.1.0

func (h *HFTextToImage) Transform(ctx context.Context, input string) (any, error)

func (*HFTextToImage) WithModel added in v0.1.0

func (h *HFTextToImage) WithModel(model string) *HFTextToImage

func (*HFTextToImage) WithPersistImage added in v0.1.0

func (h *HFTextToImage) WithPersistImage(mediaFile string) *HFTextToImage

func (*HFTextToImage) WithToken added in v0.1.0

func (h *HFTextToImage) WithToken(token string) *HFTextToImage

type HFTextToImageRequest added in v0.1.0

type HFTextToImageRequest struct {
	Input string `json:"inputs"`
}

type HFTextToImageResponse added in v0.1.0

type HFTextToImageResponse struct {
	Output []byte
}

type VisualQuestionAnswering added in v0.0.9

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

func NewHFVisualQuestionAnswering added in v0.0.9

func NewHFVisualQuestionAnswering(mediaFile string) *VisualQuestionAnswering

func (*VisualQuestionAnswering) Transform added in v0.0.9

func (v *VisualQuestionAnswering) Transform(ctx context.Context, input string, all bool) (any, error)

func (*VisualQuestionAnswering) WithImage added in v0.0.9

func (v *VisualQuestionAnswering) WithImage(mediaFile string) *VisualQuestionAnswering

func (*VisualQuestionAnswering) WithModel added in v0.0.9

func (*VisualQuestionAnswering) WithToken added in v0.0.9

type VisualQuestionAnsweringRequest added in v0.0.9

type VisualQuestionAnsweringRequest struct {
	Inputs VisualQuestionAnsweringRequestInputs `json:"inputs"`
}

type VisualQuestionAnsweringRequestInputs added in v0.0.9

type VisualQuestionAnsweringRequestInputs struct {
	Image    string `json:"image"`
	Question string `json:"question"`
}

type VisualQuestionAnsweringResponse added in v0.0.9

type VisualQuestionAnsweringResponse struct {
	Score  float64 `json:"score"`
	Answer string  `json:"answer"`
}

type VoyageRerank added in v0.1.2

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

func NewVoyageRerank added in v0.1.2

func NewVoyageRerank() *VoyageRerank

func (*VoyageRerank) Rerank added in v0.1.2

func (v *VoyageRerank) Rerank(
	ctx context.Context,
	query string,
	documents []document.Document,
) ([]document.Document, error)

func (*VoyageRerank) WithModel added in v0.1.2

func (v *VoyageRerank) WithModel(model string) *VoyageRerank

Jump to

Keyboard shortcuts

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