Skip to content

Commit 543a7c2

Browse files
committed
Fixed broken API issues
1 parent 0fed39b commit 543a7c2

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

examples/go/snippets/tools/built-in-tools/google_search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func callAgent(ctx context.Context, a agent.Agent, prompt string) error {
6363

6464
// The r.Run method streams events and errors.
6565
// The loop iterates over the results, handling them as they arrive.
66-
for event, err := range r.Run(ctx, userID, sessionID, userMsg, &agent.RunConfig{
66+
for event, err := range r.Run(ctx, userID, sessionID, userMsg, agent.RunConfig{
6767
StreamingMode: agent.StreamingModeSSE,
6868
}) {
6969
if err != nil {

examples/go/snippets/tools/function-tools/func_tool.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"google.golang.org/adk/runner"
1313
"google.golang.org/adk/session"
1414
"google.golang.org/adk/tool"
15+
"google.golang.org/adk/tool/functiontool"
1516

1617
"google.golang.org/genai"
1718
)
@@ -20,7 +21,7 @@ import (
2021
// to simulate a real-world stock data API. This allows the example to
2122
// demonstrate tool functionality without making external network calls.
2223
var mockStockPrices = map[string]float64{
23-
"GOOG": 600.6,
24+
"GOOG": 300.6,
2425
"AAPL": 123.4,
2526
"MSFT": 234.5,
2627
}
@@ -57,8 +58,8 @@ func getStockPrice(ctx tool.Context, input getStockPriceArgs) getStockPriceResul
5758
// on how to respond to user queries about stock prices. It uses the
5859
// Gemini model to understand user intent and decide when to use its tools.
5960
func createStockAgent(ctx context.Context) (agent.Agent, error) {
60-
stockPriceTool, err := tool.NewFunctionTool(
61-
tool.FunctionToolConfig{
61+
stockPriceTool, err := functiontool.New(
62+
functiontool.Config{
6263
Name: "get_stock_price",
6364
Description: "Retrieves the current stock price for a given symbol.",
6465
},
@@ -129,7 +130,7 @@ func callAgent(ctx context.Context, a agent.Agent, prompt string) {
129130
Role: string(genai.RoleUser),
130131
}
131132

132-
for event, err := range r.Run(ctx, userID, sessionID, userMsg, &agent.RunConfig{
133+
for event, err := range r.Run(ctx, userID, sessionID, userMsg, agent.RunConfig{
133134
StreamingMode: agent.StreamingModeSSE,
134135
}) {
135136
if err != nil {

0 commit comments

Comments
 (0)