session

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithSystemPrompt

func WithSystemPrompt(prompt string) opt

WithSystemPrompt sets a system prompt that is included in every LLM request.

func WithTranscript

func WithTranscript(transcript []llm.Message) opt

WithTranscript initializes the session with a seed transcript. This can be used to provide context or examples for the conversation. The seed transcript is preserved and can be reset to with the Reset() method.

Types

type Session

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

Session tracks conversation state across multiple LLM completions.

func NewSession

func NewSession(l llm.LLM, opts ...opt) *Session

NewSession creates a new Session bound to the provided LLM.

func (*Session) Complete

func (s *Session) Complete(ctx context.Context, req llm.ChatRequest) (llm.Message, error)

Complete sends the prompt through the underlying LLM and records the exchange.

func (*Session) Reset

func (s *Session) Reset()

Reset clears the conversation history, keeping the initial seed transcript.

func (*Session) Transcript

func (s *Session) Transcript() []llm.Message

Transcript returns the current conversation history.

Jump to

Keyboard shortcuts

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