35 lines
913 B
Go
35 lines
913 B
Go
package tools
|
|
|
|
import (
|
|
"github.com/Edw590/go-wolfram"
|
|
|
|
gollm "gitea.stevedudenhoeffer.com/steve/go-llm"
|
|
)
|
|
|
|
type WolframFunctions struct {
|
|
Imperial *gollm.Function
|
|
Metric *gollm.Function
|
|
}
|
|
|
|
func CreateWolframFunctions(appId string) WolframFunctions {
|
|
client := &wolfram.Client{AppID: appId}
|
|
return WolframFunctions{
|
|
Imperial: gollm.NewFunction(
|
|
"wolfram",
|
|
"Query the Wolfram Alpha API",
|
|
func(ctx *gollm.Context, args struct {
|
|
Question string `description:"The question to ask Wolfram|Alpha"`
|
|
}) (any, error) {
|
|
return client.GetShortAnswerQuery(args.Question, wolfram.Imperial, 10)
|
|
}),
|
|
Metric: gollm.NewFunction(
|
|
"wolfram",
|
|
"Query the Wolfram Alpha API",
|
|
func(ctx *gollm.Context, args struct {
|
|
Question string `description:"The question to ask Wolfram|Alpha"`
|
|
}) (any, error) {
|
|
return client.GetShortAnswerQuery(args.Question, wolfram.Metric, 10)
|
|
}),
|
|
}
|
|
}
|