FastChat icon indicating copy to clipboard operation
FastChat copied to clipboard

Support Programmatic Usage of FastChat with Standard Streams

Open laidybug opened this issue 1 year ago • 3 comments

I've been working on a ProgrammaticChatIO class to enable control of FastChat by other programs through standard streams (stdin/stdout/stderr). This was motivated by a desire to use it in JavaScript (specifically in Deno), but it can be done from any language capable of communicating with a subprocess. This feature is prevalent across programming languages, therefore it presents numerous intriguing use cases.

I've placed the new class into the cli.py file, along with some modifications to the chat_loop function in the inference.py file. These changes do not significantly alter the existing code or structure.

Would the maintainers of FastChat be interested in adding this contribution? If so, I'd be delighted to submit a pull request for it later in the week.

laidybug avatar Apr 17 '23 00:04 laidybug

Came to request the same.

therealjuanmartinez avatar Apr 17 '23 04:04 therealjuanmartinez

Came to request the same.

Is there anything specific you need for your use case?

laidybug avatar Apr 21 '23 19:04 laidybug

@laidybug why don't you submit a PR and let us take a look?

zhisbug avatar May 08 '23 08:05 zhisbug

@zhisbug, I've submitted the PR.

laidybug avatar May 24 '23 01:05 laidybug