Problem: The open AI node is not responding as per the requirement. The prompt is the following:
Rulebook:
- Color Coding:
1.1.If the pending is equals to 0, set row font color to Green.
1.2. If the pending is equals to 1, set row font color to Red.
Based on the rulebook, convert the JSON into HTML table.
JSON: {{$json.appended_data}}
Respond with html code and not javascript.
The Open AI is responding like:
content: pending fabrics 0 0 0 1
The input json:
[
{
"appended_data": [
[
{
"documentno": "110",
"orderdate": "2023-11-13",
"pending": 0
}
],
[
{
"documentno": "111",
"orderdate": "2023-11-14",
"pending": 0
}
],
[
{
"documentno": "112",
"orderdate": "2023-11-18",
"pending": 0
}
],
[
{
"documentno": "123",
"orderdate": "2023-11-18",
"pending": 1
}
]
]
}
]
output of open ai for the same prompt:
“content”: " pending_fabrics 0 0 0 0 "
Also, with every run, with the same input json and prompt, it returns different output.
Please tell me how the open ai node works really.
{
“meta”: {
“instanceId”: “073766742218d98f43cee5741416b15a791949637545e41b94fb21e19e7b4ecf”
},
“nodes”: [
{
“parameters”: {
“resource”: “chat”,
“prompt”: {
“messages”: [
{
“content”: "=Rulebook: \n1. Color Coding: \n1.1.If the pending_fabrics is equals to 0, set row font color to Green. \n1.2. If the pending_fabrics is equals to 1, set row font color to Red. \n\nBased on the rulebook, convert the JSON into HTML table.\nJSON: {{$json.appended_data}}\n\nRespond with html table not Javascript. "
}
]
},
“options”: {
“temperature”: 0.7
}
},
“id”: “25f1a0c0-fbac-46c6-bf7b-80bb2e074c51”,
“name”: “OpenAI”,
“type”: “n8n-nodes-base.openAi”,
“typeVersion”: 1,
“position”: [
1560,
320
],
“credentials”: {
“openAiApi”: {
“id”: “O2e5iVLJNfTQHsx4”,
“name”: “OpenAi account”
}
}
}
],
“connections”: {},
“pinData”: {}
}
- n8n version: 1.21.1
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker self hosted
- Operating system: Windows 7