You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
import sys
|
|
import os
|
|
import json
|
|
import asyncio
|
|
|
|
# Add src to path
|
|
sys.path.append(os.path.abspath(os.path.join(os.getcwd())))
|
|
|
|
from src.ircfa_interaction.tools.root_cause_spln_tool import RootCauseSPLNTool
|
|
|
|
tool = RootCauseSPLNTool()
|
|
|
|
test_inputs = [
|
|
"hph 5",
|
|
"lph 1",
|
|
"LP Feedwater Heater No.2",
|
|
"HP Feedwater Heater No.6",
|
|
"centrifugal pump"
|
|
]
|
|
|
|
async def test_resolve():
|
|
for inp in test_inputs:
|
|
print(f"\nTesting input: '{inp}'")
|
|
# Resolve logic
|
|
matches = await tool._resolve_equipment_type(inp)
|
|
matched_slugs = [m.equipment_type for m in matches]
|
|
print(f"Matched slugs: {matched_slugs}")
|
|
|
|
# Test full call
|
|
result = tool.call({"equipment_type": inp})
|
|
if "Error" in result or "error" in result:
|
|
print(f"Result: ERROR found")
|
|
else:
|
|
try:
|
|
# result might have a guide at the end
|
|
json_part = result.split("\n\n")[0]
|
|
records = json.loads(json_part)
|
|
print(f"Num records found: {len(records.get('standard_reference_spln', []))}")
|
|
print(f"Sample records: {records.get('standard_reference_spln', [])[:1]}")
|
|
except Exception as e:
|
|
print(f"Result (truncated): {result[:200]}...")
|
|
print("Error parsing:", str(e))
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_resolve())
|