MCPcopy
hub / github.com/weaviate/elysia / find

Method find

elysia/tree/objects.py:280–306  ·  view source on GitHub ↗

Finds a corresponding list of objects in the environment. Keyed via `tool_name` and `name`. See the base class description for more information on how the environment is keyed. Args: tool_name (str): The name of the tool called that the result belongs to.

(self, tool_name: str, name: str, index: int | None = None)

Source from the content-addressed store, hash-verified

278 }
279
280 def find(self, tool_name: str, name: str, index: int | None = None):
281 """
282 Finds a corresponding list of objects in the environment.
283 Keyed via `tool_name` and `name`. See the base class description for more information on how the environment is keyed.
284
285 Args:
286 tool_name (str): The name of the tool called that the result belongs to.
287 name (str): The name of the result.
288 index (int | None): The index of the object to find.
289 If `None`, the entire list corresponding to `tool_name`/`name` is returned.
290 If an integer, the object at the given index is returned.
291
292 Returns:
293 (list[dict]): if `index` is `None` - The list of objects for the given `tool_name` and `name`.
294 (dict): if `index` is an integer - The object at the given `index` for the given `tool_name` and `name`.
295 (None): If the `tool_name` or `name` is not found in the environment.
296 """
297
298 if tool_name not in self.environment:
299 return None
300 if name not in self.environment[tool_name]:
301 return None
302
303 if index is None:
304 return self.environment[tool_name][name]
305 else:
306 return self.environment[tool_name][name][index]
307
308 def to_json(self, remove_unserialisable: bool = False):
309 """

Callers 15

test_environmentFunction · 0.95
_parse_weaviate_errorMethod · 0.80
uFunction · 0.80
aFunction · 0.80
iFunction · 0.80
yFunction · 0.80
WFunction · 0.80
pFunction · 0.80
rXFunction · 0.80
r6Function · 0.80
vFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_environmentFunction · 0.76
fit_linear_regressionFunction · 0.64