Skip to content

Commit ee02bc7

Browse files
remove a duplicate collection of tools
1 parent 5716ccf commit ee02bc7

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

mellea/backends/litellm.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -237,37 +237,6 @@ def _generate_from_chat_context_standard(
237237
else:
238238
response_format = {"type": "text"}
239239

240-
# Append tool call information if applicable.
241-
tools: dict[str, Callable] = dict()
242-
if tool_calls:
243-
if format:
244-
FancyLogger.get_logger().warning(
245-
f"Tool calling typically uses constrained generation, but you have specified a `format` in your generate call. NB: tool calling is superseded by format; we will NOT call tools for your request: {action}"
246-
)
247-
else:
248-
if isinstance(action, Component) and isinstance(
249-
action.format_for_llm(), TemplateRepresentation
250-
):
251-
tools = get_tools_from_action(action)
252-
253-
model_options_tools = model_opts.get(ModelOption.TOOLS, None)
254-
if model_options_tools is not None:
255-
assert isinstance(model_options_tools, dict)
256-
for fn_name in model_options_tools:
257-
# invariant re: relationship between the model_options set of tools and the TemplateRepresentation set of tools
258-
assert fn_name not in tools.keys(), (
259-
f"Cannot add tool {fn_name} because that tool was already defined in the TemplateRepresentation for the action."
260-
)
261-
# type checking because ModelOptions is an untyped dict and the calling convention for tools isn't clearly documented at our abstraction boundaries.
262-
assert type(fn_name) is str, (
263-
"When providing a `ModelOption.TOOLS` parameter to `model_options`, always used the type Dict[str, Callable] where `str` is the function name and the callable is the function."
264-
)
265-
assert callable(model_options_tools[fn_name]), (
266-
"When providing a `ModelOption.TOOLS` parameter to `model_options`, always used the type Dict[str, Callable] where `str` is the function name and the callable is the function."
267-
)
268-
# Add the model_options tool to the existing set of tools.
269-
tools[fn_name] = model_options_tools[fn_name]
270-
271240
thinking = model_opts.get(ModelOption.THINKING, None)
272241
if type(thinking) is bool and thinking:
273242
# OpenAI uses strings for its reasoning levels.

0 commit comments

Comments
 (0)