From 510e0e4994e9b7418ef297d2abe618a513a89c01 Mon Sep 17 00:00:00 2001 From: Tony Tran Date: Fri, 12 Jun 2026 22:19:53 +0700 Subject: [PATCH] manual edit rag_app --- .env | 14 +++++--------- rag_app.py | 14 +++++++++++++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 277d33a..c849bb8 100644 --- a/.env +++ b/.env @@ -1,14 +1,10 @@ # LLM API Configuration -# Get your API key from: -# - OpenAI: https://platform.openai.com/api-keys -# - Together.ai: https://api.together.xyz/settings/api-keys -# - Groq: https://console.groq.com/keys -# - Or any OpenAI-compatible API - -OPENAI_API_KEY=your_api_key_here +# Get your API key from https://platform.openai.com/api-keys +# Or use any OpenAI-compatible API (e.g., Together.ai, Groq, etc.) +OPENAI_API_KEY=sk-QHX7EZodq0EBuJyRX # Optional: Custom base URL for OpenAI-compatible APIs -# LLM_BASE_URL=https://api.openai.com/v1 +LLM_BASE_URL=http://192.168.88.5:8317/v1 # Optional: Model name (default: gpt-4o-mini) -# LLM_MODEL=gpt-4o-mini \ No newline at end of file +LLM_MODEL=gpt-5.4-mini \ No newline at end of file diff --git a/rag_app.py b/rag_app.py index b511bb2..0e721ec 100644 --- a/rag_app.py +++ b/rag_app.py @@ -281,8 +281,20 @@ def main(): print("ERROR: Set OPENAI_API_KEY or LLM_API_KEY in environment or .env file") print(" Or use --retrieve-only to test retrieval without LLM") return 1 + + llm_base_url = os.environ.get("LLM_BASE_URL") or args.llm_base_url + if not llm_base_url: + print("ERROR: Set LLM_BASE_URL or --llm_base_url in environment or .env file") + print(" Or use --retrieve-only to test retrieval without LLM") + return 1 + + llm_model = os.environ.get("LLM_MODEL") or args.llm_model + if not llm_model: + print("ERROR: Set LLM_MODEL or --llm_model in environment or .env file") + print(" Or use --retrieve-only to test retrieval without LLM") + return 1 - llm = LLMClient(api_key, args.llm_base_url, args.llm_model) + llm = LLMClient(api_key, llm_base_url, llm_model) pipeline = RAGPipeline(args.data_dir, args.index_dir, embedder, llm, args.top_k) if args.build: