Wosqa commited on
Commit
6c844a8
·
verified ·
1 Parent(s): 8a025d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,9 +4,9 @@ import gradio as gr
4
 
5
  # Get API key from environment variable
6
  API_KEY = os.environ.get("GROQ_API_KEY")
7
- API_URL = "https://api.groq.com/openai/v1/chat/completions"
8
 
9
- # Define a function to call the Groq API
10
  def query_groq(prompt):
11
  headers = {
12
  "Authorization": f"Bearer {API_KEY}",
@@ -18,7 +18,8 @@ def query_groq(prompt):
18
  "messages": [
19
  {"role": "system", "content": "You are an expert Programming Tutor."},
20
  {"role": "user", "content": prompt}
21
- ]
 
22
  }
23
 
24
  response = requests.post(API_URL, headers=headers, json=data)
 
4
 
5
  # Get API key from environment variable
6
  API_KEY = os.environ.get("GROQ_API_KEY")
7
+ API_URL = "https://api.groq.com/v1/chat/completions" # <-- FIXED
8
 
9
+ # Function to call GROQ API
10
  def query_groq(prompt):
11
  headers = {
12
  "Authorization": f"Bearer {API_KEY}",
 
18
  "messages": [
19
  {"role": "system", "content": "You are an expert Programming Tutor."},
20
  {"role": "user", "content": prompt}
21
+ ],
22
+ "temperature": 0.7
23
  }
24
 
25
  response = requests.post(API_URL, headers=headers, json=data)