- Exhaustive rename: PGM_ -> PRV_, pgm_ -> prv_, text domain and slug peptide-geo-monitor -> pr-vision, admin menu GEO Monitor -> PR Vision, main file peptide-geo-monitor.php -> pr-vision.php, DB table pgm_ai_visibility -> prv_ai_visibility. - P2-A: replace ltrim($host,'www.') character-mask with str_starts_with/substr prefix strip in PRV_Citation_Detector. Adds test coverage for wikipedia.org, webmd.com survival. - P2-B: drop continue-on-error: true from PHPCS CI step; WordPress Coding Standards now gates the build. - P2-C: remove dead in-run cache from PRV_Probe_Runner::run(); each (peptide, intent, model) triplet is visited once per run, cache hit is structurally impossible. - Version bump 0.1.0 -> 0.1.1 + CHANGELOG [0.1.1] entry. Agent-Session: pr-vision rename v0.1.1
70 lines
1.8 KiB
PHP
70 lines
1.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Value object: the result of a single LLM probe call.
|
|
*
|
|
* Returned by every PRV_Probe_Provider implementation. Immutable — all
|
|
* fields are set in the constructor and read via typed getters.
|
|
*
|
|
* Who triggers: PRV_Perplexity_Provider and PRV_OpenRouter_Provider.
|
|
* Dependencies: None.
|
|
*
|
|
* @see interface-prv-probe-provider.php — Provider interface that returns this.
|
|
* @see class-prv-probe-runner.php — Consumes the result for storage.
|
|
* @see CONTEXT.md — "probe result", "cited", "our_position".
|
|
* @package PrVision
|
|
*/
|
|
class PRV_Probe_Result {
|
|
|
|
/**
|
|
* @param string $raw_excerpt First ~500 chars of the LLM's response.
|
|
* @param string[] $source_domains Domains extracted from the provider's citations.
|
|
* @param bool $cited Whether peptiderepo.com appears in source_domains.
|
|
* @param int|null $our_position 1-based position of peptiderepo.com in sources, or null.
|
|
* @param float $cost_usd Estimated call cost in USD.
|
|
*/
|
|
public function __construct(
|
|
private readonly string $raw_excerpt,
|
|
private readonly array $source_domains,
|
|
private readonly bool $cited,
|
|
private readonly ?int $our_position,
|
|
private readonly float $cost_usd
|
|
) {}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function get_raw_excerpt(): string {
|
|
return $this->raw_excerpt;
|
|
}
|
|
|
|
/**
|
|
* @return string[]
|
|
*/
|
|
public function get_source_domains(): array {
|
|
return $this->source_domains;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function is_cited(): bool {
|
|
return $this->cited;
|
|
}
|
|
|
|
/**
|
|
* @return int|null 1-based position or null when not cited.
|
|
*/
|
|
public function get_our_position(): ?int {
|
|
return $this->our_position;
|
|
}
|
|
|
|
/**
|
|
* @return float Estimated cost in USD.
|
|
*/
|
|
public function get_cost_usd(): float {
|
|
return $this->cost_usd;
|
|
}
|
|
}
|