Spaces:
Sleeping
Sleeping
Update plugins/converterPlugin.py
Browse files- plugins/converterPlugin.py +15 -9
plugins/converterPlugin.py
CHANGED
|
@@ -13,9 +13,12 @@ class ConverterPlugin:
|
|
| 13 |
name="query_converters",
|
| 14 |
description="Execute SQL query against Cosmos DB converters collection"
|
| 15 |
)
|
| 16 |
-
async def query_converters(
|
|
|
|
|
|
|
|
|
|
| 17 |
try:
|
| 18 |
-
items = await self.db.query_converters(query)
|
| 19 |
self.logger.info(f"Executed query: {query}")
|
| 20 |
if not items:
|
| 21 |
return "No items found for the given query."
|
|
@@ -76,8 +79,8 @@ class ConverterPlugin:
|
|
| 76 |
async def get_converters_by_dimming(
|
| 77 |
self,
|
| 78 |
dimming_type: Annotated[str, "Dimming type mentioned like dali, mains, 1-10v"],
|
| 79 |
-
voltage_current: Annotated[str | None,"Voltage or current specification like 350mA, 24V DC"]
|
| 80 |
-
lamp_type: Annotated[str | None, "Lamp model (e.g., Haloled, B4)"]
|
| 81 |
threshold: int = 75) -> str:
|
| 82 |
"""Search converters by dimming type with technical specifications"""
|
| 83 |
try:
|
|
@@ -121,19 +124,22 @@ class ConverterPlugin:
|
|
| 121 |
)
|
| 122 |
async def get_converters_by_voltage_current(
|
| 123 |
self,
|
| 124 |
-
artnr: Annotated[int, ""]
|
| 125 |
-
current: Annotated[str, "Current like 350mA, 700mA"]
|
| 126 |
-
input_voltage: Annotated[str, "Input voltage range like '198-464' NEVER ip"]
|
| 127 |
-
output_voltage: Annotated[str, "Output voltage range like '24', '2-25'"]
|
|
|
|
| 128 |
) -> str:
|
| 129 |
try:
|
| 130 |
converters = await self.db.get_converters_by_voltage_current(artnr=artnr,
|
| 131 |
current=current,
|
| 132 |
input_voltage=input_voltage,
|
| 133 |
-
output_voltage=output_voltage
|
|
|
|
| 134 |
self.logger.info(f"""Used get_converters_by_voltage_current with input_voltage: {input_voltage}
|
| 135 |
output_voltage: {output_voltage}
|
| 136 |
current: {current}
|
|
|
|
| 137 |
artnr: {artnr}""")
|
| 138 |
if not converters:
|
| 139 |
return "No relavent converters found"
|
|
|
|
| 13 |
name="query_converters",
|
| 14 |
description="Execute SQL query against Cosmos DB converters collection"
|
| 15 |
)
|
| 16 |
+
async def query_converters(
|
| 17 |
+
self,
|
| 18 |
+
user_input:Annotated[str,"Natural Language question the user asked"],
|
| 19 |
+
query: Annotated[str,"SQL generated from NL2SQL plugin"]) -> str:
|
| 20 |
try:
|
| 21 |
+
items = await self.db.query_converters(query, user_input)
|
| 22 |
self.logger.info(f"Executed query: {query}")
|
| 23 |
if not items:
|
| 24 |
return "No items found for the given query."
|
|
|
|
| 79 |
async def get_converters_by_dimming(
|
| 80 |
self,
|
| 81 |
dimming_type: Annotated[str, "Dimming type mentioned like dali, mains, 1-10v"],
|
| 82 |
+
voltage_current: Annotated[str | None,"Voltage or current specification like 350mA, 24V DC"],
|
| 83 |
+
lamp_type: Annotated[str | None, "Lamp model (e.g., Haloled, B4)"],
|
| 84 |
threshold: int = 75) -> str:
|
| 85 |
"""Search converters by dimming type with technical specifications"""
|
| 86 |
try:
|
|
|
|
| 124 |
)
|
| 125 |
async def get_converters_by_voltage_current(
|
| 126 |
self,
|
| 127 |
+
artnr: Annotated[int | None, "Converter artnr"],
|
| 128 |
+
current: Annotated[str | None, "Current like 350mA, 700mA"],
|
| 129 |
+
input_voltage: Annotated[str | None, "Input voltage range like '198-464' NEVER ip, null if no voltage"],
|
| 130 |
+
output_voltage: Annotated[str | None, "Output voltage range like '24', '2-25' null if no voltage"],
|
| 131 |
+
lamp_type: Annotated[str | None, "Lamp model (e.g., Haloled, B4)"],
|
| 132 |
) -> str:
|
| 133 |
try:
|
| 134 |
converters = await self.db.get_converters_by_voltage_current(artnr=artnr,
|
| 135 |
current=current,
|
| 136 |
input_voltage=input_voltage,
|
| 137 |
+
output_voltage=output_voltage,
|
| 138 |
+
lamp_type=lamp_type)
|
| 139 |
self.logger.info(f"""Used get_converters_by_voltage_current with input_voltage: {input_voltage}
|
| 140 |
output_voltage: {output_voltage}
|
| 141 |
current: {current}
|
| 142 |
+
lamp_type: {lamp_type}
|
| 143 |
artnr: {artnr}""")
|
| 144 |
if not converters:
|
| 145 |
return "No relavent converters found"
|