-
Notifications
You must be signed in to change notification settings - Fork 942
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
[FEATURE] Return retrieved Contents/TextSegments when using AI Service with RAG #1015
[FEATURE] Return retrieved Contents/TextSegments when using AI Service with RAG #1015
Conversation
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.
@KaisNeffati thank you a lot for your contribution!
langchain4j/src/test/java/dev/langchain4j/service/AiServicesWithRagIT.java
Outdated
Show resolved
Hide resolved
langchain4j/src/test/java/dev/langchain4j/service/AiServicesWithRagIT.java
Outdated
Show resolved
Hide resolved
langchain4j/src/test/java/dev/langchain4j/service/AiServicesWithRagIT.java
Outdated
Show resolved
Hide resolved
langchain4j/src/test/java/dev/langchain4j/service/AiServicesWithRagIT.java
Outdated
Show resolved
Hide resolved
langchain4j/src/test/java/dev/langchain4j/service/AiServicesWithRagIT.java
Outdated
Show resolved
Hide resolved
langchain4j/src/main/java/dev/langchain4j/service/WithSources.java
Outdated
Show resolved
Hide resolved
langchain4j-core/src/main/java/dev/langchain4j/rag/RetrievalAugmentor.java
Outdated
Show resolved
Hide resolved
langchain4j/src/main/java/dev/langchain4j/service/WithSources.java
Outdated
Show resolved
Hide resolved
951bc77
to
7cfac82
Compare
7cfac82
to
2d16e44
Compare
Hi @KaisNeffati, do you mind if I will do and push some changes? |
Feel free to do it @langchain4j |
@KaisNeffati could you please add me as collaborator to your repo? I can't push to this branch/PR :( |
Done |
- WithSources<T> -> Result<T> - AugmentationRequest, AugmentationResult, RetrievalAugmentor and ContentInjector to use ChatMessage instead of UserMessage
- WithSources<T> -> Result<T> - AugmentationRequest, AugmentationResult, RetrievalAugmentor and ContentInjector to use ChatMessage instead of UserMessage
- WithSources<T> -> Result<T> - AugmentationRequest, AugmentationResult, RetrievalAugmentor and ContentInjector to use ChatMessage instead of UserMessage
@KaisNeffati thank you! I have pushed my changes, could you please review? I hope now it is a bit more generic (Result instead of WithSources). I have also changed UserMessage to ChatMessage right away in all places to avoid doing breaking changes one more time in the near future. |
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.
Just a minor comment below !
And Yeah, Result
is a very wise choice. It confirms what I had in mind initially when I thought about 'ResponsePrompt' or 'ResponseMessage'. I'm glad to hear that you've found the right name 👏
Atherwise , all is good for me
langchain4j-core/src/main/java/dev/langchain4j/rag/DefaultRetrievalAugmentor.java
Outdated
Show resolved
Hide resolved
- WithSources<T> -> Result<T> - AugmentationRequest, AugmentationResult, RetrievalAugmentor and ContentInjector to use ChatMessage instead of UserMessage
@KaisNeffati thanks! Then I am merging it. |
Context
#660
Change
If you wish to access the sources (retrieved
Content
s used to augment the message),you can easily do so now by wrapping the return type in the
Result
class:Checklist
Before submitting this PR, please check the following points:
Checklist for adding new embedding store integration