Bundles

Bundles help you define groups of tools you want to pass to the LLM based on specific contextual need of each LLM call or agent. Instead of passing a list of all the tools you have installed, you can create a Bundle with only the tools you need based on the specific use case for your completion step or agent.

Bundles are effective in reducing hallucinations, because they only show a subset of all the tools available to the LLM. They're also a good way to keep your context tidy by not exposing tools that you know the LLM will not require.

Bundles can be useful when you build complex agents. For example, if you are creating a financial analysis tool, you may have three agents or steps (based on your implementation): gathering information, summarizing information, and outputting information. Each step/agent will need only a subset of all the tools you have at your disposal. With Bundles, you can create a group of tools for each one of these agents or steps.

Bundles are also useful in many other cases:

  • Environments. You can create separate Bundles with tools for development, staging, and production.

  • Provider-specific tools. You can create Bundles of tools based on a specific model or provider.

  • Testing and evaluation. You can create different collections to evaluate the behaviors of an LLM when passing different tools.

By default, all tools in Toolhouse are installed to a default collection. When you call get_tools(), you're implicitly calling the default collection.

When you uninstall a tool from the Tool Store, it will be removed from all the Bundles it belongs to.

from toolhouse import Toolhouse
from groq import Groq

th = Toolhouse()
client = Groq()
MODEL = "llama3-groq-70b-8192-tool-use-preview"

response = client.chat.completions.create(
  model=MODEL,
  messages=messages,
  # Defaults to 'default'
  tools=th.get_tools(),
)

Create a Bundle

To create a Bundle, go to the Bundles page, then click Create New Bundle.

Then, give a name to your Bundle. This name can be any string up to 128 characters long. The Bundle name will be the identifier you will pass to get_tools to pass the bundle to your LLM. For example, if you choose financial_tools as your bundle name, you will call th.get_tools(bundle="financial_tools").

After choosing a name, you can select the tools you want to add to your Bundles. You will need to choose at least one tool in order to save the Bundle.

Once you're done, click Create.

Edit a Bundle

You can add or remove tools from a Bundle, or change its name. To edit a Bundle, go to the Bundles page. Locate the Bundle you want to edit, then click Edit.

Make the requested changes and click Update.

You won't be able to update a Bundle if you remove all tools from it. Make sure you have at least one tool in your Bundle in order to update it.

Delete a Bundle

To delete a Bundle, go to the Bundles page. Locate the Bundle you want to delete, then click Delete. Confirm the operation to actually delete the Bundle.

Deleting a Bundle cannot be undone. Ensure you are not using the Bundle in production before proceeding.

Naming your Bundles

Bundles are very flexible and you can adapt them to a lot of scenarios. For example, you can use them to separate concerns between environments, for testing and evaluations, or to equip different models with specific sets of tools.

Choosing the right naming format

Name by environment

You can create one Bundle per environment, and name them for example prod, staging, dev. This is useful if you don't need to version your Bundles, and it allows you to test changes on an environment before making changes to the others.

response = client.chat.completions.create(
  model=MODEL,
  messages=messages,
  tools=th.get_tools("dev"),
)

Name by version

You can create one Bundle per version, for example v1, v2, v3 and so on. All Bundles will be shared across environments, but you will still be able to test out your changes in an development environment before promoting to production. This is useful if you use the same tools across each LLM.

  • Set a configuration variable (for example TOOLHOUSE_BUNDLE_VERSION environment variable) in each of your environments. Each environment can point to a different version.

  • Every time you want make a change, you can create a new Bundle or duplicate the Bundle with the latest version number. Increment the version number on this Bundle; for example, if you are duplicating v3, your new Bundle name should be v4.

  • Set the TOOLHOUSE_BUNDLE_VERSION variable of your test environment (e.g. development) to this new version.

  • Make your changes in your BUNDLE.

  • When you're confident with your changes, set the TOOLHOUSE_BUNDLE_VERSION variable in production to this new version.

# In dev
TOOLHOUSE_COLLECTION_VERSION=v4

# In prod
TOOLHOUSE_COLLECTION_VERSION=v3
response = client.chat.completions.create(
  model=MODEL,
  messages=messages,
  # Uses v3 in production, v4 in dev
  tools=th.get_tools(os.environ.get("TOOLHOUSE_BUNDLE_VERSION")),
)

Group by functionality, version, and environment

You can use a naming convention such as bundle_name-version-env, for example crm_lookup_and_search-v1-dev-alice. This way you can logically group functionality while also keeping the benefit of versioning and environment choice.

You can also create a bundle for a specific LLM, for example memory_llama3.1-8b_v1, which allows you to give each LLM different tools. This strategy is effective when some LLM tend to pick the wrong tools, or hallucinate on a tool name.

Last updated