asanwari commited on
Commit
7d13c6a
·
1 Parent(s): ec2fb9d

Fixes env variables.

Browse files
Files changed (2) hide show
  1. src/app.py +15 -3
  2. src/context_pilot_workflow.py +14 -2
src/app.py CHANGED
@@ -96,15 +96,27 @@ CONTEXT_STORE_PATH = Path(__file__).parent / ".context_store.json"
96
  # LLM Client for generating responses (more capable model)
97
  # RESPONSE_LLM: Used for generating actual responses (higher quality)
98
  # CONTEXT_LLM: Used for topic detection in workflow (cheaper, configured there)
99
- RESPONSE_LLM_MODEL = os.getenv("RESPONSE_LLM", os.getenv("NEBIUS_MODEL", "openai/gpt-4o"))
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
  # Threshold for summarizing responses before storing in context (in characters)
102
  # Responses longer than this will be summarized to reduce context size
103
  SUMMARIZE_THRESHOLD = int(os.getenv("SUMMARIZE_THRESHOLD", "500"))
104
 
105
  llm_client = OpenAI(
106
- api_key=os.getenv("NEBIUS_API_KEY"),
107
- base_url=os.getenv("NEBIUS_BASE_URL"),
108
  )
109
  LLM_MODEL = RESPONSE_LLM_MODEL
110
 
 
96
  # LLM Client for generating responses (more capable model)
97
  # RESPONSE_LLM: Used for generating actual responses (higher quality)
98
  # CONTEXT_LLM: Used for topic detection in workflow (cheaper, configured there)
99
+ RESPONSE_LLM_MODEL = os.getenv("RESPONSE_LLM", "openai/gpt-oss-120b")
100
+ NEBIUS_BASE_URL = os.getenv("NEBIUS_BASE_URL")
101
+ NEBIUS_API_KEY = os.getenv("NEBIUS_API_KEY")
102
+
103
+ # Validate required environment variables
104
+ if not NEBIUS_BASE_URL:
105
+ print("WARNING: NEBIUS_BASE_URL not set. Response generation will fail.")
106
+ if not NEBIUS_API_KEY:
107
+ print("WARNING: NEBIUS_API_KEY not set. Response generation will fail.")
108
+
109
+ print(f"[ContextPilot] Response LLM: {RESPONSE_LLM_MODEL}")
110
+ print(f"[ContextPilot] API Base: {NEBIUS_BASE_URL}")
111
+ print(f"[ContextPilot] API Key set: {bool(NEBIUS_API_KEY)}")
112
 
113
  # Threshold for summarizing responses before storing in context (in characters)
114
  # Responses longer than this will be summarized to reduce context size
115
  SUMMARIZE_THRESHOLD = int(os.getenv("SUMMARIZE_THRESHOLD", "500"))
116
 
117
  llm_client = OpenAI(
118
+ api_key=NEBIUS_API_KEY,
119
+ base_url=NEBIUS_BASE_URL,
120
  )
121
  LLM_MODEL = RESPONSE_LLM_MODEL
122
 
src/context_pilot_workflow.py CHANGED
@@ -419,11 +419,23 @@ CONTEXT_TOOLS = [
419
  # Use CONTEXT_LLM for topic detection (cheaper)
420
  # Use RESPONSE_LLM for generation (more capable) - configured in app.py
421
  CONTEXT_LLM_MODEL = os.getenv("CONTEXT_LLM", os.getenv("NEBIUS_MODEL", "openai/gpt-4o-mini"))
 
 
 
 
 
 
 
 
 
 
 
 
422
 
423
  topic_llm = OpenAILike(
424
  model=CONTEXT_LLM_MODEL,
425
- api_base=os.getenv("NEBIUS_BASE_URL"),
426
- api_key=os.getenv("NEBIUS_API_KEY"),
427
  is_chat_model=True,
428
  is_function_calling_model=True,
429
  context_window=128000,
 
419
  # Use CONTEXT_LLM for topic detection (cheaper)
420
  # Use RESPONSE_LLM for generation (more capable) - configured in app.py
421
  CONTEXT_LLM_MODEL = os.getenv("CONTEXT_LLM", os.getenv("NEBIUS_MODEL", "openai/gpt-4o-mini"))
422
+ NEBIUS_BASE_URL = os.getenv("NEBIUS_BASE_URL")
423
+ NEBIUS_API_KEY = os.getenv("NEBIUS_API_KEY")
424
+
425
+ # Validate required environment variables
426
+ if not NEBIUS_BASE_URL:
427
+ print("WARNING: NEBIUS_BASE_URL not set. Topic detection will fail.")
428
+ if not NEBIUS_API_KEY:
429
+ print("WARNING: NEBIUS_API_KEY not set. Topic detection will fail.")
430
+
431
+ print(f"[ContextPilot] Context LLM: {CONTEXT_LLM_MODEL}")
432
+ print(f"[ContextPilot] API Base: {NEBIUS_BASE_URL}")
433
+ print(f"[ContextPilot] API Key set: {bool(NEBIUS_API_KEY)}")
434
 
435
  topic_llm = OpenAILike(
436
  model=CONTEXT_LLM_MODEL,
437
+ api_base=NEBIUS_BASE_URL,
438
+ api_key=NEBIUS_API_KEY,
439
  is_chat_model=True,
440
  is_function_calling_model=True,
441
  context_window=128000,