langchain

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package langchain bridges an external "chain" — any streaming text generator, such as a LangChain-style runnable or a custom agent — into a jargo pipeline. The Processor takes the latest user message from the LLM context, invokes the chain, and streams its output downstream as an LLM response, so a chain can stand in for a jargo LLM service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain func(ctx context.Context, input string, emit func(token string) error) error

Chain is a streaming text generator. It receives the latest user input and streams the response token by token to emit until the response is complete. It is the integration point for an external framework: wrap a LangChain runnable, an HTTP agent, or any custom generator. A returned error is reported upstream as a pipeline error.

type Processor

type Processor struct {
	*processor.Base
	// contains filtered or unexported fields
}

Processor runs a Chain in place of an LLM service. On each LLM context frame it extracts the latest user message, invokes the chain, and brackets the streamed tokens with the LLM response start/end frames so the rest of the pipeline — assistant aggregation, TTS — treats it exactly like an LLM.

func New

func New(chain Chain) *Processor

New builds a Processor driven by chain.

func (*Processor) ProcessFrame

func (p *Processor) ProcessFrame(ctx context.Context, f frames.Frame, dir processor.Direction) error

ProcessFrame invokes the chain on each LLM context frame and forwards other frames untouched.

Jump to

Keyboard shortcuts

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