bob

package
v0.7.11 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 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 bob is the agent for IBM Bob: the Bob IDE and Bob Shell. Its init() registers it in the agent package's default registry, so a host needs only a blank import:

import _ "github.com/rossoctl/context-guru/agent/bob"

This is a library package. It never imports a host. imports_test.go enforces that.

Index

Constants

View Source
const MaxModelWindows = 512

MaxModelWindows is the most models ModelWindows returns.

View Source
const ModelPath = "/inference/v1/chat/completions"

ModelPath is Bob's model route: the only route in Paths. Bob's control-plane paths (ProfilePath and the model-info paths) are not model routes; see controlplane.go.

View Source
const ProfilePath = "/admin/v1/profile"

ProfilePath is the profile route Bob's CLI calls before anything else, and the one response a host does not forward verbatim. See StripProfileRegion.

Variables

This section is empty.

Functions

func BackendCounts added in v0.7.4

func BackendCounts() map[string]int64

BackendCounts is /stats' bob_backend: how many replies on Bob's model route got each label.

func IsModelInfo added in v0.7.4

func IsModelInfo(method, path string) bool

IsModelInfo reports whether a request is the model/info GET.

func IsProfile added in v0.7.4

func IsProfile(method, path string) bool

IsProfile reports whether a request is the profile GET.

func ModelWindows added in v0.7.4

func ModelWindows(body []byte) map[string]int

ModelWindows reads data[].model_name -> data[].model_info.max_input_tokens (the LiteLLM shape Bob reads in getLiteLLMModels). A body that is not that shape gives an empty map. Metadata only: a number for each model id, at most MaxModelWindows entries.

func ResetBackendForTest added in v0.7.4

func ResetBackendForTest()

ResetBackendForTest forgets the shapes logged so far. For TESTS only.

func StripProfileRegion added in v0.7.4

func StripProfileRegion(b []byte) ([]byte, bool)

StripProfileRegion removes region/region_domain from every instance in a Bob profile document, reporting false when the body is not one (then it must be forwarded as-is).

Types

type Bob

type Bob struct{ agent.Base }

Bob overrides only where it differs from the neutral agent.

func (Bob) Gateway added in v0.7.4

func (Bob) Gateway() agent.GatewaySpec

Gateway: Bob's model route is OpenAI chat, and Bob owns the host's catch-all.

func (Bob) ModelTarget

func (Bob) ModelTarget() agent.ModelTarget

ModelTarget sends the host's own calls to Bob's model path: Bob serves chat on no other path. Bob takes the key as `Authorization: Apikey <key>`, the way the Bob client sends it.

func (Bob) Name

func (Bob) Name() string

Name is the label the dashboard already gives Bob.

func (Bob) Paths

func (Bob) Paths() []string

func (Bob) ReadUsage

func (Bob) ReadUsage(contentType string, reply []byte, base agent.Usage) agent.Usage

ReadUsage reads the cache writes from a reply on Bob's model route: the top-level `usage` of a JSON body, or the last `usage` chunk of an OpenAI chat event stream. It also sets the backend label of the reply (Usage.Backend), with or without a usage block.

func (Bob) Reply added in v0.7.4

func (Bob) Reply(c agent.ControlCall, body []byte) agent.ControlReply

Reply changes or reads the two replies WantsReply asks for.

The profile goes out with the per-instance region fields removed. Bob's client does not keep the base URL it was configured with. Having fetched the profile, `Pc.resolveBaseUrl` (bobshell 1.0.6) replaces the HOSTNAME of that URL with `api.<region_domain>` from the profile, and keeps the scheme and the PORT. Pointed at a host on 127.0.0.1:4111, its next call goes to http://api.example.com:4111, where nothing listens: seen live as "Request failed after 6 attempts: fetch failed", with no model request reaching the host. The rewrite is skipped when the instance has no region, so dropping those two fields keeps the client on the configured endpoint. A body that is not a profile gives the zero reply: the host sends it unchanged.

The model/info reply goes out unchanged. Reply gives the window Bob compacts against for each model (#963), as ModelWindows reads it.

func (Bob) SessionID

func (Bob) SessionID(h http.Header) string

SessionID is the Bob IDE's task id. The IDE sends it only in the X-Task-Id header (agent.TaskIDHeader), not in the body. Bob Shell sends metadata.taskId in the body, which the host reads before this.

func (Bob) WantsReply added in v0.7.4

func (Bob) WantsReply(c agent.ControlCall) bool

WantsReply is true for the profile GET, and for the model/info GET when not hosted. The model-info half is local-only: Bob is not deployed on hosted for now, so the rule was not designed for hosted Bob. See docs/reference/hosted-vs-local.md.

Jump to

Keyboard shortcuts

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