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

Companion example for nemo/trulens blog #1131

Open
wants to merge 583 commits into
base: main
Choose a base branch
from
Open

Conversation

joshreini1
Copy link
Contributor

Other details that are good to know but need not be announced:

  • Companion example notebook for blog to show all nemo/trulens combined capabilities

joshreini1 and others added 30 commits December 19, 2023 15:08
* bump versions in quickstarts

* bump version

* remove openai references in function definitions page

* gemini example

* headers

* second example: semantic evals

* updates, add rag triad

* update top header
…#696)

* add aliases for selectors for main method args and main method return

* break down

* refine

---------

Co-authored-by: Josh Reini <60949774+joshreini1@users.noreply.github.com>
* exposed AzureOpenAI provider

* added docs

* Update CONTRIBUTING.md

* typo in mkdocs.yml

---------

Co-authored-by: Josh Reini <60949774+joshreini1@users.noreply.github.com>
* first

* typos

* typehint
* import llama only if needed

* use optional imports instead

---------

Co-authored-by: Piotr Mardziel <piotrm@gmail.com>
* fix

* typo

* don't print external if internal is available
Co-authored-by: Piotr Mardziel <piotrm@gmail.com>
* adjust docstring for select_context

* langchain select_context, update quickstarts

* undo app name change

* remove dev cell

* generalized langchain select_context (#711)

* generalized langchain select_context

* typo

* typo in string

* update langchain example to pass app in select_context

---------

Co-authored-by: Josh Reini <joshreini1@gmail.com>

* comments, clarity updates to quickstarts

* add lib-independent select_context

* update lc li quickstarts

---------

Co-authored-by: Piotr Mardziel <piotrm@gmail.com>
* add optional

* bug class_info fix
* update configs

* bugfix

* dont add class info to dicts
* Fix correctness prompt

Fixes #718

* Update base.py
* Bump suggested notebook versions

* Combine notebooks and py files

---------

Co-authored-by: Shayak Sen <shayak@truera.com>
* Bump suggested notebook versions

* Combine notebooks and py files

* Update __init__.py

---------

Co-authored-by: Shayak Sen <shayak@truera.com>
* debug

* display python version

* python version

* PromptTemplate update import

* bad escape fix

* add msg to exception

* pass kwargs in Groundedness

* pass kwargs with GroundTruthAgreement

* give default value to ground_truth_imp

* migrate db on reset
* fix example notebook

* fixes

* remove commented out
* always use prompt instead of messages

* use messages in base

* use prompt in bedrock

* move score to top of cot template, request entire template be used

* remove dev

* add TODO
* update langchain instrumentation page

* include instrumented methods

* llama-index instrumentation updates

* update the overview

* change path to instrumentation overview

* add some more info in appendices and line space

---------

Co-authored-by: Piotr Mardziel <piotrm@gmail.com>
* add instructions and text wrapping

* format

* clean up github scripts and update README sources

* typo

---------

Co-authored-by: Josh Reini <60949774+joshreini1@users.noreply.github.com>
Co-authored-by: joshreini1 <joshreini1@users.noreply.github.com>
* fix

* remove redundant

---------

Co-authored-by: Josh Reini <60949774+joshreini1@users.noreply.github.com>
Co-authored-by: joshreini1 <joshreini1@users.noreply.github.com>
* add instructions and text wrapping

* format

* debugging

* making obj arg no longer required

* remove obj and add documentation for WithClassInfo

* remove IPython from most notebooks and organize imports

* fix test errors

* forgot warning

---------

Co-authored-by: Josh Reini <60949774+joshreini1@users.noreply.github.com>
* update notebooks to test

* rehack

* update langchain requirement

* add core lowerbound
* fix instance check on generic types

* remove original check

---------

Co-authored-by: Piotr Mardziel <piotrm@gmail.com>
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@joshreini1 joshreini1 marked this pull request as ready for review May 10, 2024 20:25
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label May 10, 2024
@joshreini1 joshreini1 requested a review from piotrm0 May 10, 2024 20:25
@dosubot dosubot bot added the documentation Improvements or additions to documentation label May 10, 2024
@@ -0,0 +1,1250 @@
{
Copy link
Contributor

@piotrm0 piotrm0 May 13, 2024

Choose a reason for hiding this comment

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

Line #24.          "text1":"{question_lens}",\

The nemo persons suggested that using the variables version of the lenses here (for example {context_lens} ) is a bit confusing. Because of this, there is the other notebook that does it a bit simpler by defining python methods for each of these flows.


Reply via ReviewNB

@@ -0,0 +1,1250 @@
{
Copy link
Contributor

@piotrm0 piotrm0 May 13, 2024

Choose a reason for hiding this comment

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

Line #64.      if $groundedness_result < 0.7

Confused here. $groundedness_result, $answerrelevance_result, $contextrelevance_result have not been defined. Also unclear when the prior two flows get executed. Perhaps the code text is oudated?


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to include $groundedness_result, $answerrelevance_result, $contextrelevance_result generation.

Not sure what you mean by "Also unclear when the prior two flows get executed."?

Copy link
Contributor

Choose a reason for hiding this comment

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

This config specification determines what "flows" get executed when the bot wants to output something:

output:
  flows:
    - check language match
    # triad defined seperately so hopefully they can be executed in parallel
    - check rag triad groundedness
    - check rag triad relevance
    - check rag triad qs_relevance
    - bot: explain usage and capabilities

The last flow in the notebook is check rag triad context_relevance which is now not executed as it is not in the list. Even if it were in the list, it is unclear how the values that were set by the other flows are set or whether they are available in that flow (I'm uncertain if colang will make the variables defined in one flow available in another). The other issue is even if variables were available, you would need to make sure the 2 flows that compute $groundedness_result and $answerrelevance_result are executed before they are used in the check rag triad context_relevance flow.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels May 13, 2024
joshreini1 and others added 15 commits May 14, 2024 11:34
retreivers -> retrievers
* unify groundedness start

* remove groundedness.py

* groundedness nli moves

* remove custom aggregator

* groundedness aggregator to user code

* move agg to trulens side by default (groundedness)

* remove extra code

* remove hf key setting

* remove hf import

* add comment about aggregation for context relevance

* update init

* remove unneeded import

* use generate_score_and_reasons for groundedness internally

* f-strings for groundedness prompts

* docstring

* docstrings formatting

* groundedness reasons template

* remove redundant prompt

* update quickstarts

* llama-index notebooks

* rag triad helper update

* oai assistant nb

* update readme

* models notebooks updates

* iterate nbs

* mongo, pinecone nbs

* update huggingface docstring

* remove outdated docstring selector notes

* more docstring cleaning
* open ai streaming adjustments in cost tracking

* notes

* delete outputs
Co-authored-by: joshreini1 <joshreini1@users.noreply.github.com>
Co-authored-by: Josh Reini <60949774+joshreini1@users.noreply.github.com>
* Update selecting_components.md

* Update MultiQueryRetrievalLangchain.ipynb

* Update random_evaluation.ipynb

* Update canopy_quickstart.ipynb
Co-authored-by: joshreini1 <joshreini1@users.noreply.github.com>
* update comprehensiveness + nb

* nb expansion

* fix typo

* meetingbank transcript data

* oss models in app

* test

* benchmarking gpt-3.5-turbo, gpt-4-turbo, and gpt-4o

* update path

* comprehensiveness benchmark

* updated summarization_eval nb

* fix normalization

* show improvement in comprehensiveness feedback functions

---------

Co-authored-by: Daniel <dah0417912@gmail.com>
* version bump

* simpler lc quickstart

* update installs and imports

* update langchain instrumentation docs

* remove groundedness ref from providers.md

* build docs fixes

* remove key cell

* fix docs build

* firx formatting for stock.md

* remove extra spaces

* undo format change

* update docstrings for hugs and base provider

* openai docstring updates

* hugs docstring update

* update context relevance hugs docstring

* more docstring updates

* remove can be changed messages from openai provider docstrings
Co-authored-by: joshreini1 <joshreini1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.