ciyidogan commited on
Commit
db9dc05
Β·
verified Β·
1 Parent(s): dc672d9

Update llm_spark.py

Browse files
Files changed (1) hide show
  1. llm_spark.py +7 -7
llm_spark.py CHANGED
@@ -4,7 +4,7 @@ Spark LLM Implementation
4
  import httpx
5
  from typing import Dict, List, Any
6
  from llm_interface import LLMInterface
7
- from utils import log
8
 
9
  class SparkLLM(LLMInterface):
10
  """Spark LLM integration"""
@@ -14,7 +14,7 @@ class SparkLLM(LLMInterface):
14
  self.spark_endpoint = spark_endpoint.rstrip("/")
15
  self.spark_token = spark_token
16
  self.provider_variant = provider_variant
17
- log(f"πŸ”Œ SparkLLM initialized with endpoint: {self.spark_endpoint}")
18
 
19
  async def generate(self, system_prompt: str, user_input: str, context: List[Dict]) -> str:
20
  """Generate response from Spark LLM"""
@@ -49,10 +49,10 @@ class SparkLLM(LLMInterface):
49
  result = response.json()
50
  return result.get("model_answer", "")
51
  except httpx.TimeoutException:
52
- log("⏱️ Spark request timed out")
53
  raise
54
  except Exception as e:
55
- log(f"❌ Spark error: {e}")
56
  raise
57
 
58
  async def startup(self, project_config: Dict) -> bool:
@@ -71,7 +71,7 @@ class SparkLLM(LLMInterface):
71
  break
72
 
73
  if not version:
74
- log("❌ No published version found")
75
  return False
76
 
77
  llm_config = version.get("llm", {})
@@ -90,10 +90,10 @@ class SparkLLM(LLMInterface):
90
  headers=headers
91
  )
92
  response.raise_for_status()
93
- log("βœ… Spark startup successful")
94
  return True
95
  except Exception as e:
96
- log(f"❌ Spark startup failed: {e}")
97
  return False
98
 
99
  def get_provider_name(self) -> str:
 
4
  import httpx
5
  from typing import Dict, List, Any
6
  from llm_interface import LLMInterface
7
+ from logger import log_info, log_error, log_warning, log_debug
8
 
9
  class SparkLLM(LLMInterface):
10
  """Spark LLM integration"""
 
14
  self.spark_endpoint = spark_endpoint.rstrip("/")
15
  self.spark_token = spark_token
16
  self.provider_variant = provider_variant
17
+ log_info(f"πŸ”Œ SparkLLM initialized with endpoint: {self.spark_endpoint}")
18
 
19
  async def generate(self, system_prompt: str, user_input: str, context: List[Dict]) -> str:
20
  """Generate response from Spark LLM"""
 
49
  result = response.json()
50
  return result.get("model_answer", "")
51
  except httpx.TimeoutException:
52
+ log_warning("⏱️ Spark request timed out")
53
  raise
54
  except Exception as e:
55
+ log_error("❌ Spark error", e)
56
  raise
57
 
58
  async def startup(self, project_config: Dict) -> bool:
 
71
  break
72
 
73
  if not version:
74
+ log_info("❌ No published version found")
75
  return False
76
 
77
  llm_config = version.get("llm", {})
 
90
  headers=headers
91
  )
92
  response.raise_for_status()
93
+ log_info("βœ… Spark startup successful")
94
  return True
95
  except Exception as e:
96
+ log_error("❌ Spark startup failed", e)
97
  return False
98
 
99
  def get_provider_name(self) -> str: