From 54a366d694bca35a534e6cd2490d63e4164c3a5d Mon Sep 17 00:00:00 2001 From: Fabio Pulvirenti Date: Thu, 26 Sep 2024 18:05:22 +0200 Subject: [PATCH 1/3] fix: added warning --- src/toolhouse/sdk.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/toolhouse/sdk.py b/src/toolhouse/sdk.py index 9386608..581883c 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,13 @@ 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, but the tool bundle does not contain any tools." + "Please verify that the bundle includes the required tools before proceeding." + ) + return res def run_tools(self, response, append: bool = True) -> List: """ From 22d2b8acbad43d01044334519e4f2e614f52afd3 Mon Sep 17 00:00:00 2001 From: Fabio Pulvirenti Date: Tue, 22 Oct 2024 12:58:08 +0200 Subject: [PATCH 2/3] fixed: message --- src/toolhouse/sdk.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/toolhouse/sdk.py b/src/toolhouse/sdk.py index 581883c..5cb085c 100644 --- a/src/toolhouse/sdk.py +++ b/src/toolhouse/sdk.py @@ -144,8 +144,11 @@ def get_tools(self, bundle="default"): 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, but the tool bundle does not contain any tools." - "Please verify that the bundle includes the required tools before proceeding." + "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 From d8277cd6aa20d608dac52612b331a2763c556389 Mon Sep 17 00:00:00 2001 From: Fabio Pulvirenti Date: Tue, 22 Oct 2024 13:05:35 +0200 Subject: [PATCH 3/3] fix: warning message --- src/toolhouse/sdk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toolhouse/sdk.py b/src/toolhouse/sdk.py index 5cb085c..fe180fa 100644 --- a/src/toolhouse/sdk.py +++ b/src/toolhouse/sdk.py @@ -147,7 +147,7 @@ def get_tools(self, bundle="default"): "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 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