{ "cells": [ { "cell_type": "markdown", "id": "4eda7add", "metadata": {}, "source": [ "# Weaviate" ] }, { "cell_type": "markdown", "id": "4956326d", "metadata": {}, "source": [ "## Ühenduse loomine Weaviate serveriga" ] }, { "cell_type": "code", "execution_count": null, "id": "2dbe9e7a", "metadata": {}, "outputs": [], "source": [ "from weaviate_export_import_clean import WeaviateExportImport" ] }, { "cell_type": "code", "execution_count": null, "id": "ac2f77bf", "metadata": {}, "outputs": [], "source": [ "# Ühenduse loomine\n", "src_client = WeaviateExportImport.create_client(\"hetzner\", http_port=9020)" ] }, { "cell_type": "markdown", "id": "49994031", "metadata": {}, "source": [ "## Muud käsud" ] }, { "cell_type": "code", "execution_count": null, "id": "9201cb41", "metadata": {}, "outputs": [], "source": [ "# Kollektsioonide nimekiri\n", "src_client.collections.list_all()" ] }, { "cell_type": "code", "execution_count": null, "id": "93b0b0e8", "metadata": {}, "outputs": [], "source": [ "# Kustuta kollektsioon\n", "src_client.collections.delete(\"ScientificArticle\")\n" ] }, { "cell_type": "code", "execution_count": null, "id": "ac436417", "metadata": {}, "outputs": [], "source": [ "# Vektori vaatamine\n", "results = dst_client.collections.get(\"Article\").query.fetch_objects(\n", " limit=2,\n", " include_vector=True\n", ")\n", "\n", "print(results.objects[1].vector)" ] }, { "cell_type": "code", "execution_count": null, "id": "c3a7bbbb", "metadata": {}, "outputs": [], "source": [ "# Vektori vaatamine\n", "results_src = src_client.collections.get(\"Article\").query.fetch_objects(\n", " limit=1,\n", " include_vector=True\n", ")\n", "\n", "results_dst = dst_client.collections.get(\"Article\").query.fetch_objects(\n", " limit=1,\n", " include_vector=True\n", ")\n", "\n", "print(results_src)\n", "print(results_dst)" ] }, { "cell_type": "code", "execution_count": null, "id": "6ccfa014", "metadata": {}, "outputs": [], "source": [ "# Vektori vaatamine\n", "results_src = src_client.collections.get(\"DocIngest\").query.fetch_objects(\n", " limit=1,\n", " include_vector=True\n", ")\n", "\n", "results_dst = dst_client.collections.get(\"DocIngest\").query.fetch_objects(\n", " limit=1,\n", " include_vector=True\n", ")\n", "\n", "print(results_src)\n", "print(results_dst)" ] }, { "cell_type": "code", "execution_count": null, "id": "c36921eb", "metadata": {}, "outputs": [], "source": [ "schema = src_client.collections.get(\"Article\").config.get()\n", "print(schema)\n", "schema = dst_client.collections.get(\"Article\").config.get()\n", "print(schema)" ] }, { "cell_type": "markdown", "id": "86adec54", "metadata": {}, "source": [ "## Sulge ühendused" ] }, { "cell_type": "code", "execution_count": null, "id": "e654ae89", "metadata": {}, "outputs": [], "source": [ "wei.close_clients()" ] } ], "metadata": { "kernelspec": { "display_name": ".venv (3.10.12)", "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 }