Compare commits

..

No commits in common. "5b338d4129dc3d6a2458d6aeefba9b7da099438e" and "bf16b4b0cd78424fc005930cea462b0402dc5f9b" have entirely different histories.

2 changed files with 9 additions and 28 deletions

1
go.mod
View File

@ -9,7 +9,6 @@ replace github.com/rocketlaunchr/google-search => github.com/chrisjoyce911/googl
require (
gitea.stevedudenhoeffer.com/steve/go-extractor v0.0.0-20250315044602-7c0e44a22f2c
gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250317023858-7f5e34e437a7
github.com/Edw590/go-wolfram v0.0.0-20241010091529-fb9031908c5d
github.com/advancedlogic/GoOse v0.0.0-20231203033844-ae6b36caf275
github.com/joho/godotenv v1.5.1
github.com/playwright-community/playwright-go v0.5001.0

View File

@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"github.com/Edw590/go-wolfram"
"go.starlark.net/lib/math"
"go.starlark.net/starlark"
"go.starlark.net/syntax"
@ -65,10 +64,6 @@ type Options struct {
// variety in the prompts, or passing in some useful contextually relevant information.
// All of these will be used in addition to the SystemPrompt.
ExtraSystemPrompts []string
// WolframAppID is the Wolfram Alpha App ID to use when searching Wolfram Alpha for answers. If not set, the
// wolfram function will not be available.
WolframAppID string
}
var DefaultOptions = Options{
@ -312,23 +307,14 @@ func (o Options) Answer(ctx context.Context, q Question) (Answers, error) {
return args.Answer, nil
})
var fnWolfram *gollm.Function
if o.WolframAppID != "" {
fnWolfram = gollm.NewFunction(
fnWolfram := gollm.NewFunction(
"wolfram",
"Search Wolfram Alpha for an answer to a question.",
func(ctx *gollm.Context, args struct {
Question string `description:"the question to search for"`
}) (string, error) {
cl := wolfram.Client{
AppID: o.WolframAppID,
}
unit := wolfram.Imperial
return cl.GetShortAnswerQuery(args.Question, unit, 10)
return "", nil
})
}
fnCalculate := gollm.NewFunction(
"calculate",
@ -345,11 +331,7 @@ func (o Options) Answer(ctx context.Context, q Question) (Answers, error) {
return v.String(), nil
})
var funcs = []*gollm.Function{fnAnswer, fnCalculate}
if fnWolfram != nil {
funcs = append(funcs, fnWolfram)
}
var funcs = []*gollm.Function{fnAnswer, fnWolfram, fnCalculate}
if o.MaxSearches > 0 {
funcs = append(funcs, fnSearch)