I created a prompt with a function_call and get back the arguments from gpt4-0613 to call the function. The JSON format consists of a main key with an array as value. The array contains multiple json objects which count for multiple answers:
Blockquote
“arguments”: {
“products”: [
{“Full Name”: “Windows 10 for x64-based Systems”, “Architecture”: “x64”},
{“Full Name”: “Windows 11 for ARM64-based Systems”, “Architecture”: “ARM64”},
{“Full Name”: “Windows 11”, “Architecture”: “ARM64”},
]}
Basically, I provide a text with IT products in the prompt and want to get back a list of these products with their characteristics. The above example is very basic with only the architecture as an example.
In general, this works great but there is a weird effect which you can see in the example above. When a product name does not provide any further characteristic details (like the architecture), gpt-4 responds with the characteristic of the last item. Instead of skiping the architecture in the third item, it answers with ARM64 which it kind of caches. And no matter what I tell it in the prompt it is not changing this behavior.
When I change the order of the products in the prompt it consistantly uses the last information before the first item which misses this aspect like here:
Blockquote
“arguments”: {
“products”: [
{“Full Name”: “Windows 10 for x64-based Systems”, “Architecture”: “ARM64”},
{“Full Name”: “Windows 11 for ARM64-based Systems”, “Architecture”: “x64”},
{“Full Name”: “Windows 11”, “Architecture”: “x64”},
]}
So it is not really halluzinating, it just uses information from a former interation in a wrong way.
Instead it should just skip the architecture key in the JSON answer if no input for it is provided.
Can anyone help me with that or has had the same problem?
This is the corresponding prompt:
Blockquote
{‘model’: ‘gpt-4’, ‘messages’: [{‘role’: ‘system’, ‘content’: “You get text with information about products. Only consider affected product versions. Never add products with no affected versions. If no explicit version info is given, do not consider it. Generate an argument for the funcation call as JSON.dump(argument). Do not format in anyway and do without linebreaks, backslash n, tabs, indentations or whitespaces. Always omit properties without values. Be aware to never hallucinate!”}, {‘role’: ‘user’, ‘content’: “[‘Windows 10 Version 1809 for x64-based Systems’, ‘Windows 10 Version 1809 for ARM64-based Systems’, ‘Windows 10 Version 1809 for 32-bit Systems’]”}], ‘functions’: [{‘name’: ‘get_vulnerable_products’, ‘description’: ‘Get vulnerable products of a given text.’, ‘parameters’: {‘type’: ‘object’, ‘properties’: {‘Vulnerable Products’: {‘type’: ‘array’, ‘items’: {‘type’: ‘object’, ‘properties’: {‘Full Name’: {‘type’: ‘string’, ‘description’: ‘The full name of the affected vulnerable product exactly as given in the text.’}, ‘Architecture’: {‘type’: ‘string’, ‘description’: “Look for strings like 32-bit, 64-bit, x32, x64 etc. in ‘Full Name’.”}}}}}}, ‘required’: [‘Vulnerable Products’]}}], ‘function_call’: {‘name’: ‘get_vulnerable_products’}, ‘temperature’: 0}
Best,
Martin