bifrost

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bifrost adapts context-guru's pipeline to bifrost's LLMPlugin interface: our components run as a pre-LLM-call hook (design D2). Registering this plugin via BifrostConfig.LLMPlugins is all it takes for an embedded bifrost proxy — or any bifrost deployment — to run context engineering.

The same components package backs the AuthBridge in-process plugin (P3); only this thin adapter is bifrost-specific.

Index

Constants

View Source
const BypassContextKey bschemas.BifrostContextKey = "context-guru-bypass"

BypassContextKey lets a caller disable the pipeline for one request (x-context-guru-bypass header -> context value).

View Source
const SessionContextKey bschemas.BifrostContextKey = "context-guru-session"

SessionContextKey is the BifrostContext value key the transport sets from the x-context-guru-session header (or Anthropic metadata.user_id). Absent -> the plugin falls back to a content hash.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {

	// CheapModel is the static "config"-source LLM for NeedsModel components. The
	// bifrost host has no usable "incoming" client (the agent's key is a
	// placeholder), so only the static source is offered here. Optional.
	CheapModel components.Model
	// contains filtered or unexported fields
}

Plugin runs the context-guru pipeline in PreRequestHook. It implements bifrost's schemas.LLMPlugin. It never aborts a request (fail-open): any component failure is already contained inside the pipeline.

func New

func New(pipe *components.Pipeline, st store.Store) *Plugin

New builds the adapter from an already-constructed pipeline and store.

func (*Plugin) Cleanup

func (*Plugin) Cleanup() error

func (*Plugin) GetName

func (*Plugin) GetName() string

func (*Plugin) PreLLMHook

PreLLMHook and PostLLMHook are pass-throughs today; the expand continuation loop lives in the transport wrapper (it must re-invoke upstream, which a hook cannot). Kept here to satisfy the LLMPlugin interface.

func (*Plugin) PreRequestHook

func (p *Plugin) PreRequestHook(ctx *bschemas.BifrostContext, req *bschemas.BifrostRequest) error

PreRequestHook runs the pipeline over the chat request's messages. This is the canonical mutate-the-request phase: changes are committed and seen by the provider call and every fallback. Non-chat requests pass through untouched.

Jump to

Keyboard shortcuts

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