From 17d3c77f2fd88938f302a2aee07db877e85ebf82 Mon Sep 17 00:00:00 2001 From: Jithin James Date: Wed, 15 Nov 2023 17:44:52 +0530 Subject: [PATCH] docs: added vertext ai support (#284) --- docs/howtos/customisations/gcp-vertexai.ipynb | 416 ++++++++++++++++++ docs/howtos/customisations/index.md | 1 + 2 files changed, 417 insertions(+) create mode 100644 docs/howtos/customisations/gcp-vertexai.ipynb diff --git a/docs/howtos/customisations/gcp-vertexai.ipynb b/docs/howtos/customisations/gcp-vertexai.ipynb new file mode 100644 index 000000000..7ddf68f15 --- /dev/null +++ b/docs/howtos/customisations/gcp-vertexai.ipynb @@ -0,0 +1,416 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "a6199b61-8084-4a2f-8488-2ddc4c260776", + "metadata": {}, + "source": [ + "# Using Vertext AI\n", + "\n", + "Vertex AI offers everything you need to build and use generative AI—from AI solutions, to Search and Conversation, to 100+ foundation models, to a unified AI platform. You get access to models like PaLM 2 which can be used to score your RAG responses and pipelines with Ragas instead of the default OpenAI.\n", + "\n", + "This tutorial will show you can you can use PaLM 2 with Ragas for evaluation." + ] + }, + { + "cell_type": "markdown", + "id": "79986e4d-17e4-4e88-ad2e-ca2b34a63de9", + "metadata": {}, + "source": [ + ":::{Note}\n", + "this guide is for folks who are using the Amazon Bedrock endpoints. Check the [evaluation guide](../../getstarted/evaluation.md) if your using OpenAI endpoints.\n", + ":::" + ] + }, + { + "cell_type": "markdown", + "id": "8bd757ae-51ee-4527-b2fb-0d0b88285939", + "metadata": {}, + "source": [ + "## Load Sample Dataset" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "0d3e6c99-c19c-44a1-8f05-4bde2de30866", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Found cached dataset fiqa (/home/jjmachan/.cache/huggingface/datasets/explodinggradients___fiqa/ragas_eval/1.0.0/3dc7b639f5b4b16509a3299a2ceb78bf5fe98ee6b5fee25e7d5e4d290c88efb8)\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "b0c4c79a44334e1198e1b7283e4532b5", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + " 0%| | 0/1 [00:00\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
questioncontextsanswerground_truthsfaithfulnessanswer_relevancycontext_recallcontext_precisionharmfulness
0How to deposit a cheque issued to an associate...[Just have the associate sign the back and the...\\nThe best way to deposit a cheque issued to a...[Have the check reissued to the proper payee.J...1.00.9113320.00.00
\n", + "" + ], + "text/plain": [ + " question \\\n", + "0 How to deposit a cheque issued to an associate... \n", + "\n", + " contexts \\\n", + "0 [Just have the associate sign the back and the... \n", + "\n", + " answer \\\n", + "0 \\nThe best way to deposit a cheque issued to a... \n", + "\n", + " ground_truths faithfulness \\\n", + "0 [Have the check reissued to the proper payee.J... 1.0 \n", + "\n", + " answer_relevancy context_recall context_precision harmfulness \n", + "0 0.911332 0.0 0.0 0 " + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = result.to_pandas()\n", + "df.head()" + ] + }, + { + "cell_type": "markdown", + "id": "c08f613d-880c-4e13-9716-05ce23fa4576", + "metadata": {}, + "source": [ + "And thats it!\n", + "\n", + "if you have any suggestion/feedbacks/things your not happy about, please do share it in the [issue section](https://github.com/explodinggradients/ragas/issues). We love hearing from you 😁" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/howtos/customisations/index.md b/docs/howtos/customisations/index.md index f56c4ee1d..0c8e35357 100644 --- a/docs/howtos/customisations/index.md +++ b/docs/howtos/customisations/index.md @@ -6,4 +6,5 @@ How to customize Ragas for your needs llms.ipynb azure-openai.ipynb aws-bedrock.ipynb +gcp-vertexai.ipynb :::