aki-008 commited on
Commit
6416677
·
1 Parent(s): 484478f

chore: fixed validation and used better model and api

Browse files
Backend/app/api/v1/endpoints/prompts.py CHANGED
@@ -23,7 +23,7 @@ GENERATION RULES
23
  REQUIRED JSON FORMAT FOR EACH QUESTION
24
  -----------------------
25
  {{
26
- "questions": "Which of the following CLI command can also be used to rename files?",
27
  "options": [
28
  "rm",
29
  "mv",
 
23
  REQUIRED JSON FORMAT FOR EACH QUESTION
24
  -----------------------
25
  {{
26
+ "question": "Which of the following CLI command can also be used to rename files?",
27
  "options": [
28
  "rm",
29
  "mv",
Backend/app/config.py CHANGED
@@ -16,7 +16,7 @@ class Settings(BaseSettings):
16
  chroma_port: int
17
  chroma_collection: str
18
 
19
- GEMINI_API_KEY:str
20
 
21
  class Config:
22
  env_file = ".env"
 
16
  chroma_port: int
17
  chroma_collection: str
18
 
19
+ GROQ_API_KEY:str
20
 
21
  class Config:
22
  env_file = ".env"
Backend/app/llm.py CHANGED
@@ -6,15 +6,15 @@ from app.schema.models import QuizOutput, QuizQuestion
6
  from app.config import settings
7
 
8
  client = OpenAI(
9
- base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
10
- api_key="AIzaSyAIZJOjjq87FDmW9sVoTuvPkwnmfFWtfNE",
11
  )
12
 
13
  async def call_llm(prompt:str):
14
  try:
15
  response = client.chat.completions.create(
16
  # CRUCIAL: Use the LiteLLM format: 'gemini/gemini-2.5-pro'
17
- model="models/gemini-2.0-flash",
18
  messages=[
19
  {"role": "user", "content": prompt}
20
  ],
 
6
  from app.config import settings
7
 
8
  client = OpenAI(
9
+ base_url="https://api.groq.com/openai/v1",
10
+ api_key=settings.GROQ_API_KEY
11
  )
12
 
13
  async def call_llm(prompt:str):
14
  try:
15
  response = client.chat.completions.create(
16
  # CRUCIAL: Use the LiteLLM format: 'gemini/gemini-2.5-pro'
17
+ model="openai/gpt-oss-20b",
18
  messages=[
19
  {"role": "user", "content": prompt}
20
  ],
Backend/app/schema/models.py CHANGED
@@ -54,11 +54,11 @@ class Quiz_input(BaseModel):
54
  # choice: Literal["mcq", "code"]
55
 
56
  class QuizQuestion(BaseModel):
57
- questions: str
58
- options: List[str] = Field(..., min_items=4, max_items=4)
59
- answer: str = Field(..., description="The correct answer key (e.g., 'a', 'b', 'c', or 'd')")
60
- explanation: str
61
- user_response: str = Field("", alias="User_response")
62
 
63
  class QuizOutput(BaseModel):
64
  quiz: List[QuizQuestion] = Field(..., description="A list of 10 generated MCQ questions.")
 
54
  # choice: Literal["mcq", "code"]
55
 
56
  class QuizQuestion(BaseModel):
57
+ question: str
58
+ options: List[str] = Field(..., min_items=2)
59
+ answer: str = Field(..., description="Correct answer key")
60
+ explanation: str
61
+ User_response: str = Field("", alias="User_response")
62
 
63
  class QuizOutput(BaseModel):
64
  quiz: List[QuizQuestion] = Field(..., description="A list of 10 generated MCQ questions.")