Advanced Function Calling with Mistral-7B - Multi function and Nested Tool Usage
AI Summary
Summary: Function Calling in Mistol 7B Version 3
- Introduction
- Previous video covered single function calling in Mistol 7B v3.
- Current video aims to test multi-function and nested function calls.
- Function Calling Basics
- Function calling allows models to interact with the real world.
- Models use external APIs for tasks beyond their internal knowledge.
- Process:
- Determine if a query can be answered internally or needs an external tool.
- If external, select the appropriate tool based on the query.
- Execute the function using Python, then integrate the result with the initial query for a response.
- Testing Multi-Function and Nested Function Calls
- Multi-function calls: Model selects multiple tools for separate operations.
- Nested function calls: Sequential calls where the output of one is the input to another.
- Using Uncle Code’s Notebook
- Uncle Code specializes in function calling and fine-tuning models.
- Notebook runs on a VM with an A6000 GPU.
- Installation of Mistol inference package and Hugging Face Hub required.
- Authentication with Hugging Face access token needed.
- Code Walkthrough
- Download and load the model using Hugging Face’s snapshot download function.
- Import required packages and load tokenizer and model.
- Define tools for function calls (e.g., get current weather, convert temperature).
- Examples
- Single function call: Get current weather in a specified city.
- Multi-function call: Get weather and time in different cities.
- Nested function call: Get temperature and convert it to a different unit.
- Complex query: Combination of multi-function and nested function calls.
- Execution and System Messages
- Use system messages to ensure correct formatting of function call outputs.
- Partial functions in Python can execute the function calls.
- Conclusion
- Mistol 7B v3 demonstrates strong capabilities in function calling.
- Additional resources and tutorials are available in the video description.
For more technical content on fine-tuning and related topics, viewers are encouraged to subscribe to the channel.