demo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDeployment = "gpt-4o-mini"
)

Variables

View Source
var (
	Endpoint   = strings.TrimSpace(os.Getenv("AZURE_OPENAI_ENDPOINT"))
	Deployment = cmp.Or(strings.TrimSpace(os.Getenv("AZURE_OPENAI_DEPLOYMENT_NAME")), DefaultDeployment)
)
View Source
var (
	FoundryProjectEndpoint = strings.TrimSpace(os.Getenv("FOUNDRY_PROJECT_ENDPOINT"))
	FoundryModel           = cmp.Or(strings.TrimSpace(os.Getenv("FOUNDRY_MODEL")), DefaultDeployment)
)

Functions

func Assistant

func Assistant(msg ...any)

func Assistantf

func Assistantf(format string, args ...any)

func AzureTokenCredential

func AzureTokenCredential() *azidentity.DefaultAzureCredential

func FoundryTokenCredential

func FoundryTokenCredential() *azidentity.DefaultAzureCredential

func Panic

func Panic(msg any)

func Panicf

func Panicf(format string, args ...any)

func Response

func Response(resp fmt.Stringer, err error)

func UserInputRequest

func UserInputRequest(req *message.ToolApprovalRequestContent) bool

Types

type Logger

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

Logger prints friendly demo output and can also be used as a slog handler.

func NewLogger

func NewLogger(name, description string, metadata ...string) *Logger

func (*Logger) Enabled

func (mw *Logger) Enabled(context.Context, slog.Level) bool

Enabled reports whether records at level should be logged.

func (*Logger) Handle

func (mw *Logger) Handle(_ context.Context, record slog.Record) error

Handle writes a slog record using the demo output style.

func (*Logger) Run

func (mw *Logger) Run(next agent.RunFunc, ctx context.Context, messages []*message.Message, opts ...agent.Option) iter.Seq2[*agent.ResponseUpdate, error]

func (*Logger) WithAttrs

func (mw *Logger) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs returns a handler with attrs attached to each record.

func (*Logger) WithGroup

func (mw *Logger) WithGroup(name string) slog.Handler

WithGroup returns a handler with name applied to subsequent attrs.

Jump to

Keyboard shortcuts

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