59 lines
2.1 KiB
Go
59 lines
2.1 KiB
Go
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
|
|
//
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
// copyright notice and this permission notice appear in all copies.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
package probod
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"go.gearno.de/kit/log"
|
|
"go.opentelemetry.io/otel/trace"
|
|
"go.probo.inc/probo/pkg/probo"
|
|
"go.probo.inc/probo/pkg/vetting"
|
|
)
|
|
|
|
// buildVendorAssessor wires the vendor assessment agent. It is an opt-in
|
|
// feature: deployments that do not set `llm.vendor-assessor.provider` get a
|
|
// DisabledVendorAssessor that reports the feature as unavailable. The
|
|
// vendor-assessor does not inherit the default provider because its
|
|
// pipeline (LLM + browser + search) is expensive and should not be enabled
|
|
// implicitly.
|
|
func (impl *Implm) buildVendorAssessor(
|
|
l *log.Logger,
|
|
tp trace.TracerProvider,
|
|
r prometheus.Registerer,
|
|
) (probo.VendorAssessor, error) {
|
|
if impl.cfg.Agents.VendorAssessor.Provider == "" {
|
|
return probo.DisabledVendorAssessor{}, nil
|
|
}
|
|
|
|
agentCfg, llmClient, err := impl.resolveAgentClient("vendor-assessor", impl.cfg.Agents.VendorAssessor, l, tp, r)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
maxTokens := vetting.DefaultMaxTokens
|
|
if agentCfg.MaxTokens != nil {
|
|
maxTokens = *agentCfg.MaxTokens
|
|
}
|
|
|
|
return vetting.NewAssessor(vetting.Config{
|
|
Client: llmClient,
|
|
Model: agentCfg.ModelName,
|
|
MaxTokens: maxTokens,
|
|
ChromeAddr: impl.cfg.ChromeDPAddr,
|
|
SearchEndpoint: impl.cfg.SearchEndpoint,
|
|
Logger: l.Named("vendor-assessor"),
|
|
}), nil
|
|
}
|