MCPcopy Create free account
hub / github.com/BAI-LAB/MemoryOS / _get_valid_kwargs

Function _get_valid_kwargs

memoryos-pypi/utils.py:132–140  ·  view source on GitHub ↗

Helper to filter kwargs for a given function's signature.

(func, kwargs)

Source from the content-addressed store, hash-verified

130_embedding_cache = {} # 添加embedding缓存
131
132def _get_valid_kwargs(func, kwargs):
133 """Helper to filter kwargs for a given function's signature."""
134 try:
135 sig = inspect.signature(func)
136 param_keys = set(sig.parameters.keys())
137 return {k: v for k, v in kwargs.items() if k in param_keys}
138 except (ValueError, TypeError):
139 # Fallback for functions/methods where signature inspection is not straightforward
140 return kwargs
141
142def get_embedding(text, model_name="all-MiniLM-L6-v2", use_cache=True, **kwargs):
143 """

Callers 1

get_embeddingFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected