Skip to content

Commit 51bd3da

Browse files
authored
Merge branch 'main' into fix/reject-json-mime-function-calling
2 parents ce62996 + e6537de commit 51bd3da

31 files changed

Lines changed: 876 additions & 62 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.34.0"
2+
".": "2.0.0-beta.1"
33
}

.github/release-please-config.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3-
"last-release-sha": "88421f80a0b008e90f18401abca4ceec3548f6cd",
43
"packages": {
54
".": {
65
"release-type": "python",
7-
"versioning": "always-bump-minor",
86
"package-name": "google-adk",
97
"include-component-in-tag": false,
108
"skip-github-release": true,
@@ -57,5 +55,6 @@
5755
}
5856
]
5957
}
60-
}
58+
},
59+
"last-release-sha": "81a15a5229564c1448f79c75c0fc86218aebc1a2"
6160
}

contributing/samples/tools/parallel_functions/agent.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async def get_weather(city: str, tool_context: ToolContext) -> dict:
6060
if 'weather_requests' not in tool_context.state:
6161
tool_context.state['weather_requests'] = []
6262
tool_context.state['weather_requests'].append(
63-
{'city': city, 'timestamp': time.time(), 'result': result}
63+
{'city': city, 'result': result}
6464
)
6565

6666
return {
@@ -108,14 +108,12 @@ async def get_currency_rate(
108108
'from': from_currency,
109109
'to': to_currency,
110110
'rate': rate,
111-
'timestamp': time.time(),
112111
})
113112

114113
return {
115114
'from_currency': from_currency,
116115
'to_currency': to_currency,
117116
'exchange_rate': rate,
118-
'timestamp': time.time(),
119117
}
120118

121119

@@ -163,7 +161,6 @@ async def calculate_distance(
163161
'city1': city1,
164162
'city2': city2,
165163
'distance': distance,
166-
'timestamp': time.time(),
167164
})
168165

169166
return {
@@ -204,7 +201,7 @@ async def get_population(cities: List[str], tool_context: ToolContext) -> dict:
204201
if 'population_requests' not in tool_context.state:
205202
tool_context.state['population_requests'] = []
206203
tool_context.state['population_requests'].append(
207-
{'cities': cities, 'results': results, 'timestamp': time.time()}
204+
{'cities': cities, 'results': results}
208205
)
209206

210207
return {
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
{
2+
"events": [
3+
{
4+
"author": "user",
5+
"content": {
6+
"parts": [
7+
{
8+
"text": "Tell me about Paris and Sydney: weather, distance between them, and their populations."
9+
}
10+
],
11+
"role": "user"
12+
},
13+
"id": "e-1",
14+
"invocationId": "i-1",
15+
"nodeInfo": {
16+
"path": ""
17+
}
18+
},
19+
{
20+
"author": "parallel_function_test_agent",
21+
"content": {
22+
"parts": [
23+
{
24+
"functionCall": {
25+
"args": {
26+
"city": "Paris"
27+
},
28+
"id": "fc-1",
29+
"name": "get_weather"
30+
}
31+
},
32+
{
33+
"functionCall": {
34+
"args": {
35+
"city": "Sydney"
36+
},
37+
"id": "fc-2",
38+
"name": "get_weather"
39+
}
40+
},
41+
{
42+
"functionCall": {
43+
"args": {
44+
"city1": "Paris",
45+
"city2": "Sydney"
46+
},
47+
"id": "fc-3",
48+
"name": "calculate_distance"
49+
}
50+
},
51+
{
52+
"functionCall": {
53+
"args": {
54+
"cities": [
55+
"Paris",
56+
"Sydney"
57+
]
58+
},
59+
"id": "fc-4",
60+
"name": "get_population"
61+
}
62+
}
63+
],
64+
"role": "model"
65+
},
66+
"finishReason": "STOP",
67+
"id": "e-2",
68+
"invocationId": "i-1",
69+
"longRunningToolIds": [],
70+
"nodeInfo": {
71+
"path": "parallel_function_test_agent@1"
72+
}
73+
},
74+
{
75+
"actions": {
76+
"stateDelta": {
77+
"distance_requests": [
78+
{
79+
"city1": "Paris",
80+
"city2": "Sydney",
81+
"distance": 18903
82+
}
83+
],
84+
"population_requests": [
85+
{
86+
"cities": [
87+
"Paris",
88+
"Sydney"
89+
],
90+
"results": {
91+
"Paris": 2161000,
92+
"Sydney": 5312163
93+
}
94+
}
95+
],
96+
"weather_requests": [
97+
{
98+
"city": "Paris",
99+
"result": {
100+
"condition": "overcast",
101+
"humidity": 70,
102+
"temp": 58
103+
}
104+
},
105+
{
106+
"city": "Sydney",
107+
"result": {
108+
"condition": "sunny",
109+
"humidity": 60,
110+
"temp": 75
111+
}
112+
}
113+
]
114+
}
115+
},
116+
"author": "parallel_function_test_agent",
117+
"content": {
118+
"parts": [
119+
{
120+
"functionResponse": {
121+
"id": "fc-1",
122+
"name": "get_weather",
123+
"response": {
124+
"city": "Paris",
125+
"condition": "overcast",
126+
"humidity": 70,
127+
"temperature": 58
128+
}
129+
}
130+
},
131+
{
132+
"functionResponse": {
133+
"id": "fc-2",
134+
"name": "get_weather",
135+
"response": {
136+
"city": "Sydney",
137+
"condition": "sunny",
138+
"humidity": 60,
139+
"temperature": 75
140+
}
141+
}
142+
},
143+
{
144+
"functionResponse": {
145+
"id": "fc-3",
146+
"name": "calculate_distance",
147+
"response": {
148+
"city1": "Paris",
149+
"city2": "Sydney",
150+
"distance_km": 18903,
151+
"distance_miles": 11745
152+
}
153+
}
154+
},
155+
{
156+
"functionResponse": {
157+
"id": "fc-4",
158+
"name": "get_population",
159+
"response": {
160+
"cities_count": 2,
161+
"populations": {
162+
"Paris": 2161000,
163+
"Sydney": 5312163
164+
},
165+
"total_population": 7473163
166+
}
167+
}
168+
}
169+
],
170+
"role": "user"
171+
},
172+
"id": "e-3",
173+
"invocationId": "i-1",
174+
"nodeInfo": {
175+
"path": "parallel_function_test_agent@1"
176+
}
177+
},
178+
{
179+
"author": "parallel_function_test_agent",
180+
"content": {
181+
"parts": [
182+
{
183+
"text": "Here's the information about Paris and Sydney:\n\n**Paris:**\n* **Weather:** The current weather in Paris is overcast with a temperature of 58\u00b0F and 70% humidity.\n* **Population:** The population of Paris is 2,161,000.\n\n**Sydney:**\n* **Weather:** The current weather in Sydney is sunny with a temperature of 75\u00b0F and 60% humidity.\n* **Population:** The population of Sydney is 5,312,163.\n\n**Distance between Paris and Sydney:**\nThe distance between Paris and Sydney is 18,903 km (11,745 miles)."
184+
}
185+
],
186+
"role": "model"
187+
},
188+
"finishReason": "STOP",
189+
"id": "e-4",
190+
"invocationId": "i-1",
191+
"nodeInfo": {
192+
"path": "parallel_function_test_agent@1"
193+
}
194+
}
195+
]
196+
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"events": [
3+
{
4+
"author": "user",
5+
"content": {
6+
"parts": [
7+
{
8+
"text": "What is the weather in Tokyo and the exchange rate from USD to EUR?"
9+
}
10+
],
11+
"role": "user"
12+
},
13+
"id": "e-1",
14+
"invocationId": "i-1",
15+
"nodeInfo": {
16+
"path": ""
17+
}
18+
},
19+
{
20+
"author": "parallel_function_test_agent",
21+
"content": {
22+
"parts": [
23+
{
24+
"functionCall": {
25+
"args": {
26+
"city": "Tokyo"
27+
},
28+
"id": "fc-1",
29+
"name": "get_weather"
30+
}
31+
},
32+
{
33+
"functionCall": {
34+
"args": {
35+
"from_currency": "USD",
36+
"to_currency": "EUR"
37+
},
38+
"id": "fc-2",
39+
"name": "get_currency_rate"
40+
}
41+
}
42+
],
43+
"role": "model"
44+
},
45+
"finishReason": "STOP",
46+
"id": "e-2",
47+
"invocationId": "i-1",
48+
"longRunningToolIds": [],
49+
"nodeInfo": {
50+
"path": "parallel_function_test_agent@1"
51+
}
52+
},
53+
{
54+
"actions": {
55+
"stateDelta": {
56+
"currency_requests": [
57+
{
58+
"from": "USD",
59+
"rate": 0.85,
60+
"to": "EUR"
61+
}
62+
],
63+
"weather_requests": [
64+
{
65+
"city": "Tokyo",
66+
"result": {
67+
"condition": "rainy",
68+
"humidity": 90,
69+
"temp": 68
70+
}
71+
}
72+
]
73+
}
74+
},
75+
"author": "parallel_function_test_agent",
76+
"content": {
77+
"parts": [
78+
{
79+
"functionResponse": {
80+
"id": "fc-1",
81+
"name": "get_weather",
82+
"response": {
83+
"city": "Tokyo",
84+
"condition": "rainy",
85+
"humidity": 90,
86+
"temperature": 68
87+
}
88+
}
89+
},
90+
{
91+
"functionResponse": {
92+
"id": "fc-2",
93+
"name": "get_currency_rate",
94+
"response": {
95+
"exchange_rate": 0.85,
96+
"from_currency": "USD",
97+
"to_currency": "EUR"
98+
}
99+
}
100+
}
101+
],
102+
"role": "user"
103+
},
104+
"id": "e-3",
105+
"invocationId": "i-1",
106+
"nodeInfo": {
107+
"path": "parallel_function_test_agent@1"
108+
}
109+
},
110+
{
111+
"author": "parallel_function_test_agent",
112+
"content": {
113+
"parts": [
114+
{
115+
"text": "The weather in Tokyo is rainy with a temperature of 68 degrees Fahrenheit and 90% humidity. The exchange rate from USD to EUR is 0.85."
116+
}
117+
],
118+
"role": "model"
119+
},
120+
"finishReason": "STOP",
121+
"id": "e-4",
122+
"invocationId": "i-1",
123+
"nodeInfo": {
124+
"path": "parallel_function_test_agent@1"
125+
}
126+
}
127+
]
128+
}

0 commit comments

Comments
 (0)