From 5b3145005a8e4fa0fd691754950d297f743948e3 Mon Sep 17 00:00:00 2001 From: Ismail Hossain Polas <ismailhossainpolash@gmail.com> Date: Sat, 6 Apr 2024 01:02:32 +0600 Subject: [PATCH] Update bagel ml (#4) (#12594) --- .../vector_stores/BagelAutoRetriever.ipynb | 35 +++++++++++-------- .../vector_stores/BagelIndexDemo.ipynb | 29 +++++---------- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/docs/docs/examples/vector_stores/BagelAutoRetriever.ipynb b/docs/docs/examples/vector_stores/BagelAutoRetriever.ipynb index 4fe4fc34c3..2e08736d0e 100644 --- a/docs/docs/examples/vector_stores/BagelAutoRetriever.ipynb +++ b/docs/docs/examples/vector_stores/BagelAutoRetriever.ipynb @@ -1,7 +1,6 @@ { "cells": [ { - "attachments": {}, "cell_type": "markdown", "id": "4e4f9a0f", "metadata": {}, @@ -18,7 +17,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "id": "15119a5b", "metadata": {}, @@ -33,17 +31,9 @@ "metadata": {}, "outputs": [], "source": [ - "%pip install llama-index-vector-stores-bagel" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "feb74914", - "metadata": {}, - "outputs": [], - "source": [ - "!pip install llama-index" + "%pip install llama-index-vector-stores-bagel\n", + "%pip install llama-index\n", + "%pip install bagelML" ] }, { @@ -77,6 +67,19 @@ "openai.api_key = os.environ[\"OPENAI_API_KEY\"]" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "465aef6e", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "\n", + "# Set environment variable\n", + "os.environ[\"BAGEL_API_KEY\"] = getpass.getpass(\"Bagel API Key:\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -101,7 +104,9 @@ "\n", "client = bagel.Client(server_settings)\n", "\n", - "collection = client.get_or_create_cluster(\"testing_embeddings\")" + "collection = client.get_or_create_cluster(\n", + " \"testing_embeddings_3\", embedding_model=\"custom\", dimension=1536\n", + ")" ] }, { @@ -249,7 +254,7 @@ "metadata": {}, "outputs": [], "source": [ - "retriever.retrieve(\"Tell me about two celebrities from United States\")" + "retriever.retrieve(\"celebrity\")" ] } ], diff --git a/docs/docs/examples/vector_stores/BagelIndexDemo.ipynb b/docs/docs/examples/vector_stores/BagelIndexDemo.ipynb index 1ffa0abb1c..0219f3eba4 100644 --- a/docs/docs/examples/vector_stores/BagelIndexDemo.ipynb +++ b/docs/docs/examples/vector_stores/BagelIndexDemo.ipynb @@ -1,7 +1,6 @@ { "cells": [ { - "attachments": {}, "cell_type": "markdown", "id": "e7057f38", "metadata": {}, @@ -14,9 +13,9 @@ "id": "f15a2a63", "metadata": {}, "source": [ - "# BagelDB\n", + "# Bagel Network\n", "\n", - ">[Bagel](https://docs.bageldb.ai/) is a Open Vector Database for AI. It is built for distributed Machine Learning compute. Cutting AI data infra spend by tenfold.\n", + ">[Bagel](https://docs.bageldb.ai/) is a Open Inference Data for AI. It is built for distributed Machine Learning compute. Cutting AI data infra spend by tenfold.\n", "\n", "<a href=\"https://discord.gg/bA7B6r97\" target=\"_blank\">\n", " <img src=\"https://img.shields.io/discord/1073293645303795742\" alt=\"Discord\">\n", @@ -32,7 +31,7 @@ "Install Bagel with:\n", "\n", "```sh\n", - "pip install betabageldb\n", + "pip install bagelML\n", "```\n", "\n", "\n", @@ -64,20 +63,9 @@ "metadata": {}, "outputs": [], "source": [ - "%pip install llama-index-vector-stores-bagel" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ac1840ac", - "metadata": {}, - "outputs": [], - "source": [ - "# !pip install llama-index --quiet\n", - "# !pip install betabageldb\n", - "# !pip install sentence-transformers\n", - "# !pip install pydantic==1.10.11" + "%pip install llama-index-vector-stores-bagel\n", + "%pip install llama-index-embeddings-huggingface\n", + "%pip install bagelML" ] }, { @@ -114,7 +102,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "id": "c4456726", "metadata": {}, @@ -149,7 +136,9 @@ "client = bagel.Client(server_settings)\n", "\n", "# create collection\n", - "collection = client.get_or_create_cluster(\"testing_embeddings\")\n", + "collection = client.get_or_create_cluster(\n", + " \"testing_embeddings\", embedding_model=\"custom\", dimension=384\n", + ")\n", "\n", "# define embedding function\n", "embed_model = \"local:BAAI/bge-small-en-v1.5\"\n", -- GitLab