Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added warning #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/toolhouse/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
"""
Expand Down