{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "612c8bdb-83a8-4882-96a5-513ac7aedd7b", "metadata": {}, "outputs": [], "source": [ "import importlib\n", "import rag\n", "importlib.reload(rag)\n", "from rag import RAG\n", "from IPython.display import Markdown, display" ] }, { "cell_type": "code", "execution_count": null, "id": "98130049-a4de-4532-8454-3df1a13094e7", "metadata": {}, "outputs": [], "source": [ "llm_model_path = '/Users/peportier/llm/a/a/zephyr-7b-beta.Q5_K_M.gguf'\n", "embed_model_name = 'intfloat/multilingual-e5-large'\n", "collection_name = 'cera'\n", "chromadb_path = './chromadb'\n", "\n", "rag = RAG(llm_model_path, embed_model_name, collection_name, chromadb_path)" ] }, { "cell_type": "code", "execution_count": null, "id": "5d06fe9f-bb7e-41ec-b919-159dfa7d7e67", "metadata": {}, "outputs": [], "source": [ "query = \"Comment la Caisse d'Epargne Rhône-Alpes peut-elle aider une entreprise qui rencontre des problèmes de trésorerie ?\"\n", "ans = rag.chat(query)\n", "for item in ans:\n", " print(item, end='')" ] }, { "cell_type": "code", "execution_count": null, "id": "2f21824a-f859-4048-b745-365703a3749a", "metadata": {}, "outputs": [], "source": [ "query = \"J'aimerais en savoir plus au sujet de l'affacturage.\"\n", "ans = rag.chat(query)\n", "for item in ans:\n", " print(item, end='')" ] }, { "cell_type": "code", "execution_count": null, "id": "57fc4d50-2c12-49b3-9ee6-7d6bcf24a7ab", "metadata": {}, "outputs": [], "source": [ "rag.reset_history()\n", "query = \"Je souhaite rénover ma maison. Comment la Caisse d'Epargne Rhône-Alpes peut-elle m'aider ?\"\n", "ans = rag.chat(query)\n", "for item in ans:\n", " print(item, end='')" ] }, { "cell_type": "code", "execution_count": null, "id": "f6ad2117-ab49-4cb6-9a47-b70eb7fbfcc2", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "RAG_ENV", "language": "python", "name": "rag_env" }, "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.9.18" } }, "nbformat": 4, "nbformat_minor": 5 }