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

Sample: RAG example #42

Open
c-lamont opened this issue Jan 7, 2025 · 7 comments
Open

Sample: RAG example #42

c-lamont opened this issue Jan 7, 2025 · 7 comments

Comments

@c-lamont
Copy link

c-lamont commented Jan 7, 2025

This is mainly a question which could be a feature request.

Is it possible to provide some context with the users chat?

What I mean with that is; let's say they are looking at a recipe in my application, and they want to ask the question "Is this a healthy meal?". I would then like to provide the recipe, along with the question to the AI.

Thanks for any help.

@csells
Copy link
Contributor

csells commented Jan 7, 2025

you bet. that's called RAG (Retrieval Augmented Generation) and you can do that via the messageSender method of the LlmChatView. There should be a demo of how that works. I'll put it onto the list.

@csells csells changed the title Feature: Providing context Sample: RAG example Jan 7, 2025
@csells
Copy link
Contributor

csells commented Jan 7, 2025

You can see the mechanics in the logging sample.

@c-lamont
Copy link
Author

c-lamont commented Jan 8, 2025

you bet. that's called RAG (Retrieval Augmented Generation) and you can do that via the messageSender method of the LlmChatView. There should be a demo of how that works. I'll put it onto the list.

So to be clear, I would include the recipe as an attachment, and every question the user would ask the attachment will be included in the sendMessageStream?

@csells
Copy link
Contributor

csells commented Jan 8, 2025

You could but I wouldn't recommend it. The R in RAG means that you process each prompt that the user provides and search your app's data store to find the appropriate data. The data your search turns up is the data you send.

@c-lamont
Copy link
Author

c-lamont commented Jan 8, 2025

Okay, so when you say The data your search turns up is the data you send how exactly do I send this data? Do I append it in the prompt?

@csells
Copy link
Contributor

csells commented Jan 8, 2025

You have your choice of updating the user's prompt and optionally adding an attachment.

@c-lamont
Copy link
Author

c-lamont commented Jan 8, 2025

Okay thanks for your help, and thanks for your work on this package, I think it could be a great addition to our app.

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

No branches or pull requests

2 participants