File size: 3,608 Bytes
5b6af9b
63eb203
f899696
 
 
 
 
5b6af9b
f899696
 
a39e732
f899696
 
13c1ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
license: llama2
datasets:
- rizerphe/glaive-function-calling-v2-llama
- rizerphe/sharegpt-hyperfiltered-3k-llama
- totally-not-an-llm/sharegpt-hyperfiltered-3k
- glaiveai/glaive-function-calling-v2
---
# CodeLlama-7b Instruct finetuned on 6320 function calling and generic chat examples

Fine-tuned with LoRA on a small fraction of the [glaive-function-calling-v2](https://huggingface.co/datasets/glaiveai/glaive-function-calling-v2) dataset and a formatted (and slightly cleaned) version of [sharegpt-hyperfiltered-3k](https://huggingface.co/datasets/totally-not-an-llm/sharegpt-hyperfiltered-3k)


Prompt example:

```
[INST] <<SYS>>
<function>Available functions:
<function>{
    "name": "generate_password",
    "description": "Generate a random password with specified criteria",
    "parameters": {
        "type": "object",
        "properties": {
            "length": {
                "type": "integer",
                "description": "The length of the password"
            },
            "include_numbers": {
                "type": "boolean",
                "description": "Include numbers in the password"
            },
            "include_special_characters": {
                "type": "boolean",
                "description": "Include special characters in the password"
            }
        },
        "required": [
            "length"
        ]
    }
}
<</SYS>>

I need a new password. Can you generate one for me? [/INST]
```

The model then generates (note the leading space):

```
 Of course! How long would you like your password to be? And would you like it to include numbers and special characters?
```

If you extend the prompt to be:

```
[INST] <<SYS>>
<function>Available functions:
<function>{
    "name": "generate_password",
    "description": "Generate a random password with specified criteria",
    "parameters": {
        "type": "object",
        "properties": {
            "length": {
                "type": "integer",
                "description": "The length of the password"
            },
            "include_numbers": {
                "type": "boolean",
                "description": "Include numbers in the password"
            },
            "include_special_characters": {
                "type": "boolean",
                "description": "Include special characters in the password"
            }
        },
        "required": [
            "length"
        ]
    }
}
<</SYS>>

I need a new password. Can you generate one for me? [/INST] Of course! How long would you like your password to be? And would you like it to include numbers and special characters?</s><s>[INST] I'd like it to be 12 characters long. [/INST]
```

The model will generate (without the leading space):

```
<function>generate_password
{
    "length": 12
}
```

It can also answer questions based on a prompt without any functions:

```
[INST] In one sentence, what is a large language model? [/INST] A large language model is a type of artificial intelligence model that is trained on vast amounts of text data to generate human-like language and understand natural language input. [/INST] That's correct! Large language models are trained on large datasets of text to generate human-like language and understand natural language input. They are often used in applications such as chatbots, language translation, and text summarization.
```

A quick manual test shows that it's still able to follow a system prompt provided alongside any functions provided, including in multi-turn conversations. None of this was tested comprehensively, though, your results may vary.