You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are building a GPTScript integration in one of our products which uses OSS LLMs.
We access these models via an API compatible with OpenAI API. We primarily use ollama for inference.
We've noticed that GPTscript sets the (first) chat completion message role to system instead of user, thus making it a system prompt.
This has a bad effect on some of the OSS models which are fine-tuned for tool calling, apparently. Specifically, we noticed that with llama3.1:8b-instruct-q8_0 model.
It's worth mentioning that GPTScript works as expected without any modifications with OpenAI; we've noticed the problems described in this issue only when interacting with the OSS LLMs.
For some reason setting the completion message to system instead of user prevents the following gptscript from running correctly (i.e. returning expected results).
Here's the script we noticed the strange behaviour on:
Click me!
model: llama3.1:8b-instruct-q8_0 from http://localhost:8080/v1
tools: sys.exec, sys.read, sys.write, sys.ls
description: Find out the current time
Find out the current time and return it. You must only use the defined tools. Do not guess answers.
When we run the above script with gptscript version v0.9.5 like so (NOTE: we disable the streaming and cache)
14:32:26 started [main]
14:32:27 sent [main]
content [1] content | Waiting for model response...
14:32:27 ended [main]
OUTPUT:
Here is the payload we observed being sent by GPTscript to ollama
Click me!
{
"messages": [
{
"content": "Find out current time and return it. Use only available tools, Do not make up answers.",
"role": "system"
}
],
"model": "llama3.1:8b-instruct-q8_0",
"stream": true,
"tools": [
{
"function": {
"description": "Execute a command and get the output of the command",
"name": "exec",
"parameters": {
"properties": {
"command": {
"description": "The command to run including all applicable arguments",
"type": "string"
},
"directory": {
"description": "The directory to use as the current working directory of the command. The current directory \".\" will be used if no argument is passed",
"type": "string"
}
},
"type": "object"
}
},
"type": "function"
},
{
"function": {
"description": "Reads the contents of a file. Can only read plain text files, not binary files",
"name": "read",
"parameters": {
"properties": {
"filename": {
"description": "The name of the file to read",
"type": "string"
}
},
"type": "object"
}
},
"type": "function"
},
{
"function": {
"description": "Write the contents to a file",
"name": "write",
"parameters": {
"properties": {
"content": {
"description": "The content to write",
"type": "string"
},
"filename": {
"description": "The name of the file to write to",
"type": "string"
}
},
"type": "object"
}
},
"type": "function"
},
{
"function": {
"description": "Lists the contents of a directory",
"name": "ls",
"parameters": {
"properties": {
"dir": {
"description": "The directory to list",
"type": "string"
}
},
"type": "object"
}
},
"type": "function"
}
]
}
You can see we get back an empty response i.e. no tool is being called. This happens regardless of the number of times gptscript has been run.
After a long debugging session we noticed that if we changed the role from system (thus no longer sending a system prompt) to userllama suddenly starts responding with the response that leads to GPTScript working as expected. Here's the response we get back - the only change in the request payload is the type of the prompt i.e. message role.
Which brings us to the question asked in this issue. Is there any particular reason gptscript sets the prompt to system prompt? Changing it to user prompt seems to make things work - at least with the llama family of models, apparently.
Would you be open to making the type of prompt configurable/overridable, say, via env?
The text was updated successfully, but these errors were encountered:
We are building a GPTScript integration in one of our products which uses OSS LLMs.
We access these models via an API compatible with OpenAI API. We primarily use ollama for inference.
We've noticed that GPTscript sets the (first) chat completion message role to
system
instead ofuser
, thus making it a system prompt.This has a bad effect on some of the OSS models which are fine-tuned for tool calling, apparently. Specifically, we noticed that with
llama3.1:8b-instruct-q8_0
model.For some reason setting the completion message to
system
instead ofuser
prevents the following gptscript from running correctly (i.e. returning expected results).Here's the script we noticed the strange behaviour on:
Click me!
When we run the above script with
gptscript version v0.9.5
like so (NOTE: we disable the streaming and cache)GPTSCRIPT_PROVIDER_LOCALHOST_API_KEY=XXXX GPTSCRIPT_INTERNAL_OPENAI_STREAMING="false" gptscript --debug-messages --disable-cache hlx.gpt
We get the following output:
Here is the payload we observed being sent by GPTscript to ollama
Click me!
And here's the response back
Click me!
You can see we get back an empty response i.e. no tool is being called. This happens regardless of the number of times gptscript has been run.
After a long debugging session we noticed that if we changed the
role
fromsystem
(thus no longer sending a system prompt) touser
llama
suddenly starts responding with the response that leads to GPTScript working as expected. Here's the response we get back - the only change in the request payload is the type of the prompt i.e. message role.Click me!
Which brings us to the question asked in this issue. Is there any particular reason
gptscript
sets the prompt tosystem
prompt? Changing it touser
prompt seems to make things work - at least with thellama
family of models, apparently.Would you be open to making the type of prompt configurable/overridable, say, via env?
The text was updated successfully, but these errors were encountered: