From f5a4b1ca1db911cf40a30772b1f79aa199be5f75 Mon Sep 17 00:00:00 2001 From: Philippe Moussalli Date: Tue, 9 Jan 2024 16:44:00 +0100 Subject: [PATCH] Other small fixes (#61) --- src/evaluation.ipynb | 17 +++++++++++++---- src/parameter_search.ipynb | 10 +++++----- src/pipeline.ipynb | 3 ++- src/pipeline_eval.py | 2 +- src/pipeline_index.py | 2 +- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/evaluation.ipynb b/src/evaluation.ipynb index 71e4158..51b9f28 100644 --- a/src/evaluation.ipynb +++ b/src/evaluation.ipynb @@ -407,10 +407,12 @@ "import os\n", "import pipeline_eval\n", "\n", + "os.environ[\"OPENAI_KEY\"] = \"\"\n", + "\n", "evaluation_args = {\n", " \"retrieval_top_k\": 2,\n", - " \"evaluation_module\": \"langchain.llms\",\n", - " \"evaluation_llm\": \"OpenAI\",\n", + " \"evaluation_module\": \"langchain.chat_models\",\n", + " \"evaluation_llm\": \"ChatOpenAI\",\n", " \"evaluation_llm_kwargs\": {\"openai_api_key\": os.environ[\"OPENAI_KEY\"], \"model_name\" : \"gpt-3.5-turbo\"}, # TODO: Update with your key or use a different model\n", " \"evaluation_metrics\": [\"context_precision\", \"context_relevancy\"]\n", "}\n", @@ -433,8 +435,15 @@ "source": [ "runner = DockerRunner()\n", "extra_volumes = [str(os.path.join(os.path.abspath('.'), \"evaluation_datasets\")) + \":/data\"]\n", - "runner.run(evaluation_pipeline, extra_volumes=extra_volumes)\n", - "\n", + "runner.run(evaluation_pipeline, extra_volumes=extra_volumes)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "utils.store_results(evaluation_pipeline.name, **shared_args, **indexing_args)" ] }, diff --git a/src/parameter_search.ipynb b/src/parameter_search.ipynb index a3202a7..e9db785 100644 --- a/src/parameter_search.ipynb +++ b/src/parameter_search.ipynb @@ -216,7 +216,7 @@ "import weaviate\n", "\n", "try:\n", - " local_weaviate_client = weaviate.Client(\"http://localhost:8080\")\n", + " local_weaviate_client = weaviate.Client(\"http://localhost:8081\")\n", " logging.info(\"Connected to Weaviate instance\")\n", "except weaviate.WeaviateStartUpError:\n", " logging.error(\"Cannot connect to weaviate instance, is it running?\")" @@ -324,7 +324,7 @@ "\n", "fixed_args = {\n", " \"base_path\":BASE_PATH,\n", - " \"weaviate_url\":f\"http://{host_ip}:8080\", # IP address \n", + " \"weaviate_url\":f\"http://{host_ip}:8081\", # IP address \n", "}\n", "fixed_index_args = {\n", " \"n_rows_to_load\":1000,\n", @@ -332,9 +332,9 @@ "fixed_eval_args = {\n", " \"csv_dataset_uri\":\"/data/wikitext_1000_q.csv\", #make sure it is the same as mounted file\n", " \"csv_separator\":\";\",\n", - " \"evaluation_module\": \"langchain.llms\",\n", - " \"evaluation_llm\":\"OpenAI\",\n", - " \"evaluation_llm_kwargs\":{\"openai_api_key\": \"\"}, #TODO Specify your key if you're using OpenAI\n", + " \"evaluation_module\": \"langchain.chat_models\",\n", + " \"evaluation_llm\": \"ChatOpenAI\",\n", + " \"evaluation_llm_kwargs\": {\"openai_api_key\": os.environ[\"OPENAI_KEY\"], \"model_name\" : \"gpt-3.5-turbo\"}, # TODO: Update with your key or use a different model\n", " \"evaluation_metrics\":[\"context_precision\", \"context_relevancy\"]\n", "}" ] diff --git a/src/pipeline.ipynb b/src/pipeline.ipynb index 87cd446..8b889c7 100644 --- a/src/pipeline.ipynb +++ b/src/pipeline.ipynb @@ -288,7 +288,8 @@ "source": [ "## Exploring the dataset\n", "\n", - "You can also explore the dataset using the fondant explorer, this enables you to visualize your output dataset at each component step. It might take a while to start the first time as it needs to download the explorer docker image first." + "You can also explore the dataset using the fondant explorer, this enables you to visualize your output dataset at each component step. It might take a while to start the first time as it needs to download the explorer docker image first. You can browse at \n", + "http://localhost:8501/" ] }, { diff --git a/src/pipeline_eval.py b/src/pipeline_eval.py index cf23ec1..5b7e2b6 100644 --- a/src/pipeline_eval.py +++ b/src/pipeline_eval.py @@ -6,8 +6,8 @@ def create_pipeline( *, + weaviate_url: str, base_path: str = "./data-dir", - weaviate_url="http://host.docker.internal:8080", weaviate_class: str = "Pipeline1", csv_dataset_uri: str = "/data/wikitext_1000_q.csv", csv_separator: str = ";", diff --git a/src/pipeline_index.py b/src/pipeline_index.py index de76060..8afad38 100644 --- a/src/pipeline_index.py +++ b/src/pipeline_index.py @@ -5,9 +5,9 @@ def create_pipeline( *, + weaviate_url: str, base_path: str = "./data-dir", n_rows_to_load: int = 1000, - weaviate_url: str = "http://host.docker.internal:8080", weaviate_class: str = "Pipeline1", weaviate_overwrite: bool = True, embed_model_provider: str = "huggingface",