From df3a1039f6891e5a6688dae13ab3eb653ec38448 Mon Sep 17 00:00:00 2001 From: Mira Date: Tue, 23 Jan 2024 11:36:11 +0100 Subject: [PATCH] add marvin settings to transfer openai api key --- backend/script_RAG.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/script_RAG.py b/backend/script_RAG.py index 502ba10..7b2db24 100644 --- a/backend/script_RAG.py +++ b/backend/script_RAG.py @@ -28,6 +28,7 @@ from llama_index.vector_stores.types import MetadataInfo, VectorStoreInfo from marvin import ai_model +from marvin import settings as marvin_settings from llama_index.bridge.pydantic import BaseModel as LlamaBaseModel from llama_index.bridge.pydantic import Field as LlamaField import pathlib @@ -37,6 +38,8 @@ from .document_categories import CATEGORY_LABELS +marvin_settings.openai.api_key = os.getenv("OPENAI_API_KEY") + class AITextDocument: """Loads and converts a text file into LlamaIndex nodes. @@ -351,7 +354,6 @@ def set_up_text_chatbot(): try: url = "https://medium.com/how-ai-built-this/zero-to-one-a-guide-to-building-a-first-pdf-chatbot-with-langchain-llamaindex-part-1-7d0e9c0d62f" - # "https://en.wikipedia.org/wiki/Sandor_Szondi" document = AIHtmlDocument(url, "gpt-3.5-turbo", callback_manager) chat_engine.add_document(document)