MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / load_function_set

Function load_function_set

methods/letta/functions/functions.py:131–153  ·  view source on GitHub ↗

Load the functions and generate schema for them, given a module object

(module: ModuleType)

Source from the content-addressed store, hash-verified

129
130
131def load_function_set(module: ModuleType) -> dict:
132 """Load the functions and generate schema for them, given a module object"""
133 function_dict = {}
134
135 for attr_name in dir(module):
136 # Get the attribute
137 attr = getattr(module, attr_name)
138
139 # Check if it's a callable function and not a built-in or special method
140 if inspect.isfunction(attr) and attr.__module__ == module.__name__:
141 if attr_name in function_dict:
142 raise ValueError(f"Found a duplicate of function name '{attr_name}'")
143
144 generated_schema = generate_schema(attr)
145 function_dict[attr_name] = {
146 "module": inspect.getsource(module),
147 "python_function": attr,
148 "json_schema": generated_schema,
149 }
150
151 if len(function_dict) == 0:
152 raise ValueError(f"No functions found in module {module}")
153 return function_dict

Callers 1

upsert_base_toolsMethod · 0.90

Calls 1

generate_schemaFunction · 0.90

Tested by

no test coverage detected