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

[Recipe] Example featuring built-in tool calling capabilities - Wolfram Alpha, Interpreter, Brave Search #618

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tmoreau89
Copy link
Contributor

What does this PR do?

Meta's latest Llama3.1 models offer unique function calling capabilities. In particular they offer built-in tool calling capabilities for the following 3 external tools:

  • Brave Search: internet search
  • Code Interpreter: Python code interpreter
  • Wolfram Alpha: mathematical and scientific knowledge tool

To sell the benefits of the built in tools, let's look at what one would get back from an LLM with or without tool calling capabilities. In particular:

Code Interpreter

User Query: I just got a 25 year mortgage of 400k at a fixed rate of 5.14% and paid 20% down. How much will I pay in interest?

  • Answer without tool calls (wrong): Total paid interest: $184,471
  • Answer with tool calls (correct): you will pay a total of $249,064.70 in interest

Brave Search

User Query: What caused a wordlwide outage in the airlines industry in July of 2024?

  • Answer without tool calls: I'm not aware of anything that would have caused a worldwide outage in the airlines industry.
  • Answer with tool calls: The global technology outage was caused by a faulty software update that affected Windows programs running cybersecurity technology from CrowdStrike. The outage disrupted flights, media outlets, hospitals, small businesses, and government offices, highlighting the vulnerability of the world's interconnected systems.

Wolfram Alpha

User Query: Derive the prime factorization of 892041

  • Answer without tool calls (wrong): The prime factorization of 892041 is:\n\n2 × 2 × 2 × 3 × 3 × 3 × 5 × 13 × 17 × 17
  • Answer with tool calls (correct): The prime factorization of 892041 is 3 × 17 × 17491.

This PR introduces an example powered by OctoAI that showcases Llama3.1's tool calling capabilities.

Feature/Issue validation/testing

Notebook was run locally and in colab.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Thanks for contributing 🎉!

@HamidShojanazeri
Copy link
Contributor

thanks a lot @tmoreau89 for the PR, as we had the refactor, can you pls add the example here, https://github.com/meta-llama/llama-recipes/tree/main/recipes/3p_integrations/octoai

@tmoreau89
Copy link
Contributor Author

@HamidShojanazeri moved the demo to the 3p integrations subdirectory, PTAL

@tmoreau89
Copy link
Contributor Author

@HamidShojanazeri - let me know if there's anything blocking, thanks!

@init27
Copy link
Contributor

init27 commented Sep 17, 2024

Thanks for checking and tysm for sharing the PR-I will take a look today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants