fahmiaziz98 commited on
Commit
0fb36b6
·
1 Parent(s): 1061354

change lunos to groq

Browse files
src/config/settings.py CHANGED
@@ -29,8 +29,8 @@ class Settings(BaseSettings):
29
 
30
  # LLM settings
31
  LUNOS_API_KEY: str
32
- LUNOS_BASE_URL: str = "https://api.lunos.tech/v1"
33
- DEFAULT_MODEL_NAME: str = "google/gemma-3-12b-it"
34
 
35
  # Gemini Image Generation settings
36
  GEMINI_API_KEY: str
@@ -77,4 +77,4 @@ class Settings(BaseSettings):
77
  def get_settings() -> Settings:
78
  return Settings()
79
 
80
- settings = get_settings()
 
29
 
30
  # LLM settings
31
  LUNOS_API_KEY: str
32
+ LUNOS_BASE_URL: str = "https://api.groq.com/openai/v1"
33
+ DEFAULT_MODEL_NAME: str = "llama-3.1-8b-instant"
34
 
35
  # Gemini Image Generation settings
36
  GEMINI_API_KEY: str
 
77
  def get_settings() -> Settings:
78
  return Settings()
79
 
80
+ settings = get_settings()
src/llm/openai_client.py CHANGED
@@ -22,7 +22,7 @@ class OpenAIClient(BaseLLMClient):
22
  self.model_name = model_name or settings.DEFAULT_MODEL_NAME
23
 
24
  if not self.api_key:
25
- raise ValueError("Lunos API key is required")
26
 
27
  self.client = AsyncOpenAI(
28
  api_key=self.api_key,
@@ -52,7 +52,7 @@ class OpenAIClient(BaseLLMClient):
52
  return response.choices[0].message.content.strip()
53
 
54
  except openai.APIError as e:
55
- raise Exception(f"Lunor API error: {str(e)}")
56
  except Exception as e:
57
  raise Exception(f"Text generation failed: {str(e)}")
58
 
@@ -83,7 +83,7 @@ class OpenAIClient(BaseLLMClient):
83
  if chunk.choices[0].delta.content:
84
  yield chunk.choices[0].delta.content
85
  except openai.APIError as e:
86
- raise Exception(f"Lunor API error: {str(e)}")
87
  except Exception as e:
88
  raise Exception(f"Text generation streaming failed: {str(e)}")
89
 
@@ -101,4 +101,4 @@ class OpenAIClient(BaseLLMClient):
101
  return False
102
 
103
  def generate_image(self):
104
- pass
 
22
  self.model_name = model_name or settings.DEFAULT_MODEL_NAME
23
 
24
  if not self.api_key:
25
+ raise ValueError("GROQ API key is required")
26
 
27
  self.client = AsyncOpenAI(
28
  api_key=self.api_key,
 
52
  return response.choices[0].message.content.strip()
53
 
54
  except openai.APIError as e:
55
+ raise Exception(f"Lunos API error: {str(e)}")
56
  except Exception as e:
57
  raise Exception(f"Text generation failed: {str(e)}")
58
 
 
83
  if chunk.choices[0].delta.content:
84
  yield chunk.choices[0].delta.content
85
  except openai.APIError as e:
86
+ raise Exception(f"Lunos API error: {str(e)}")
87
  except Exception as e:
88
  raise Exception(f"Text generation streaming failed: {str(e)}")
89
 
 
101
  return False
102
 
103
  def generate_image(self):
104
+ pass