Skip to content

Provide the ability to support passing args as "--<name> <value>" ( instead of json format- '{"<name>": "<value"}') #362

Open
@sangee2004

Description

@sangee2004

Steps to reproduce the problem:

  1. Execute the following test script from gptscript/pkg/tests/testdata/TestContextArg/test.gpt by passing the input parameter as "-- <value" format - gptscript test.gpt --file hello123 .
context: fromcontext with ${file}
context: fromcontext from other.gpt with ${file} as first
context: fromcontext from other.gpt with ${file} as second
arg: file: something

This is from tool
---
name: fromcontext
args: first: an arg

#!/bin/bash
echo this is from context -- ${first}%   
  1. This results in system message being set as follows which has the file arg being set to "null" -
      {
        "role": "system",
        "content": "\nYou are task oriented system.\nYou receive input from a user, process the input from the given instructions, and then output the result.\nYour objective is to provide consistent and correct results.\nYou do not need to explain the steps taken, only provide the result to the given instructions.\nYou are referred to as a tool.\nYou don't move to the next step until you have a result.\n\nthis is from context -- null\n\nthis is from other context null and then\n\nthis is from other context and then null\n\nThis is from tool"
      },
      {
        "role": "user",
        "content": "--file hello123"
      }
  1. Notice that the tool calls to context have "null" passed for arguments (instead of "hello123" in this case)
gptscript  --disable-cache test.gpt --file hello123 
12:19:31 started  [context: fromcontext with ${file}] [input={"first":null}]
12:19:31 sent     [context: fromcontext with ${file}]
12:19:31 ended    [context: fromcontext with ${file}] [output=this is from context -- null
]
12:19:31 started  [context: fromcontext from other.gpt with ${file} as first] [input={"first":null}]
12:19:31 sent     [context: fromcontext from other.gpt with ${file} as first]
12:19:31 ended    [context: fromcontext from other.gpt with ${file} as first] [output=this is from other context null and then
]
12:19:31 started  [context: fromcontext from other.gpt with ${file} as first] [input={"second":null}]
12:19:31 sent     [context: fromcontext from other.gpt with ${file} as first]
12:19:31 ended    [context: fromcontext from other.gpt with ${file} as second] [output=this is from other context and then null
]
12:19:31 started  [main] [input=--file hello123]
12:19:31 sent     [main]
         content  [4] content | Waiting for model response...
         content  [4] content | hello123
12:19:32 ended    [main] [output=hello123]

INPUT:

--file hello123

OUTPUT:

hello123

This script works as expected when input parameters are passed in json format - gptscript --debug test.gpt '{"file":"hello123"}'

Expected Behavior:
We should be able to support providing input in --<name> <value>" format as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestproposalAn enhancement or documentation proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions