Model rationale for calling function

Hi there!

I am experimenting with a proofreading bot. My idea is to proofread one paragraph at a time. I let a model decide if the text needs corrections or not, and if it does, I feed it into a function calling another model responsible for improving the paragraph (because nested LLMs is the future).

I would like to know why the first model thinks the text need improvement and why it calls the function improve_text. I have been reading the cookbook and the documentation, but can’t seem to find a scenario that matches my use case.

Any ideas? I’ll include the output response from one of my test cases:

json response
{
  "id": "chatcmpl-7cuwiMuX5aj7kiAsk6nt4RtA6Xnrz",
  "object": "chat.completion",
  "created": 1689509720,
  "model": "gpt-3.5-turbo-0613",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "function_call": {
          "name": "improve_text",
          "arguments": "{\n  \"text\": \"To use Proofreader, you need to create a configuration file. This file is a YAML file that contains the rules that Proofreader will apply to your code. The configuration file is then added to your repository, and the Proofreader Action is added to your workflow.\"\n}"
        }
      },
      "finish_reason": "function_call"
    }
  ],
  "usage": {
    "prompt_tokens": 212,
    "completion_tokens": 67,
    "total_tokens": 279
  }
}
{
  "id": "chatcmpl-7cuwmTKTk6xMQYmIUnDITHqJL7JpN",
  "object": "chat.completion",
  "created": 1689509724,
  "model": "gpt-3.5-turbo-0613",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "To use Proofreader, you must create a configuration file. This file should be written in YAML format and will include the rules that Proofreader will enforce on your code. Once the configuration file is added to your repository, you can then include the Proofreader Action in your workflow."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 359,
    "completion_tokens": 56,
    "total_tokens": 415
  }
}

On the face of it is seems like you need to add an extra argument which would be “reason for improvement” with a description of “The reason this section should be improved, this should be in the form of an OpenAI GPT prompt”

Also I think I would simplify the description of the function to be “improve text” with a description of “If Proof reading of the user input requires improvement, this function should be called”

Also why do you need a yaml file?

1 Like

Thank you for replying!

Yup, that worked :grin: I added a rationale-parameter to my “improve_text” function, and got a nice response.

The YAML text is just a sample text I am experimenting on. The idea is to make this into a Github Action, proofreading READMEs to start with.

Thank you :pray:

1 Like