Spaces:
Building
Building
Update llm_openai.py
Browse files- llm_openai.py +4 -4
llm_openai.py
CHANGED
@@ -4,7 +4,7 @@ OpenAI GPT Implementation
|
|
4 |
from openai import AsyncOpenAI
|
5 |
from typing import Dict, List, Any
|
6 |
from llm_interface import LLMInterface
|
7 |
-
from
|
8 |
|
9 |
class OpenAILLM(LLMInterface):
|
10 |
"""OpenAI GPT integration (GPT-4o, GPT-4o-mini)"""
|
@@ -15,7 +15,7 @@ class OpenAILLM(LLMInterface):
|
|
15 |
self.model = self._map_model_name(model)
|
16 |
self.temperature = settings.get("temperature", 0.7) if settings else 0.7
|
17 |
self.max_tokens = settings.get("max_tokens", 1000) if settings else 1000
|
18 |
-
|
19 |
|
20 |
def _map_model_name(self, model: str) -> str:
|
21 |
"""Map provider name to actual model name"""
|
@@ -51,12 +51,12 @@ class OpenAILLM(LLMInterface):
|
|
51 |
|
52 |
return response.choices[0].message.content.strip()
|
53 |
except Exception as e:
|
54 |
-
|
55 |
raise
|
56 |
|
57 |
async def startup(self, project_config: Dict) -> bool:
|
58 |
"""GPT doesn't need startup, always return True"""
|
59 |
-
|
60 |
return True
|
61 |
|
62 |
def get_provider_name(self) -> str:
|
|
|
4 |
from openai import AsyncOpenAI
|
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 OpenAILLM(LLMInterface):
|
10 |
"""OpenAI GPT integration (GPT-4o, GPT-4o-mini)"""
|
|
|
15 |
self.model = self._map_model_name(model)
|
16 |
self.temperature = settings.get("temperature", 0.7) if settings else 0.7
|
17 |
self.max_tokens = settings.get("max_tokens", 1000) if settings else 1000
|
18 |
+
log_info(f"π€ Initialized OpenAI LLM with model: {self.model}")
|
19 |
|
20 |
def _map_model_name(self, model: str) -> str:
|
21 |
"""Map provider name to actual model name"""
|
|
|
51 |
|
52 |
return response.choices[0].message.content.strip()
|
53 |
except Exception as e:
|
54 |
+
log_error("β OpenAI error", e)
|
55 |
raise
|
56 |
|
57 |
async def startup(self, project_config: Dict) -> bool:
|
58 |
"""GPT doesn't need startup, always return True"""
|
59 |
+
log_info("β
GPT provider ready (no startup needed)")
|
60 |
return True
|
61 |
|
62 |
def get_provider_name(self) -> str:
|