diff --git a/src/toolhouse/sdk.py b/src/toolhouse/sdk.py index 9386608..fe180fa 100644 --- a/src/toolhouse/sdk.py +++ b/src/toolhouse/sdk.py @@ -10,6 +10,7 @@ import os from enum import Enum from typing import List, Union, Dict, Any, Optional +from warnings import warn from .exceptions import ToolhouseError from .net.environment import Environment @@ -19,7 +20,6 @@ from .models.RunToolsRequest import RunToolsRequest from .models.GetToolsRequest import GetToolsRequest from .models.Stream import ToolhouseStreamStorage, GroqStream, OpenAIStream, stream_to_chat_completion -from warnings import warn class Toolhouse: @@ -141,7 +141,16 @@ def get_tools(self, bundle="default"): Get Tools """ self.bundle = bundle - return self.tools.get_tools(GetToolsRequest(provider=self.provider, metadata=self.metadata, bundle=bundle)) + res = self.tools.get_tools(GetToolsRequest(provider=self.provider, metadata=self.metadata, bundle=bundle)) + if bundle != "default" and len(res) == 0: + warn( + "Warning: get_tools() was called with the bundle `" + bundle + "`, " + + "but the bundle does not contain any tools. This means your LLM will not be able to see any of the tools you have installed.\n" + + "To fix this warning:\n" + + "Solution 1. Go to https://app.toolhouse.ai/bundles, locate the bundle `" + bundle + "`, then click Edit to add at least one tool.\n" + + "Solution 2. Remove the bundle name from the get_tools() call." + ) + return res def run_tools(self, response, append: bool = True) -> List: """