Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

feat: Retrieval augmented generation for chat - #2886

Merged
mergify[bot] merged 1 commit into
instructlab:mainfrom
anastasds:rag-chat
Jan 22, 2025
Merged

feat: Retrieval augmented generation for chat#2886
mergify[bot] merged 1 commit into
instructlab:mainfrom
anastasds:rag-chat

Conversation

@anastasds

@anastasds anastasds commented Jan 8, 2025

Copy link
Copy Markdown
Contributor

Resolves #2876
Depends on #2832
Dev doc: instructlab/dev-docs#161

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the
    conventional commits.
  • Changelog updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Functional tests have been added, if necessary.
  • E2E Workflow tests have been added, if necessary.

@mergify mergify Bot added documentation Improvements or additions to documentation testing Relates to testing dependencies Relates to dependencies ci-failure PR has at least one CI failure labels Jan 8, 2025
Comment thread src/instructlab/configuration.py Outdated
Comment thread src/instructlab/model/chat.py
Comment thread src/instructlab/model/chat.py
@dmartinol

Copy link
Copy Markdown
Contributor

Thanks! We definitely need to move forward with the depending #2832 which will make the code changes much clearer.

Comment thread src/instructlab/model/chat.py
Comment thread src/instructlab/model/chat.py Outdated
Comment thread src/instructlab/configuration.py Outdated
@mergify mergify Bot added ci-failure PR has at least one CI failure and removed ci-failure PR has at least one CI failure labels Jan 9, 2025
Comment thread src/instructlab/configuration.py Outdated
Comment thread src/instructlab/configuration.py Outdated
@mergify

mergify Bot commented Jan 10, 2025

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. @anastasds please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase This Pull Request needs to be rebased label Jan 10, 2025
Comment thread src/instructlab/configuration.py Outdated
@mergify mergify Bot added ci-failure PR has at least one CI failure and removed ci-failure PR has at least one CI failure labels Jan 10, 2025

@cdoern cdoern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small preliminary review about some config stuff that is likely giving you issues currently as well as some core norms I would like to follow here if possible!

Comment thread CHANGELOG.md Outdated
Comment thread src/instructlab/configuration.py Outdated
Comment thread src/instructlab/configuration.py Outdated
Comment thread src/instructlab/configuration.py
Comment thread src/instructlab/configuration.py Outdated
Comment thread src/instructlab/model/chat.py Outdated
Comment thread src/instructlab/model/chat.py
Comment thread src/instructlab/model/chat.py Outdated
Comment thread src/instructlab/model/serve_backend.py
Comment thread src/instructlab/rag/haystack/component_factory.py Outdated
@mergify mergify Bot added ci-failure PR has at least one CI failure and removed needs-rebase This Pull Request needs to be rebased ci-failure PR has at least one CI failure labels Jan 13, 2025
@nathan-weinberg
nathan-weinberg self-requested a review January 15, 2025 18:34
@mergify

mergify Bot commented Jan 15, 2025

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. @anastasds please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the ci-failure PR has at least one CI failure label Jan 21, 2025
@anastasds
anastasds force-pushed the rag-chat branch 2 times, most recently from 5787d80 to 2451694 Compare January 21, 2025 16:10
@mergify mergify Bot removed the ci-failure PR has at least one CI failure label Jan 21, 2025
@mergify mergify Bot added the ci-failure PR has at least one CI failure label Jan 21, 2025
@mergify mergify Bot removed the ci-failure PR has at least one CI failure label Jan 21, 2025

@cdoern cdoern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty solid, one or two comments but nothing blocking

@click.option(
"--rag",
"rag_enabled",
default=False,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure if you need a default for is_flag types, I think the default is assumed to be false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly think this is a case where it's good to keep it, much more explicit for folks working with the code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect so too, but there is a minor signal in still explicitly setting default=False to other developers that "we really mean for this to be disabled unless there is good reason otherwise".

return path.join(self.MODELS_DIR, self.GRANITE_EMBEDDING_MODEL_NAME)

@property
def DEFAULT_DOCUMENT_STORE_PATH(self) -> str:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to add this to ensure_storage_directories_exist, which is a func that creates all necessary directories before running any ilab cmd

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, not blocking as we can do this in one of the other RAG PRs as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEFAULTS._data_dir is already in ensure_storage_directories_exist; the DOCUMENT_STORE_NAME is a filename:

DOCUMENT_STORE_NAME = "embeddings.db"

@mergify mergify Bot added the one-approval PR has one approval from a maintainer label Jan 21, 2025

@nathan-weinberg nathan-weinberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well - great stuff @anastasds!

@click.option(
"--rag",
"rag_enabled",
default=False,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly think this is a case where it's good to keep it, much more explicit for folks working with the code

return path.join(self.MODELS_DIR, self.GRANITE_EMBEDDING_MODEL_NAME)

@property
def DEFAULT_DOCUMENT_STORE_PATH(self) -> str:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, not blocking as we can do this in one of the other RAG PRs as well

@mergify mergify Bot removed the one-approval PR has one approval from a maintainer label Jan 21, 2025
@nathan-weinberg nathan-weinberg added the hold In-progress PR. Tag should be removed before merge. label Jan 21, 2025
@nathan-weinberg

Copy link
Copy Markdown
Contributor

@anastasds please squash commits when you get a chance - once done we can remove the hold merge it will auto-merge 👍

@mergify mergify Bot added the CI/CD Affects CI/CD configuration label Jan 21, 2025
@mergify

mergify Bot commented Jan 21, 2025

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. @anastasds please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase This Pull Request needs to be rebased label Jan 21, 2025
Signed-off-by: Anastas Stoyanovsky <astoyano@redhat.com>
@mergify mergify Bot removed the needs-rebase This Pull Request needs to be rebased label Jan 21, 2025
@cdoern

cdoern commented Jan 21, 2025

Copy link
Copy Markdown
Contributor

running large job on this PR, I will then remove the hold

@github-actions

Copy link
Copy Markdown

E2E (NVIDIA L40S x4) workflow launched on this PR: View run

@github-actions

Copy link
Copy Markdown

e2e workflow succeeded on this PR: View run, congrats!

@cdoern cdoern removed the hold In-progress PR. Tag should be removed before merge. label Jan 22, 2025
@mergify
mergify Bot merged commit f5a655f into instructlab:main Jan 22, 2025
mergify Bot added a commit that referenced this pull request Jan 23, 2025
Related ADR: instructlab/dev-docs#178
Depends on #2886 , #2903 
Resolves #2888 

* Adds feature gating following the pattern in the ADR linked above
* Adds an `@dev_preview` decorator that mocks the feature scope environment variable for specific tests covering experimental functionality. 
* Adds unit tests verifying that RAG related functionality gives a useful and accurate error message when attempted to be used without being enabled.


Approved-by: nathan-weinberg

Approved-by: cdoern
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CI/CD Affects CI/CD configuration dependencies Relates to dependencies documentation Improvements or additions to documentation testing Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RAG][Dev] Integrate retrieval into chat

7 participants