Skip to content

Commit f53629b

Browse files
committed
feat(genai): update thinking model name
Add new model name.
1 parent ac56e1b commit f53629b

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

genai/text_generation/thinking_textgen_with_txt.py

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,55 @@
1616
def generate_content() -> str:
1717
# [START googlegenaisdk_thinking_textgen_with_txt]
1818
from google import genai
19-
from google.genai.types import HttpOptions
2019

21-
client = genai.Client(http_options=HttpOptions(api_version="v1"))
20+
client = genai.Client()
2221
response = client.models.generate_content(
23-
model="gemini-2.0-flash-thinking-exp-01-21",
22+
model="gemini-2.5-pro-exp-03-25",
2423
contents="solve x^2 + 4x + 4 = 0",
2524
)
2625
print(response.text)
27-
# Example response:
28-
# To solve the equation x^2 + 4x + 4 = 0, we can use several methods.
26+
# Example Response:
27+
# Okay, let's solve the quadratic equation x² + 4x + 4 = 0.
2928
#
30-
# **Method 1: Factoring**
29+
# There are a few ways to solve this:
3130
#
32-
# We look for two numbers that multiply to 4 (the constant term) and add to 4 (the coefficient of the x term).
33-
# These two numbers are 2 and 2 because 2 * 2 = 4 and 2 + 2 = 4.
34-
# Therefore, we can factor the quadratic expression as:
35-
# (x + 2)(x + 2) = 0
36-
# This can also be written as:
37-
# (x + 2)^2 = 0
31+
# **Method 1: Factoring**
3832
#
39-
# To solve for x, we set the factor (x + 2) equal to zero:
40-
# x + 2 = 0
41-
# Subtract 2 from both sides:
42-
# x = -2
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:
36+
# (x + 2)(x + 2) = 0
37+
# This can also be written as:
38+
# (x + 2)² = 0
39+
# 3. **Set the factor equal to zero** and solve for x:
40+
# x + 2 = 0
41+
# x = -2
4342
#
44-
# **Method 2: Quadratic Formula**
43+
# This type of solution, where the factor is repeated, is called a repeated root or a root with multiplicity 2.
4544
#
46-
# The quadratic formula for an equation of the form ax^2 + bx + c = 0 is given by:
47-
# x = [-b ± sqrt(b^2 - 4ac)] / (2a)
45+
# **Method 2: Using the Quadratic Formula**
4846
#
49-
# ...
47+
# The quadratic formula solves for x in any equation of the form ax² + bx + c = 0:
48+
# x = [-b ± √(b² - 4ac)] / 2a
5049
#
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
59+
# x = [-4 ± 0] / 2
60+
# 4. **Calculate the result:**
61+
# x = -4 / 2
62+
# x = -2
5163
#
52-
# All three methods yield the same solution, x = -2.
53-
# This is a repeated root, which is expected since the discriminant (b^2 - 4ac) is 0.
64+
# Both methods give the same solution.
5465
#
55-
# To check our solution, we substitute x = -2 back into the original equation:
56-
# (-2)^2 + 4(-2) + 4 = 4 - 8 + 4 = 0
57-
# The equation holds true, so our solution is correct.
58-
59-
# Final Answer: The final answer is $\boxed{-2}$
60-
66+
# **Answer:**
67+
# The solution to the equation x² + 4x + 4 = 0 is **x = -2**.
6168
# [END googlegenaisdk_thinking_textgen_with_txt]
6269
return response.text
6370

0 commit comments

Comments
 (0)