Skip to content

Commit f669d8e

Browse files
committed
Be more specific about thoughts when thinking.
Signed-off-by: Katharine Berry <[email protected]>
1 parent d2d2861 commit f669d8e

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

service/assistant/functions/currency.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func convertCurrency(ctx context.Context, qt *quota.Tracker, input interface{})
106106
}
107107
}
108108

109-
func convertCurrencyThought(input interface{}) string {
110-
return "Checking rates..."
109+
func convertCurrencyThought(i interface{}) string {
110+
args := i.(*CurrencyConversionRequest)
111+
return fmt.Sprintf("Checking the %s/%s rate...", args.From, args.To)
111112
}

service/assistant/functions/poi.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"google.golang.org/genai"
2525
"log"
2626
"net/url"
27+
"strings"
2728
)
2829

2930
type POIQuery struct {
@@ -72,7 +73,12 @@ func init() {
7273
}
7374

7475
func searchPoiThought(args interface{}) string {
75-
return "Looking around..."
76+
poiQuery := args.(*POIQuery)
77+
if poiQuery.Location != "" {
78+
location, _, _ := strings.Cut(poiQuery.Location, ",")
79+
return fmt.Sprintf("Looking for %s near %s...", poiQuery.Query, location)
80+
}
81+
return fmt.Sprintf("Looking for %s nearby...", poiQuery.Query)
7682
}
7783

7884
func searchPoi(ctx context.Context, quotaTracker *quota.Tracker, args interface{}) interface{} {

service/assistant/functions/weather.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/pebble-dev/bobby-assistant/service/assistant/util/mapbox"
2424
"github.com/pebble-dev/bobby-assistant/service/assistant/util/weather"
2525
"google.golang.org/genai"
26+
"strings"
2627
)
2728

2829
type WeatherInput struct {
@@ -70,8 +71,22 @@ func init() {
7071
})
7172
}
7273

73-
func weatherThought(args interface{}) string {
74-
return "Checking the weather..."
74+
func weatherThought(i interface{}) string {
75+
args := i.(*WeatherInput)
76+
weatherType := "weather"
77+
switch args.Kind {
78+
case "forecast daily":
79+
weatherType = "daily forecast"
80+
case "forecast hourly":
81+
weatherType = "hourly forecast"
82+
case "current":
83+
weatherType = "weather"
84+
}
85+
if args.Location == "" || args.Location == "here" {
86+
return fmt.Sprintf("Checking the %s nearby...", weatherType)
87+
}
88+
placeName, _, _ := strings.Cut(args.Location, ",")
89+
return fmt.Sprintf("Checking the %s in %s...", weatherType, placeName)
7590
}
7691

7792
func getWeather(ctx context.Context, quotaTracker *quota.Tracker, args interface{}) interface{} {

service/assistant/functions/wikipedia.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ func init() {
8080
})
8181
}
8282

83-
func queryWikiThought(args interface{}) string {
84-
return "Looking it up..."
83+
func queryWikiThought(i interface{}) string {
84+
args := i.(*WikiRequest)
85+
if args.Query == "" {
86+
return "Looking it up..."
87+
}
88+
return fmt.Sprintf("Looking up %q...", args.Query)
8589
}
8690

8791
func queryWiki(ctx context.Context, quotaTracker *quota.Tracker, args interface{}) interface{} {

0 commit comments

Comments
 (0)