models

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

This package contains test intended to be used by the implementations of the Querier, ChatQuerier and StreamCompleter interfaces

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChatQuerier_Test added in v1.2.0

func ChatQuerier_Test(t *testing.T, q ChatQuerier)

func Querier_Context_Test added in v1.2.0

func Querier_Context_Test(t *testing.T, q Querier)

func StreamCompleter_Test added in v1.2.0

func StreamCompleter_Test(t *testing.T, s StreamCompleter)

Types

type Chat

type Chat struct {
	ID       string    `json:"id"`
	Messages []Message `json:"messages"`
}

func (*Chat) SystemMessage

func (c *Chat) SystemMessage() (Message, error)

SystemMessage returns the first encountered Message with role 'system'

type ChatQuerier

type ChatQuerier interface {
	Querier
	TextQuery(context.Context, Chat) (Chat, error)
}

type CompletionEvent added in v1.2.0

type CompletionEvent any

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Querier

type Querier interface {
	Query(ctx context.Context) error
}

type StreamCompleter added in v1.2.0

type StreamCompleter interface {
	// Setup the stream completer, do things like init http.Client/websocket etc
	// Will be called asynchronously. Should return error if setup fails
	Setup() error

	// StreamCompletions and return a channel which sends CompletionsEvents.
	// The CompletionEvents should either be a string or an error. If there is
	// a catastrophic error, return the error and close the channel.
	StreamCompletions(context.Context, Chat) (chan CompletionEvent, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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