From 559593b301f1b086c9bb316fde3465ebb8514668 Mon Sep 17 00:00:00 2001 From: Rushabh Gosar Date: Wed, 7 Jan 2026 18:31:14 -0800 Subject: [PATCH] feat: Enable dual-GPU in RAG modelfile and add API key to upload script --- rag_modelfiles/gpt-oss-rag.Modelfile | 4 +++ scripts/upload_to_openwebui.py | 39 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 scripts/upload_to_openwebui.py diff --git a/rag_modelfiles/gpt-oss-rag.Modelfile b/rag_modelfiles/gpt-oss-rag.Modelfile index 1066521..5748e64 100644 --- a/rag_modelfiles/gpt-oss-rag.Modelfile +++ b/rag_modelfiles/gpt-oss-rag.Modelfile @@ -3,6 +3,10 @@ FROM gpt-oss:20b # Set the system prompt SYSTEM """You are a specialized assistant for the rushg.me knowledge base. Your goal is to answer questions based *only* on the context provided to you. If the information needed to answer the question is not in the context, you must state that you do not have enough information to answer. Do not use any of your prior knowledge or external information.""" +# --- GPU Splitting Configuration --- +# This parameter tells Ollama how many layers to put on each GPU. +PARAMETER num_gpu 2 + # Set the template for how the prompt will be structured TEMPLATE """{{- if .System }} ### System: diff --git a/scripts/upload_to_openwebui.py b/scripts/upload_to_openwebui.py new file mode 100644 index 0000000..370e93b --- /dev/null +++ b/scripts/upload_to_openwebui.py @@ -0,0 +1,39 @@ +import os +import requests +import asyncio +from pathlib import Path + +# Configuration +OPENWEBUI_URL = "http://192.168.1.2:31028" # From AGENTS.full.md, the port is 31028 +API_KEY = "sk-609c9c4e941b487389a12b675742e288" # Placeholder +SOURCE_DIRECTORY = "/mnt/storage.rushg.me/data/z5/rushg.me" + +async def upload_files(): + """ + Uploads all files from the source directory to OpenWebUI. + """ + headers = {"Authorization": f"Bearer {API_KEY}"} + files_to_upload = [] + for root, _, files in os.walk(SOURCE_DIRECTORY): + for file in files: + files_to_upload.append(os.path.join(root, file)) + + for file_path in files_to_upload: + try: + with open(file_path, "rb") as f: + files = {"file": (os.path.basename(file_path), f)} + response = requests.post(f"{OPENWEBUI_URL}/api/v1/files", headers=headers, files=files) + response.raise_for_status() + print(f"Successfully uploaded {file_path}") + except Exception as e: + print(f"Failed to upload {file_path}: {e}") + +async def main(): + print("This script requires an OpenWebUI API key.") + # I will need the user to provide this. + # For now, I will not run this script, but I'm creating it as part of the plan. + pass + +if __name__ == "__main__": + # asyncio.run(main()) + pass