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

trulens-auto #1388

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

trulens-auto #1388

wants to merge 9 commits into from

Conversation

sfc-gh-pmardziel
Copy link
Contributor

@sfc-gh-pmardziel sfc-gh-pmardziel commented Aug 26, 2024

Description

  1. Created an optional trulens-auto package containing an interactive API meant for accessing trulens features in a notebook. This provides the trulens.auto module and submodules for a public, package-independent, access to trulens components like TruSession:
from trulens.auto import TruSession

Some lookups are dynamic into the various trulens-* packages and either install the packages automatically or give the user instructions on installing additional packages if appropriate. The installation is the default but can be disabled. For example:

from trulens.auto.providers import Cortex

If trulens-providers-cortex is installed, the above will work. If it is not installed, an instruction is issued alongside the import error:

RuntimeError: Package trulens-providers-cortex is not installed. Enable automatic installation by calling `trulens.auto.set_no_install(False)` or install it manually with pip: 
    ```bash
    pip install 'trulens-providers-cortex'
    ```

The interactive API also gives better import errors if someone tries to import something that does not exist showing information of what is actually contained in the api modules and whether the optional packages that they need are installed:

from trulens.auto import Blah

Output:

...
ImportError: Module trulens.auto has no attribute Blah.
Module 'trulens.auto' from '/Users/pmardziel/repos/truera/trulens/src/api/trulens/api/__init__.py contains:
provider: 
  Bedrock	[trulens-providers-bedrock]	[1.0.1a0]
  Cortex	[trulens-providers-cortex]	[not installed]
  Huggingface	[trulens-providers-huggingface]	[1.0.1a0]
  HuggingfaceLocal	[trulens-providers-huggingface]	[1.0.1a0]
  Langchain	[trulens-providers-langchain]	[1.0.1a0]
  LiteLLM	[trulens-providers-litellm]	[1.0.1a0]
  OpenAI	[trulens-providers-openai]	[1.0.1a0]
  AzureOpenAI	[trulens-providers-openai]	[1.0.1a0]
recorder: 
  TruBasicApp	[trulens-core]	[1.0.1a0]
  TruCustomApp	[trulens-core]	[1.0.1a0]
  TruVirtual	[trulens-core]	[1.0.1a0]
  TruChain	[trulens-instrument-langchain]	[1.0.1a0]
  TruLlama	[trulens-instrument-llamaindex]	[1.0.1a0]
  TruRails	[trulens-instrument-nemo]	[not installed]
class: 
  Tru	[trulens-core]	[1.0.1a0]
  TP	[trulens-core]	[1.0.1a0]
  Feedback	[trulens-core]	[1.0.1a0]
  Provider	[trulens-core]	[1.0.1a0]
enum: 
  FeedbackMode	[trulens-core]	[1.0.1a0]
  FeedbackResultStatus	[trulens-core]	[1.0.1a0]
  FeedbackOnMissingParameters	[trulens-core]	[1.0.1a0]
  FeedbackCombinations	[trulens-core]	[1.0.1a0]
utility: 
  Select	[trulens-core]	[1.0.1a0]
  set_no_install	[trulens-api]	[1.0.1a0]
schema: 
  FeedbackResult	[trulens-core]	[1.0.1a0]
  FeedbackCall	[trulens-core]	[1.0.1a0]
  FeedbackDefinition	[trulens-core]	[1.0.1a0]

Importing from this module will install the required package. You can disable this by calling `trulens.auto.set_no_install()`.

Other details good to know for developers

Please include any other details of this change useful for TruLens developers.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • New Tests
  • This change includes re-generated golden test results
  • This change requires a documentation update

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Aug 26, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@dosubot dosubot bot added the dependencies Pull requests that update a dependency file label Aug 26, 2024
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant