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

Modified streaming setup to use QueryConfig #214

Merged
merged 12 commits into from
Jul 10, 2023

Conversation

aaishikdutta
Copy link
Contributor

Removed streaming_option from InitConfig and added it at a Query level.
Added some internal refactors

@taranjeet
Copy link
Member

reviewing this
@aaishikdutta
cc @cachho

- 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?")
Copy link
Contributor

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)

Copy link
Contributor

@cachho cachho left a 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))
Copy link
Member

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.

Copy link
Contributor

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)
Copy link
Member

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:
Copy link
Member

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

Copy link
Contributor

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.

Copy link
Member

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.

@taranjeet taranjeet merged commit c597b19 into mem0ai:main Jul 10, 2023
@aaishikdutta aaishikdutta deleted the feat/streaming-response branch July 10, 2023 19:06
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

Successfully merging this pull request may close these issues.

None yet

3 participants