Skip to content

Commit 134cb47

Browse files
feat: update Gemini 2.5 Pro model name (#13306)
Source link - https://cloud.google.com/vertex-ai/generative-ai/docs/models/gemini/2-5-pro
1 parent 2ed7720 commit 134cb47

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

genai/text_generation/thinking_textgen_with_txt.py

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,56 @@ def generate_content() -> str:
1919

2020
client = genai.Client()
2121
response = client.models.generate_content(
22-
model="gemini-2.5-pro-exp-03-25",
22+
model="gemini-2.5-pro-preview-03-25",
2323
contents="solve x^2 + 4x + 4 = 0",
2424
)
2525
print(response.text)
2626
# Example Response:
2727
# Okay, let's solve the quadratic equation x² + 4x + 4 = 0.
2828
#
29-
# There are a few ways to solve this:
29+
# We can solve this equation by factoring, using the quadratic formula, or by recognizing it as a perfect square trinomial.
3030
#
3131
# **Method 1: Factoring**
3232
#
33-
# 1. **Look for two numbers** that multiply to the constant term (4) and add up to the coefficient of the x term (4).
34-
# * The numbers are 2 and 2 (since 2 * 2 = 4 and 2 + 2 = 4).
35-
# 2. **Factor the quadratic** using these numbers:
33+
# 1. We need two numbers that multiply to the constant term (4) and add up to the coefficient of the x term (4).
34+
# 2. The numbers 2 and 2 satisfy these conditions: 2 * 2 = 4 and 2 + 2 = 4.
35+
# 3. So, we can factor the quadratic as:
3636
# (x + 2)(x + 2) = 0
37-
# This can also be written as:
37+
# or
3838
# (x + 2)² = 0
39-
# 3. **Set the factor equal to zero** and solve for x:
39+
# 4. For the product to be zero, the factor must be zero:
4040
# x + 2 = 0
41+
# 5. Solve for x:
4142
# x = -2
4243
#
43-
# This type of solution, where the factor is repeated, is called a repeated root or a root with multiplicity 2.
44+
# **Method 2: Quadratic Formula**
4445
#
45-
# **Method 2: Using the Quadratic Formula**
46+
# The quadratic formula for an equation ax² + bx + c = 0 is:
47+
# x = [-b ± sqrt(b² - 4ac)] / (2a)
4648
#
47-
# The quadratic formula solves for x in any equation of the form ax² + bx + c = 0:
48-
# x = [-b ± √(b² - 4ac)] / 2a
49-
#
50-
# 1. **Identify a, b, and c** in the equation x² + 4x + 4 = 0:
51-
# * a = 1
52-
# * b = 4
53-
# * c = 4
54-
# 2. **Substitute these values into the formula:**
55-
# x = [-4 ± √(4² - 4 * 1 * 4)] / (2 * 1)
56-
# 3. **Simplify:**
57-
# x = [-4 ± √(16 - 16)] / 2
58-
# x = [-4 ± √0] / 2
49+
# 1. In our equation x² + 4x + 4 = 0, we have a=1, b=4, and c=4.
50+
# 2. Substitute these values into the formula:
51+
# x = [-4 ± sqrt(4² - 4 * 1 * 4)] / (2 * 1)
52+
# x = [-4 ± sqrt(16 - 16)] / 2
53+
# x = [-4 ± sqrt(0)] / 2
5954
# x = [-4 ± 0] / 2
60-
# 4. **Calculate the result:**
6155
# x = -4 / 2
6256
# x = -2
6357
#
64-
# Both methods give the same solution.
58+
# **Method 3: Perfect Square Trinomial**
59+
#
60+
# 1. Notice that the expression x² + 4x + 4 fits the pattern of a perfect square trinomial: a² + 2ab + b², where a=x and b=2.
61+
# 2. We can rewrite the equation as:
62+
# (x + 2)² = 0
63+
# 3. Take the square root of both sides:
64+
# x + 2 = 0
65+
# 4. Solve for x:
66+
# x = -2
67+
#
68+
# All methods lead to the same solution.
6569
#
6670
# **Answer:**
67-
# The solution to the equation x² + 4x + 4 = 0 is **x = -2**.
71+
# The solution to the equation x² + 4x + 4 = 0 is x = -2. This is a repeated root (or a root with multiplicity 2).
6872
# [END googlegenaisdk_thinking_textgen_with_txt]
6973
return response.text
7074

0 commit comments

Comments
 (0)