pulkitme commited on
Commit
d9b21dc
·
1 Parent(s): 1452216

gemini 2 flash as first agent

Browse files
Files changed (2) hide show
  1. app.py +8 -13
  2. requirements.txt +1 -1
app.py CHANGED
@@ -4,9 +4,9 @@ import requests
4
  import inspect
5
  import pandas as pd
6
 
7
- from openai import OpenAI
8
 
9
- client = OpenAI(api_key=os.getenv("API_KEY"), base_url="https://api.deepseek.com")
10
  # (Keep Constants as is)
11
  # --- Constants ---
12
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
@@ -20,18 +20,13 @@ class BasicAgent:
20
  print(f"Agent received question (first 50 chars): {question[:50]}...")
21
 
22
 
23
- response = client.chat.completions.create(
24
- model="deepseek-chat",
25
- messages=[
26
- {"role": "system", "content": "You are a helpful assistant"},
27
- {"role": "user", "content": question},
28
- ],
29
- stream=False
30
- )
31
- deepseek_answer = response.choices[0].message.content
32
  #fixed_answer = "This is a default answer."
33
- print(f"Agent returning fixed answer: {deepseek_answer}")
34
- return deepseek_answer
35
 
36
  def run_and_submit_all( profile: gr.OAuthProfile | None):
37
  """
 
4
  import inspect
5
  import pandas as pd
6
 
7
+ from google import genai
8
 
9
+ client = genai.Client(api_key=os.getenv("API_KEY"))
10
  # (Keep Constants as is)
11
  # --- Constants ---
12
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
 
20
  print(f"Agent received question (first 50 chars): {question[:50]}...")
21
 
22
 
23
+ response = client.models.generate_content(
24
+ model="gemini-2.0-flash", contents=question
25
+ )
26
+ gemini_flash_answer = response.text
 
 
 
 
 
27
  #fixed_answer = "This is a default answer."
28
+ print(f"Agent returning fixed answer: {gemini_flash_answer}")
29
+ return gemini_flash_answer
30
 
31
  def run_and_submit_all( profile: gr.OAuthProfile | None):
32
  """
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  gradio
2
  requests
3
- openai
 
1
  gradio
2
  requests
3
+ google-genai