CartwrightAIproject commited on
Commit
08d0d9e
·
verified ·
1 Parent(s): a092bb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -11,10 +11,9 @@ if not API_KEY:
11
  # Configure the Gemini API with the key
12
  genai.configure(api_key=API_KEY)
13
 
14
- # Initialize the GenerativeModel with the google_search tool
15
  model = genai.GenerativeModel(
16
  model_name="gemini-1.5-flash-001",
17
- tools=[genai.Tool.from_google_search()],
18
  )
19
 
20
  def analyze_trend(industry: str) -> str:
@@ -32,9 +31,10 @@ def analyze_trend(industry: str) -> str:
32
  # Prompt for the Gemini model with a system instruction to get a good report
33
  prompt = f"Provide a detailed, insightful report on the top 5 emerging trends in the {industry} industry. Include a brief explanation for each trend, why it's important, and a prediction for its impact over the next 12 months."
34
 
35
- # Use the GenerativeModel to generate content with search grounding
36
  response = model.generate_content(
37
  prompt,
 
38
  # Stream the response for a better user experience
39
  stream=True
40
  )
 
11
  # Configure the Gemini API with the key
12
  genai.configure(api_key=API_KEY)
13
 
14
+ # Initialize the GenerativeModel without the tools parameter here
15
  model = genai.GenerativeModel(
16
  model_name="gemini-1.5-flash-001",
 
17
  )
18
 
19
  def analyze_trend(industry: str) -> str:
 
31
  # Prompt for the Gemini model with a system instruction to get a good report
32
  prompt = f"Provide a detailed, insightful report on the top 5 emerging trends in the {industry} industry. Include a brief explanation for each trend, why it's important, and a prediction for its impact over the next 12 months."
33
 
34
+ # Use the GenerativeModel to generate content, passing the tool directly to the method
35
  response = model.generate_content(
36
  prompt,
37
+ tools=['google_search'],
38
  # Stream the response for a better user experience
39
  stream=True
40
  )