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

Context filtering guardrails #1192

Merged
merged 63 commits into from
Jun 21, 2024
Merged

Context filtering guardrails #1192

merged 63 commits into from
Jun 21, 2024

Conversation

sfc-gh-jreini
Copy link
Contributor

@sfc-gh-jreini sfc-gh-jreini commented Jun 10, 2024

Items to add to release announcement:

  • Context filtering guardrails for python custom apps, Langchain, Llama-Index
  • Display utility for feedback results
  • Improved select_context for Langchain
  • Add mkdocs configuration for content tabs
2024-06-13.12-33-13.mp4

🚀 This description was created by Ellipsis for commit 9036798

Summary:

Enhancements in context filtering and display utilities, with significant improvements in the select_context method across different classes, added checks for method availability in retrievers, and updated import paths and documentation for better organization.

Key points:

  • Context filtering guardrails for python custom apps, Langchain, Llama-Index
  • Display utility for feedback results
  • Improved select_context for Langchain
  • Add mkdocs configuration for content tabs
  • Enhanced select_context method across different classes
  • Added checks for method availability in retrievers
  • Updated import paths and documentation for better organization
  • Added display utility for feedback results in trulens_eval/trulens_eval/utils/display.py

Generated with ❤️ by ellipsis.dev

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 10, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jun 10, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to dca981b in 1 minute and 10 seconds

More details
  • Looked at 31 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_bIRnghBTPl1blAef


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

trulens_eval/trulens_eval/tru_chain.py Show resolved Hide resolved
sfc-gh-jreini and others added 2 commits June 10, 2024 16:34
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 3ec0c72 in 1 minute and 52 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_A0LvWTd6yrQzYdbX


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

trulens_eval/trulens_eval/tru_chain.py Show resolved Hide resolved
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 9090135 in 1 minute and 6 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. trulens_eval/trulens_eval/tru_llama.py:83
  • Draft comment:
    Ensure that all references to WithFeedbackFilterNodes throughout the codebase are updated to reflect the new import path trulens_eval.guardrails.llama to avoid import errors.
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 50%.

Workflow ID: wflow_w6b5Npw3qgwPOZ0U


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

ellipsis-dev bot commented Jun 10, 2024

Skipped PR review on 777240f because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.


Generated with ❤️ by ellipsis.dev

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 8b6abf3 in 33 seconds

More details
  • Looked at 21 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. trulens_eval/trulens_eval/utils/llama.py:9
  • Draft comment:
    The import for List was removed. Please ensure that List is not used elsewhere in this file or in any related files where this module's objects are utilized. If List is indeed not used, then this change is appropriate.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The import statement for 'List' was removed, but it's not clear if 'List' was actually unused. The code snippet provided does not show any usage of 'List', but it's possible that other parts of the file or related files might still require it. I need to check if 'List' is used elsewhere in the file or if its removal is justified.

Workflow ID: wflow_M3l4SiH2YvcTpctr


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 1110aea in 1 minute and 25 seconds

More details
  • Looked at 98 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_5TAnJJWcvNzS8EH1


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

trulens_eval/trulens_eval/guardrails/llama.py Outdated Show resolved Hide resolved
@sfc-gh-jreini sfc-gh-jreini changed the title Context filtering! Context filtering guardrails Jun 11, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on d525b35 in 3 minutes and 22 seconds

More details
  • Looked at 79 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_wkgvRbTyfTiZBgyK


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on b6eadac in 1 minute and 42 seconds

More details
  • Looked at 31 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. mkdocs.yml:29
  • Draft comment:
    The PR description mentions significant updates related to context filtering and display utilities, but the diff provided only shows changes to the mkdocs.yml file, which is unrelated to the described features. Please ensure that all relevant changes are included in the PR or update the PR description to accurately reflect the changes made.
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 50%.

Workflow ID: wflow_vyvQTpHWr7XzZlGN


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 7d77dc2 in 1 minute and 47 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. docs/trulens_eval/guardrails/index.md:23
  • Draft comment:
    The PR description suggests updates related to context filtering guardrails, but the diff only shows a minor formatting change. Please ensure that all intended updates are included in the PR.
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 50%.

Workflow ID: wflow_hZ84EDCrX9GRxGKZ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 310d0b1 in 1 minute and 2 seconds

More details
  • Looked at 14 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_YhOhkgJlSkSWzP5t


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

mkdocs.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 9036798 in 1 minute and 52 seconds

More details
  • Looked at 133 lines of code in 6 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. trulens_eval/trulens_eval/guardrails/langchain.py:83
  • Draft comment:
    The lambda function inside the ThreadPoolExecutor is capturing the loop variable doc. This can lead to all lambda functions capturing the same reference, which is the last item in the loop. To fix this, you should use a default argument in the lambda to capture the current value of doc for each iteration.
                lambda doc=doc: self.feedback(query, doc.page_content)
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 50%.

Workflow ID: wflow_RqCHOpNAR2B4hB4A


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

trulens_eval/trulens_eval/guardrails/llama.py Show resolved Hide resolved
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 21, 2024
@sfc-gh-jreini sfc-gh-jreini merged commit 36bf645 into main Jun 21, 2024
3 of 9 checks passed
sfc-gh-jreini added a commit that referenced this pull request Jun 21, 2024
* fix select_context to call return individual items, not collected list

* display utilities, context filtering, oh my

* Update trulens_eval/trulens_eval/tru_chain.py

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* undo bad ellipsis change

* change moved import

* update llama quickstart

* get llama working

* llama updates

* add docstring examples

* guardrails docs page

* allow tabbed content setting in mkdocs yml

* formatting

* api ref links

* api ref files for guardrails

* api ref to guardrails in mkdocs

* update in trubot

* fix typo

* add missing init

* api ref updates

* docstring updates

* docstring updates

* base context filter for custom apps

* guardrails in quickstart

* make display util more efficient

* switch openai model to std

* drop unneccessary import

* docs for base guardrails

* remove unneccessary name

* drop unneccessary args

* using sentence

* fix select_context

* langchain quickstart updates

* fix link

* langchain feedback type error handling

* llama feedback type error handling

* base feedback type error handling

* pass context as default argument to lambda function in base

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* revert ellipsis change

* fix test failure

* move docstrings, simplify

* accept directionality from feedback

* set wraper.__dict__ too

* filter on demand

* format, remove unused imports

* format

* format

* assert llama-index installed

* assert langchain installed

* test llam aguardrails optional mod

* format

* copy signature instead of dict

* add note

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
sfc-gh-jreini added a commit that referenced this pull request Jun 21, 2024
* fix select_context to call return individual items, not collected list

* display utilities, context filtering, oh my

* Update trulens_eval/trulens_eval/tru_chain.py



* undo bad ellipsis change

* change moved import

* update llama quickstart

* get llama working

* llama updates

* add docstring examples

* guardrails docs page

* allow tabbed content setting in mkdocs yml

* formatting

* api ref links

* api ref files for guardrails

* api ref to guardrails in mkdocs

* update in trubot

* fix typo

* add missing init

* api ref updates

* docstring updates

* docstring updates

* base context filter for custom apps

* guardrails in quickstart

* make display util more efficient

* switch openai model to std

* drop unneccessary import

* docs for base guardrails

* remove unneccessary name

* drop unneccessary args

* using sentence

* fix select_context

* langchain quickstart updates

* fix link

* langchain feedback type error handling

* llama feedback type error handling

* base feedback type error handling

* pass context as default argument to lambda function in base



* revert ellipsis change

* fix test failure

* move docstrings, simplify

* accept directionality from feedback

* set wraper.__dict__ too

* filter on demand

* format, remove unused imports

* format

* format

* assert llama-index installed

* assert langchain installed

* test llam aguardrails optional mod

* format

* copy signature instead of dict

* add note

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@sfc-gh-jreini sfc-gh-jreini mentioned this pull request Jun 21, 2024
sfc-gh-dhuang pushed a commit that referenced this pull request Jun 28, 2024
* fix select_context to call return individual items, not collected list

* display utilities, context filtering, oh my

* Update trulens_eval/trulens_eval/tru_chain.py

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* undo bad ellipsis change

* change moved import

* update llama quickstart

* get llama working

* llama updates

* add docstring examples

* guardrails docs page

* allow tabbed content setting in mkdocs yml

* formatting

* api ref links

* api ref files for guardrails

* api ref to guardrails in mkdocs

* update in trubot

* fix typo

* add missing init

* api ref updates

* docstring updates

* docstring updates

* base context filter for custom apps

* guardrails in quickstart

* make display util more efficient

* switch openai model to std

* drop unneccessary import

* docs for base guardrails

* remove unneccessary name

* drop unneccessary args

* using sentence

* fix select_context

* langchain quickstart updates

* fix link

* langchain feedback type error handling

* llama feedback type error handling

* base feedback type error handling

* pass context as default argument to lambda function in base

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* revert ellipsis change

* fix test failure

* move docstrings, simplify

* accept directionality from feedback

* set wraper.__dict__ too

* filter on demand

* format, remove unused imports

* format

* format

* assert llama-index installed

* assert langchain installed

* test llam aguardrails optional mod

* format

* copy signature instead of dict

* add note

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
sfc-gh-dhuang pushed a commit that referenced this pull request Jul 1, 2024
* fix select_context to call return individual items, not collected list

* display utilities, context filtering, oh my

* Update trulens_eval/trulens_eval/tru_chain.py

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* undo bad ellipsis change

* change moved import

* update llama quickstart

* get llama working

* llama updates

* add docstring examples

* guardrails docs page

* allow tabbed content setting in mkdocs yml

* formatting

* api ref links

* api ref files for guardrails

* api ref to guardrails in mkdocs

* update in trubot

* fix typo

* add missing init

* api ref updates

* docstring updates

* docstring updates

* base context filter for custom apps

* guardrails in quickstart

* make display util more efficient

* switch openai model to std

* drop unneccessary import

* docs for base guardrails

* remove unneccessary name

* drop unneccessary args

* using sentence

* fix select_context

* langchain quickstart updates

* fix link

* langchain feedback type error handling

* llama feedback type error handling

* base feedback type error handling

* pass context as default argument to lambda function in base

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* revert ellipsis change

* fix test failure

* move docstrings, simplify

* accept directionality from feedback

* set wraper.__dict__ too

* filter on demand

* format, remove unused imports

* format

* format

* assert llama-index installed

* assert langchain installed

* test llam aguardrails optional mod

* format

* copy signature instead of dict

* add note

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
sfc-gh-chu pushed a commit that referenced this pull request Sep 25, 2024
* fix select_context to call return individual items, not collected list

* display utilities, context filtering, oh my

* Update trulens_eval/trulens_eval/tru_chain.py

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* undo bad ellipsis change

* change moved import

* update llama quickstart

* get llama working

* llama updates

* add docstring examples

* guardrails docs page

* allow tabbed content setting in mkdocs yml

* formatting

* api ref links

* api ref files for guardrails

* api ref to guardrails in mkdocs

* update in trubot

* fix typo

* add missing init

* api ref updates

* docstring updates

* docstring updates

* base context filter for custom apps

* guardrails in quickstart

* make display util more efficient

* switch openai model to std

* drop unneccessary import

* docs for base guardrails

* remove unneccessary name

* drop unneccessary args

* using sentence

* fix select_context

* langchain quickstart updates

* fix link

* langchain feedback type error handling

* llama feedback type error handling

* base feedback type error handling

* pass context as default argument to lambda function in base

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* revert ellipsis change

* fix test failure

* move docstrings, simplify

* accept directionality from feedback

* set wraper.__dict__ too

* filter on demand

* format, remove unused imports

* format

* format

* assert llama-index installed

* assert langchain installed

* test llam aguardrails optional mod

* format

* copy signature instead of dict

* add note

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants