Mistral-7B fine tuned for function calling

7B

805 Pulls Updated 3 months ago

Readme

Natural-Functions

Mistral-7B finetuned for function calling!

HuggingFace HuggingFace GGUF Demo Notebook

ollama run calebfahlgren/natural-functions:pizza

Example

>>> what is your job?

I am an AI-powered personal assistant. My primary function is to assist you with various tasks, such as ordering a pizza with custom toppings

>>> what is quantization?

Quantization is the process of approximating a set of data with a smaller set. In machine learning, quantization is often used to reduce the memory requirements and computational complexity of deep neural 
networks by mapping floating-point numbers to integer representations

>>> can you order me a pizza?

Of course! I can help you order a pizza with custom toppings. Could you please provide me with the size, type of crust, list of toppings, and the delivery address?

>>> order me a large pepperoni, thin crust and send it to 12345 E Texas, Dallas TX

<functioncall> {"name": "order_pizza", "arguments": '{"size": "large", "crust": "thin", "toppings": ["pepperoni"], "delivery_address": "12345 E Texas, Dallas TX"}'}

>>> {"pizza_order": {"estimated_delivery": "12:30pm", "status": "success"}

Your pizza has been successfully ordered and is expected to be delivered by 12:30pm

Setting System Prompt with Function Definition

You can set the system prompt with /set system with your function definitions.

>>> /set system """
... You are a helpful assistant with access to the following functions. Use them if required - 
... {
...     "name": "order_pizza",
...     "description": "Order a pizza with custom toppings",
...     "parameters": {
...         "type": "object",
...         "properties": {
...             "size": {
...                 "type": "string",
...                 "description": "Size of the pizza (small, medium, large)"
...             },
...             "crust": {
...                 "type": "string",
...                 "description": "Type of crust (thin, regular, thick)"
...             },
...             "toppings": {
...                 "type": "array",
...                 "items": {
...                     "type": "string"
...                 },
...                 "description": "List of toppings for the pizza"
...             },
...             "delivery_address": {
...                 "type": "string",
...                 "description": "Address where the pizza should be delivered"
...             }
...         },
...         "required": [
...             "size",
...             "crust",
...             "toppings",
...             "delivery_address"
...         ]
...     }
... }  
... """

Fixing Function Calls on Errors

>>> can you send a small cheese pizza to 444566 Oregon Ave, Nashville Tennessee. 
Thin crust?

<functioncall> {"name": "order_pizza", "arguments": '{"size": "small", "crust": "thin", "toppings": [], "delivery_address": "444566 Oregon Ave, Nashville Tennessee"}'}

>>> {"error" :"The address needs a valid zipcode, please fix it"}

I'm sorry, but I need a valid zip code to place your order. Please provide the correct zip code. Thank you!

>>> 323045

<functioncall> {"name": "order_pizza", "arguments": '{"size": "small", "crust": "thin", "toppings": [], "delivery_address": "444566 Oregon Ave, Nashville Tennessee, 323045"}'}