tooluniverse 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tooluniverse might be problematic. Click here for more details.

@@ -0,0 +1,17 @@
1
+ from .execute_function import ToolUniverse
2
+ from .restful_tool import MonarchTool, MonarchDiseasesForMultiplePhenoTool
3
+ from .graphql_tool import OpentargetTool, OpentargetGeneticsTool, OpentargetToolDrugNameMatch
4
+ from .openfda_tool import FDADrugLabelTool, FDADrugLabelSearchTool, FDADrugLabelSearchIDTool, FDADrugLabelGetDrugGenericNameTool
5
+
6
+ __all__ = [
7
+ "ToolUniverse",
8
+ "MonarchTool",
9
+ "MonarchDiseasesForMultiplePhenoTool",
10
+ "OpentargetTool",
11
+ "OpentargetGeneticsTool",
12
+ "OpentargetToolDrugNameMatch",
13
+ "FDADrugLabelTool",
14
+ "FDADrugLabelSearchTool",
15
+ "FDADrugLabelSearchIDTool",
16
+ "FDADrugLabelGetDrugGenericNameTool"
17
+ ]
@@ -0,0 +1,32 @@
1
+ from .utils import extract_function_call_json, evaluate_function_call
2
+
3
+ class BaseTool:
4
+ def __init__(self, tool_config):
5
+ self.tool_config = tool_config
6
+
7
+ def run(self):
8
+ pass
9
+
10
+ def check_function_call(self, function_call_json):
11
+ if isinstance(function_call_json, str):
12
+ function_call_json = extract_function_call_json(function_call_json)
13
+ if function_call_json is not None:
14
+ return evaluate_function_call(self.tool_config, function_call_json)
15
+ else:
16
+ return False, "Invalid JSON string of function call"
17
+
18
+ def get_required_parameters(self):
19
+ """
20
+ Retrieve required parameters from the endpoint definition.
21
+ Returns:
22
+ list: List of required parameters for the given endpoint.
23
+ """
24
+ required_params = []
25
+ parameters = self.tool_config.get('parameter', {}).get('properties', {})
26
+
27
+ # Check each parameter to see if it is required
28
+ for param, details in parameters.items():
29
+ if details.get('required', False):
30
+ required_params.append(param.lower())
31
+
32
+ return required_params
File without changes