From 6bde6330d1b0d4c65af5e062f6c413075f343f37 Mon Sep 17 00:00:00 2001 From: Piotr Mardziel Date: Tue, 24 Oct 2023 19:24:32 -0700 Subject: [PATCH] Revert "example appui in quickstart" This reverts commit affab9504a4fe684ed4bc3e39bb540e90ba0f909. --- .../quickstart/langchain_quickstart.ipynb | 53 +++++++------------ trulens_eval/trulens_eval/schema.py | 4 -- 2 files changed, 19 insertions(+), 38 deletions(-) diff --git a/trulens_eval/examples/quickstart/langchain_quickstart.ipynb b/trulens_eval/examples/quickstart/langchain_quickstart.ipynb index be2c8ab2a..001d20ebd 100644 --- a/trulens_eval/examples/quickstart/langchain_quickstart.ipynb +++ b/trulens_eval/examples/quickstart/langchain_quickstart.ipynb @@ -56,8 +56,10 @@ "metadata": {}, "outputs": [], "source": [ + "from IPython.display import JSON\n", + "\n", "# Imports main tools:\n", - "from trulens_eval import Feedback, Huggingface, Tru\n", + "from trulens_eval import TruChain, Feedback, Huggingface, Tru\n", "from trulens_eval.schema import FeedbackResult\n", "tru = Tru()\n", "\n", @@ -77,7 +79,7 @@ "source": [ "### Create Simple LLM Application\n", "\n", - "This example uses a LangChain framework and OpenAI LLM. " + "This example uses a LangChain framework and OpenAI LLM" ] }, { @@ -86,27 +88,19 @@ "metadata": {}, "outputs": [], "source": [ - "def new_session() -> LLMChain:\n", - " # A function to return a chain for a new session. This is needed if you\n", - " # would like to run your app from the dashboard.\n", - "\n", - " full_prompt = HumanMessagePromptTemplate(\n", - " prompt=PromptTemplate(\n", - " template=\n", - " \"Provide a helpful response with relevant background information for the following: {prompt}\",\n", - " input_variables=[\"prompt\"],\n", - " )\n", + "full_prompt = HumanMessagePromptTemplate(\n", + " prompt=PromptTemplate(\n", + " template=\n", + " \"Provide a helpful response with relevant background information for the following: {prompt}\",\n", + " input_variables=[\"prompt\"],\n", " )\n", + ")\n", "\n", - " chat_prompt_template = ChatPromptTemplate.from_messages([full_prompt])\n", - "\n", - " llm = OpenAI(temperature=0.9, max_tokens=128)\n", - "\n", - " chain = LLMChain(llm=llm, prompt=chat_prompt_template, verbose=True)\n", + "chat_prompt_template = ChatPromptTemplate.from_messages([full_prompt])\n", "\n", - " return chain\n", + "llm = OpenAI(temperature=0.9, max_tokens=128)\n", "\n", - "chain = new_session()" + "chain = LLMChain(llm=llm, prompt=chat_prompt_template, verbose=True)" ] }, { @@ -174,12 +168,9 @@ "metadata": {}, "outputs": [], "source": [ - "tru_recorder = tru.Chain(\n", - " chain,\n", + "tru_recorder = TruChain(chain,\n", " app_id='Chain1_ChatApplication',\n", - " feedbacks=[f_lang_match],\n", - " new_session=new_session # to interact with app in the dashboard\n", - ")" + " feedbacks=[f_lang_match])" ] }, { @@ -274,7 +265,7 @@ "\n", "Note: Average feedback values are returned and displayed in a range from 0 (worst) to 1 (best).\n", "\n", - "![Chain Leaderboard](https://www.trulens.org/assets/images/Leaderboard.png)\n", + "![Chain Leaderboard](https://www.trulens.org/Assets/image/Leaderboard.png)\n", "\n", "To dive deeper on a particular chain, click \"Select Chain\".\n", "\n", @@ -284,21 +275,15 @@ "\n", "The evaluations tab provides record-level metadata and feedback on the quality of your LLM application.\n", "\n", - "![Evaluations](https://www.trulens.org/assets/images/Leaderboard.png)\n", + "![Evaluations](https://www.trulens.org/Assets/image/Leaderboard.png)\n", "\n", "### Deep dive into full chain metadata\n", "\n", "Click on a record to dive deep into all of the details of your chain stack and underlying LLM, captured by tru_chain_recorder.\n", "\n", - "![Explore a Chain](https://www.trulens.org/assets/images/Chain_Explore.png)\n", - "\n", - "If you prefer the raw format, you can quickly get it using the \"Display full chain json\" or \"Display full record json\" buttons at the bottom of the page.\n", - "\n", - "### Run the Chain from the Dashboard\n", - "\n", - "![App Runner](https://www.trulens.org/assets/images/appui/running_session.png)\n", + "![Explore a Chain](https://www.trulens.org/Assets/image/Chain_Explore.png)\n", "\n", - "You can run the chain inside the dashboard by creating a new session on the \"Apps\" page. See more information about this feature in `dashboard_appui.ipynb`." + "If you prefer the raw format, you can quickly get it using the \"Display full chain json\" or \"Display full record json\" buttons at the bottom of the page." ] }, { diff --git a/trulens_eval/trulens_eval/schema.py b/trulens_eval/trulens_eval/schema.py index a9159addc..e58f2fa40 100644 --- a/trulens_eval/trulens_eval/schema.py +++ b/trulens_eval/trulens_eval/schema.py @@ -541,7 +541,6 @@ def __init__( metadata: Optional[Metadata] = None, feedback_mode: FeedbackMode = FeedbackMode.WITH_APP_THREAD, app_extra_json: JSON = None, - new_session: Optional[Callable[[], Any]] = None, **kwargs ): @@ -570,9 +569,6 @@ def __init__( metadata = {} self.metadata = metadata - if new_session is not None: - kwargs['initial_app_loader'] = new_session - # EXPERIMENTAL if 'initial_app_loader' in kwargs: try: