llmutil

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package llmutil provides stateless utility functions for working with LLM response structures (choices, deltas, streaming events).

It exists to centralise common extraction patterns that would otherwise be duplicated across orchestrator, reactree, and other call-sites that consume expert.Response / model.Choice slices. Without this package, each consumer would implement its own scanning logic and diverge over time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractChoiceContent

func ExtractChoiceContent(choices []model.Choice) string

ExtractChoiceContent scans a slice of model.Choice in reverse order and returns the first non-empty content string it finds.

In streaming mode, Expert.Do accumulates individual streaming delta events as separate choices. The final accumulated message is typically the last choice with non-empty Message.Content. Scanning from the end finds it efficiently.

Fallback: if no Message.Content is found, Delta.Content is checked for streaming deltas.

Returns an empty string when every choice has empty content.

Types

This section is empty.

Jump to

Keyboard shortcuts

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