prompts

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRAGPrompt = NewPromptTemplate(
	`Use the following context to answer the question at the end.
If you don't know the answer, just say that you don't know, don't try to make up an answer.

Context:
{{.context}}

Question: {{.query}}

Helpful Answer:`)

DefaultRAGPrompt is a default prompt for Retrieval-Augmented Generation.

View Source
var DefaultValidationPrompt = NewPromptTemplate(
	`You are an expert at evaluating whether a given context can help answer a user's question.

Context:
---
{{.context}}
---

Question: {{.query}}

Does the context contain information that is likely to be helpful in answering the question?
Answer only with "yes" or "no".

Answer:`)

Functions

This section is empty.

Types

type PromptTemplate

type PromptTemplate struct {
	Template string
}

PromptTemplate represents a string template that can be formatted.

func NewPromptTemplate

func NewPromptTemplate(template string) PromptTemplate

NewPromptTemplate creates a new prompt template.

func (PromptTemplate) Format

func (p PromptTemplate) Format(vars map[string]string) string

Format substitutes variables in the template string. Variables are in the format `{{.variable_name}}`.

Jump to

Keyboard shortcuts

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