From 8f587fb5984bccf0dddd5536e7ca023b14da376e Mon Sep 17 00:00:00 2001 From: Thuc Pham <51660321+thucpn@users.noreply.github.com> Date: Wed, 6 Mar 2024 10:33:13 +0700 Subject: [PATCH] fix: ignore outdated pack examples (#11003) --- .../examples/{example.py => _example.py} | 0 .../pyproject.toml | 4 ++-- .../examples/arize_phoenix_llama_pack.ipynb | 10 +--------- .../examples/example.py | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 1 + .../examples/example.py | 2 +- .../llama_index/packs/rag_evaluator/base.py | 16 +++++----------- .../pyproject.toml | 3 ++- 9 files changed, 14 insertions(+), 26 deletions(-) rename llama-index-packs/llama-index-packs-agent-search-retriever/examples/{example.py => _example.py} (100%) diff --git a/llama-index-packs/llama-index-packs-agent-search-retriever/examples/example.py b/llama-index-packs/llama-index-packs-agent-search-retriever/examples/_example.py similarity index 100% rename from llama-index-packs/llama-index-packs-agent-search-retriever/examples/example.py rename to llama-index-packs/llama-index-packs-agent-search-retriever/examples/_example.py diff --git a/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml b/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml index f46a14bf1..f36d3a0dc 100644 --- a/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml +++ b/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml @@ -29,10 +29,10 @@ license = "MIT" maintainers = ["logan-markewich"] name = "llama-index-packs-agent-search-retriever" readme = "README.md" -version = "0.1.3" +version = "0.1.4" [tool.poetry.dependencies] -python = ">=3.8.1,<4.0" +python = ">=3.9,<3.12" llama-index-core = "^0.10.1" [tool.poetry.group.dev.dependencies] diff --git a/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/arize_phoenix_llama_pack.ipynb b/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/arize_phoenix_llama_pack.ipynb index 82631e021..1e0fb015b 100644 --- a/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/arize_phoenix_llama_pack.ipynb +++ b/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/arize_phoenix_llama_pack.ipynb @@ -33,19 +33,11 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install llama-index\n", "%pip install llama-index-readers-web\n", "%pip install llama-index-packs-arize-phoenix-query-engine" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "!pip install \"arize-phoenix[llama-index]\" llama-hub html2text" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/example.py b/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/example.py index 41b2d92e2..8e3283f23 100644 --- a/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/example.py +++ b/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/example.py @@ -2,7 +2,7 @@ from llama_index.packs.arize_phoenix_query_engine import ArizePhoenixQueryEnginePack from llama_index.core.node_parser import SentenceSplitter -from llama_index.core.readers.web import SimpleWebPageReader +from llama_index.readers.web import SimpleWebPageReader from tqdm.auto import tqdm # load documents and create the pack diff --git a/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/pyproject.toml b/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/pyproject.toml index 39d8b558d..2bf8636e9 100644 --- a/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/pyproject.toml +++ b/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/pyproject.toml @@ -34,7 +34,7 @@ version = "0.1.4" [tool.poetry.dependencies] python = ">=3.8.1,<3.12" llama-index-core = "^0.10.11.post1" -arize-phoenix = "^2.7.0" +llama-index-callbacks-arize-phoenix = "^0.1.4" llama-index-readers-web = "^0.1.1" [tool.poetry.group.dev.dependencies] diff --git a/llama-index-packs/llama-index-packs-corrective-rag/pyproject.toml b/llama-index-packs/llama-index-packs-corrective-rag/pyproject.toml index d4cbc78ae..771d03001 100644 --- a/llama-index-packs/llama-index-packs-corrective-rag/pyproject.toml +++ b/llama-index-packs/llama-index-packs-corrective-rag/pyproject.toml @@ -35,6 +35,7 @@ version = "0.1.1" python = ">=3.8.1,<4.0" llama-index-core = "^0.10.0" tavily-python = "^0.3.1" +llama-index-tools-tavily-research = "^0.1.2" [tool.poetry.group.dev.dependencies] ipython = "8.10.0" diff --git a/llama-index-packs/llama-index-packs-rag-evaluator/examples/example.py b/llama-index-packs/llama-index-packs-rag-evaluator/examples/example.py index d2c12c39c..589fc1de9 100644 --- a/llama-index-packs/llama-index-packs-rag-evaluator/examples/example.py +++ b/llama-index-packs/llama-index-packs-rag-evaluator/examples/example.py @@ -1,8 +1,8 @@ # Required Environment Variables: OPENAI_API_KEY +from llama_index.core import VectorStoreIndex from llama_index.core.llama_dataset import download_llama_dataset from llama_index.packs.rag_evaluator import RagEvaluatorPack -from llama_index.legacy import VectorStoreIndex # download a LabelledRagDataset from llama-hub rag_dataset, documents = download_llama_dataset( diff --git a/llama-index-packs/llama-index-packs-rag-evaluator/llama_index/packs/rag_evaluator/base.py b/llama-index-packs/llama-index-packs-rag-evaluator/llama_index/packs/rag_evaluator/base.py index 97006918e..2e261a290 100644 --- a/llama-index-packs/llama-index-packs-rag-evaluator/llama_index/packs/rag_evaluator/base.py +++ b/llama-index-packs/llama-index-packs-rag-evaluator/llama_index/packs/rag_evaluator/base.py @@ -7,7 +7,6 @@ from typing import Any, List, Optional import pandas as pd import tqdm -from llama_index.core import ServiceContext from llama_index.core.evaluation import ( CorrectnessEvaluator, EvaluationResult, @@ -22,6 +21,7 @@ from llama_index.core.llama_dataset import BaseLlamaDataset, BaseLlamaPrediction from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.llms import LLM from llama_index.core.query_engine import BaseQueryEngine +from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.llms.openai import OpenAI from openai import RateLimitError from tqdm.asyncio import tqdm_asyncio @@ -95,22 +95,16 @@ class RagEvaluatorPack(BaseLlamaPack): """Construct the evaluators.""" judges = {} judges["correctness"] = CorrectnessEvaluator( - service_context=ServiceContext.from_defaults( - llm=self.judge_llm, - ) + llm=self.judge_llm, ) judges["relevancy"] = RelevancyEvaluator( - service_context=ServiceContext.from_defaults( - llm=self.judge_llm, - ) + llm=self.judge_llm, ) judges["faithfulness"] = FaithfulnessEvaluator( - service_context=ServiceContext.from_defaults( - llm=self.judge_llm, - ) + llm=self.judge_llm, ) judges["semantic_similarity"] = SemanticSimilarityEvaluator( - service_context=ServiceContext.from_defaults() + embed_model=OpenAIEmbedding() ) return judges diff --git a/llama-index-packs/llama-index-packs-rag-evaluator/pyproject.toml b/llama-index-packs/llama-index-packs-rag-evaluator/pyproject.toml index 8c040a7f3..585c36772 100644 --- a/llama-index-packs/llama-index-packs-rag-evaluator/pyproject.toml +++ b/llama-index-packs/llama-index-packs-rag-evaluator/pyproject.toml @@ -29,12 +29,13 @@ license = "MIT" maintainers = ["nerdai"] name = "llama-index-packs-rag-evaluator" readme = "README.md" -version = "0.1.3" +version = "0.1.4" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" llama-index-core = "^0.10.1" llama-index-llms-openai = "^0.1.1" +llama-index-embeddings-openai = "^0.1.6" [tool.poetry.group.dev.dependencies] ipython = "8.10.0" -- GitLab