Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing metadata when used via Unix pipes #318

Closed
thehunmonkgroup opened this issue Jul 6, 2023 · 1 comment
Closed

Support passing metadata when used via Unix pipes #318

thehunmonkgroup opened this issue Jul 6, 2023 · 1 comment

Comments

@thehunmonkgroup
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

There is currently no way to pass metadata around when using the project via Unix pipes.

Describe the solution you'd like

I think this really comes down to needing some metadata back in addition to the response from the LLM, and the ability to feed that metadata back for things like continuing an existing conversation.

I've considered two formats for passing this metadata around:

JSON: Kind of a no-brainer given most languages have an easy way to work with it.

So, a --json flag would cause the project to accept JSON on STDIN, and output JSON on STDOUT:

chatgpt --json '{"user_id": 1, "conversation_id": 13, "llm_input": "How many moons are there in the solar system?"}'
{
  "user_id": 1,
  "conversation_id: 13,
  "message_id": 35,
  "llm_output": "There are blah moons in the solar system..."
}

Email: headers, then two newlines, then the body that's the LLM input/output:

chatgpt --email "X-ChatGPT-user_id: 1
X-ChatGPT-conversation_id: 13

How many moons are there in the solar system?"

X-ChatGPT-user_id: 1
X-ChatGPT-conversation_id: 13
X-ChatGPT-message_id: 35

There are blah moons in the solar system...

There would be some other considerations, like you'd have to force disable streaming, and make sure any errors are coming back on STDERR instead of STDOUT, and probably some other stuff I haven't considered. But both of these approaches seem doable.

@thehunmonkgroup
Copy link
Collaborator Author

Closing, the new workflow functionality should be used when doing something that requires a pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant