{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Loading settings from ../../env/ai.json\n" ] } ], "source": [ "import os\n", "import json\n", "\n", "# If the file does not exist it'll default to the manual setting see below\n", "filePathToSettingsFile = '../../env/ai.json'\n", "\n", "# Is there a settings file? \n", "if os.path.exists(filePathToSettingsFile):\n", " # Yes there is so load settings from there\n", " \n", " print(f'Loading settings from {filePathToSettingsFile}')\n", " f = open(filePathToSettingsFile)\n", " settingsJson = json.load(f)\n", " del f\n", "\n", " for key in settingsJson:\n", " os.environ[key] = settingsJson[key]\n", " \n", " del settingsJson\n", "else: \n", " # Set variables manually\n", " \n", " print('Setting variables manually as there is not ai.json settings file')\n", "\n", " # Update the variables below with your own settings\n", " os.environ['REQUESTS_CA_BUNDLE'] = '../../env/ZCert.pem' \n", " os.environ['HUGGING_FACE_API_KEY'] = 'Get here: https://huggingface.co/settings/tokens'\n", " os.environ['OPENAI_API_KEY'] = 'Get here: https://platform.openai.com/account/api-keys'\n", " os.environ[\"SERPAPI_API_KEY\"] = 'serpapi KEY, Get here: https://serpapi.com/manage-api-key'\n", " os.environ[\"PINECONE_API_KEY\"] = 'serpapi KEY, Get here: https://app.pinecone.io/'\n", " os.environ[\"PINECONE_API_ENV\"] = 'serpapi KEY, Get here: https://app.pinecone.io/'" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from huggingface_hub import HfFileSystem\n", "fs = HfFileSystem()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0\n" ] } ], "source": [ "list = fs.glob(\"thrag/rag-demo-1/*\")\n", "print(len(list))" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "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.6" } }, "nbformat": 4, "nbformat_minor": 2 }