prompts

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package prompts provides prompt templates for LLM interactions.

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 template for Retrieval-Augmented Generation. It instructs the model to answer based on the provided context and to acknowledge when it doesn't know the answer.

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:`)

DefaultValidationPrompt is a prompt template for validating context relevance. It asks the model to determine if the provided context is helpful for answering the user's question. The expected response is "yes" or "no".

Functions

This section is empty.

Types

type PromptTemplate

type PromptTemplate struct {
	// Template is the raw template string with placeholders.
	Template string
}

PromptTemplate represents a string template that can be formatted with variables. Variables are in the format `{{.variable_name}}` and are replaced with values.

func NewPromptTemplate

func NewPromptTemplate(template string) PromptTemplate

NewPromptTemplate creates a new prompt template from the given string.

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