executil

package
v0.2.65 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SystemDocumentTag   = "system_doc"
	SystemDocumentMode  = "system_document"
	ResourceDocumentTag = "resource_doc"
)

Variables

This section is empty.

Functions

func EnsureJSONResponse

func EnsureJSONResponse(ctx context.Context, text string, target interface{}) error

EnsureJSONResponse extracts and unmarshals valid JSON content from a given string into the target interface. It trims potential code block markers and identifies the JSON object or array to parse. Returns an error if no valid JSON is found or if unmarshalling fails.

func ExecuteToolStep

func ExecuteToolStep(ctx context.Context, reg tool.Registry, step StepInfo, conv apiconv.Client) (out plan.ToolCall, span plan.CallSpan, retErr error)

ExecuteToolStep runs a tool via the registry, records transcript, and updates traces. Returns normalized plan.ToolCall, span and any combined error.

func IsChainMode added in v0.2.56

func IsChainMode(ctx context.Context) bool

IsChainMode reports whether current execution is internal chain execution.

func SynthesizeToolStep added in v0.2.17

func SynthesizeToolStep(ctx context.Context, conv apiconv.Client, step StepInfo, toolResult string) error

SynthesizeToolStep persists a tool call using a precomputed result without invoking the actual tool. It mirrors ExecuteToolStep's persistence flow (messages, request/response payloads, status), setting status to "completed".

func WithChainMode added in v0.2.56

func WithChainMode(ctx context.Context, enabled bool) context.Context

WithChainMode marks tool/message execution context as internal chain execution.

func WithToolTimeout added in v0.2.9

func WithToolTimeout(ctx context.Context, d time.Duration) context.Context

WithToolTimeout attaches a per-tool execution timeout to the context.

Types

type StepInfo

type StepInfo struct {
	ID   string
	Name string
	Args map[string]interface{}
	// ResponseID is the assistant response.id that requested this tool call
	ResponseID string
}

StepInfo carries the tool step data needed for execution.

Jump to

Keyboard shortcuts

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