other
- Location
scripts/py_mnn_kb.py:2985- Finding
Private knowledge-base content is transmitted to an external LLM by default
- Content
View full analysis
str: """Call OpenAI-compatible LLM API for RAG generation.""" try: import openai except ImportError: print("[LLM] openai package not installed. Install: pip install openai", file=sys.stderr) return "" base_url = cfg_llm.get("base_url", "http://localhost:11434/v1") api_key = cfg_llm.get("api_key", "none") model = cfg_llm.get("model", "qwen2.5:7b") max_tokens = cfg_llm.get("max_tokens", 2048) temperature = cfg_llm.get("temperature", 0.7) system_prompt = cfg_llm.get("system_prompt", "You are a helpful assistant. Answer the question based on the provided context.") client = openai.OpenAI(base_url=base_url, api_key=api_key) user_content = f"Context:\n{context}\n\nQuestion: {prompt}" print(f"[LLM] Calling {model} @ {base_url} ...", file=sys.stderr) print(f"[LLM] Context: {len(context)} chars, question: {len(prompt)} chars", file=sys.stderr) try: response = client.chat.completions.create( model=model, messages=[ {"role": "system", "content": system_prompt}, {"role": "user", "content": user_content} ], max_tokens=max_tokens, temperature=temperature, stream=True ) ``` The normal query path invokes this function unless the caller explicitly supplies `--no-llm`: ```python if args.no_llm: if args.output == "text": lines = [f"[Retrieved {doc_count} documents from KB '{kb_name}']"] for part in context.split("\n ...[truncated 4491 chars]- Remediation
View remediation
