-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Modified streaming setup to use QueryConfig #214
Conversation
…feat/streaming-response
reviewing this |
- To use this, instantiate App with a `InitConfig` instance passing `stream_response=True`. The following example iterates through the chunks and prints them as they appear | ||
```python | ||
app = App(InitConfig(stream_response=True)) | ||
resp = naval_chat_bot.query("What unique capacity does Naval argue humans possess when it comes to understanding explanations or concepts?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app instance is called app
not naval_chat_bot
(common mistake)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested: works.
|
||
- To use this, instantiate App with a `InitConfig` instance passing `stream_response=True`. The following example iterates through the chunks and prints them as they appear | ||
```python | ||
app = App(InitConfig(stream_response=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we keep the parameter name as "stream"
stream is self explanatory and implies that response will be streamed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine with me. I wish there was a name that implied a boolean action, maybe is_stream
?
README.md
Outdated
|
||
```python | ||
app = App() | ||
query_config = QueryConfig(stream_response = True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets call the arg as "stream"
query_config = QueryConfig(stream_response = True) | ||
resp = naval_chat_bot.query("What unique capacity does Naval argue humans possess when it comes to understanding explanations or concepts?", query_config) | ||
|
||
for chunk in resp: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we give a downstream handler? assuming that a lot of users will use streaming response, so why not there is a function which when called gives the streaming response output.
@cachho @aaishikdutta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not everyone's going to want to just print it. I haven't looked into how I can get route the stream through flask, but that's my usecase for instance, so no, I'm fine with it how it is.
Streaming is for people that know a little. Not for private users that want to play around. If you want to use it professionally you should be able to copy two lines from the readme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then for now lets leave this.
Removed streaming_option from InitConfig and added it at a Query level.
Added some internal refactors