prompt

package
v0.0.0-...-1ea5cf0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

A “prompt” refers to the input to the model.

This input is rarely hard coded, but rather is often constructed from multiple components. A PromptTemplate is responsible for the construction of this input.

PromptTemplate is powered by Go text/template, however we provided simplistic interface to interact with. Everything is a string and data passed along to the template as map[string]string.

Example :

template, _ := NewPromptTemplate("template_name", "{{.string}} {{.stringfloat}} {{.stringinteger}}")
Data := map[string]string{"string": "string", "stringfloat": "0.1", "stringinteger": "1"}
outputPrompt, _ := P.FormatPrompt(Data)

outputPrompt will containt "string 0.1 1"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PromptTemplate

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

func NewPromptTemplate

func NewPromptTemplate(name string, templateString string) (output_template *PromptTemplate, err error)

NewPromptTemplate create a new prompt template

func (*PromptTemplate) FormatPrompt

func (P *PromptTemplate) FormatPrompt(Data map[string]string) (output_prompt string, err error)

FormatPrompt to generate prompt from template

Jump to

Keyboard shortcuts

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