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

Optimize Bee agent performance on tool calling by implementing tool abstractions #147

Open
mmurad2 opened this issue Nov 5, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@mmurad2
Copy link
Member

mmurad2 commented Nov 5, 2024

Is your feature request related to a problem? Please describe.
Certain tool names do not have "intuitive" names which may lead an LLM agent to not perform the right tool call.

Describe the solution you'd like
An abstraction on defined core functionalities that serves as an interface between the model and discrete tools. E.g. internet_search or get_weather_forecast

Then, for example, a developer can contribute a google tool or duckduckgo tool or brave tool that slots into internet_search

Describe alternatives you've considered
NA

Additional context
Related issue: Optimizing OpenMeteo #110

@mmurad2 mmurad2 added the enhancement New feature or request label Nov 5, 2024
@mmurad2
Copy link
Member Author

mmurad2 commented Nov 18, 2024

  • It should be easy to rename the tool
  • We should have GenAI intuitive names for our OTTB tools
  • It should be easy for a tool contributor to use an existing name (like internet search) and guidance on how to create custom tools names

@Tomas2D
Copy link
Contributor

Tomas2D commented Nov 28, 2024

  1. Renaming tool is easy
const wikipedia = new Wikipedia()
wikipedia.name = 'call_wikipedia'

@Tomas2D
Copy link
Contributor

Tomas2D commented Dec 5, 2024

A tool in the framework is a class with a name (e.g., WikipediaTool) and a property name (e.g., Wikipedia).
The second one goes to the system prompt. We can just rename the internal property for all existing tools to satisfy requirements.

Wikipedia -> ???
OpenMeteo -> get_weather_forecast
DuckDuckGo -> get_web_search_results
GoogleSearch ->get_web_search_results
...

This, therefore, implies the following:

  • the agent can use only one tool from a given "group" (which may or might not be desired).
  • the user will not know (from the messages) which tool (real class) is being used (fortunately, the emitter events information about the original class).
  • we will "group" similar tools

or

We just let the user change the tool name to the desired one.

Any thoughts? @dakshiagrawal

@Tomas2D
Copy link
Contributor

Tomas2D commented Dec 12, 2024

Example of creating a simple tool from a complex tool

const complexWeatherTool = new OpenMeteoTool();

const simpleWeatherTool = new DynamicTool({
  name: "get_current_weather",
  description: "Retrieves current weather in a given destination.",
  inputSchema: z.object({
    location: z.string().min(1).describe("Example: New York"),
  }),
  async handler(input) {
    const { result } = await complexWeatherTool.run({
      location: { name: input.location },
      start_date: new Date().toISOString(),
      temperature_unit: "celsius",
    });
    return new StringToolOutput(`Current weather is ${result.current!.temperature_2m}°C`);
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants