pycsamt.agents.metrics#
pycsamt.agents.metrics#
MetricsAgent — answer conversational questions about computed
values of a survey line (or all lines), inline, without a modal or a figure.
Where ToolAgent opens a parameter modal and
returns a table + figure, the metrics agent turns a question like “what’s the
strike of L22PLT?” or “azimuth of all lines?” into a short, friendly text
answer with the actual number(s).
Supported value kinds (see METRIC_KINDS):
strike— regional geoelectric strike (consensus, ±90°),azimuth— profile bearing from station geometry (PCA, 0–180°N),dimensionality— dominant 1-D / 2-D / 3-D class and the distribution,skew— mean phase-tensor skew |β|,stations— station count (and names),periods— period range (s),frequencies— frequency range (Hz),coordinates— lat/lon bounding box and approximate profile length,quality— mean QC score, flagged stations, tipper presence,summary— a one-paragraph digest combining the above.
The agent never calls an LLM. parse_metric_request() and
looks_like_metric_query() are shared, testable helpers the chat router
uses to detect a value question and pull out which kinds / scope were asked.
Functions
|
Heuristic: does text ask for a computed value of a line? |
|
Return |
Classes
|
Compute and phrase per-line survey values as inline chat answers. |
- class pycsamt.agents.metrics.MetricsAgent(**_)[source]#
Bases:
objectCompute and phrase per-line survey values as inline chat answers.
- Parameters:
_ (Any)
- pycsamt.agents.metrics.parse_metric_request(text)[source]#
Return
(kinds, all_lines)parsed from text.kindsis the ordered, de-duplicated list of metric kinds the user asked about;all_linesisTruewhen the request spans every line.Examples
>>> parse_metric_request("what is the strike of L22PLT?") (['strike'], False) >>> parse_metric_request("give me the azimuth for all lines") (['azimuth'], True) >>> parse_metric_request("tell me about this line") (['summary'], False)
- pycsamt.agents.metrics.looks_like_metric_query(text)[source]#
Heuristic: does text ask for a computed value of a line?
True when the message names a value (strike, azimuth, …) and is phrased as a question / scoped to a line, and is not a plot/workflow request.
Examples
>>> looks_like_metric_query("what's the strike of L22PLT?") True >>> looks_like_metric_query("plot the strike rose") False >>> looks_like_metric_query("run phase tensor analysis") False