Compare commits
No commits in common. "5b338d4129dc3d6a2458d6aeefba9b7da099438e" and "bf16b4b0cd78424fc005930cea462b0402dc5f9b" have entirely different histories.
5b338d4129
...
bf16b4b0cd
1
go.mod
1
go.mod
@ -9,7 +9,6 @@ replace github.com/rocketlaunchr/google-search => github.com/chrisjoyce911/googl
|
|||||||
require (
|
require (
|
||||||
gitea.stevedudenhoeffer.com/steve/go-extractor v0.0.0-20250315044602-7c0e44a22f2c
|
gitea.stevedudenhoeffer.com/steve/go-extractor v0.0.0-20250315044602-7c0e44a22f2c
|
||||||
gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250317023858-7f5e34e437a7
|
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/advancedlogic/GoOse v0.0.0-20231203033844-ae6b36caf275
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/playwright-community/playwright-go v0.5001.0
|
github.com/playwright-community/playwright-go v0.5001.0
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Edw590/go-wolfram"
|
|
||||||
"go.starlark.net/lib/math"
|
"go.starlark.net/lib/math"
|
||||||
"go.starlark.net/starlark"
|
"go.starlark.net/starlark"
|
||||||
"go.starlark.net/syntax"
|
"go.starlark.net/syntax"
|
||||||
@ -65,10 +64,6 @@ type Options struct {
|
|||||||
// variety in the prompts, or passing in some useful contextually relevant information.
|
// variety in the prompts, or passing in some useful contextually relevant information.
|
||||||
// All of these will be used in addition to the SystemPrompt.
|
// All of these will be used in addition to the SystemPrompt.
|
||||||
ExtraSystemPrompts []string
|
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{
|
var DefaultOptions = Options{
|
||||||
@ -312,23 +307,14 @@ func (o Options) Answer(ctx context.Context, q Question) (Answers, error) {
|
|||||||
return args.Answer, nil
|
return args.Answer, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
var fnWolfram *gollm.Function
|
fnWolfram := gollm.NewFunction(
|
||||||
|
"wolfram",
|
||||||
if o.WolframAppID != "" {
|
"Search Wolfram Alpha for an answer to a question.",
|
||||||
fnWolfram = gollm.NewFunction(
|
func(ctx *gollm.Context, args struct {
|
||||||
"wolfram",
|
Question string `description:"the question to search for"`
|
||||||
"Search Wolfram Alpha for an answer to a question.",
|
}) (string, error) {
|
||||||
func(ctx *gollm.Context, args struct {
|
return "", nil
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fnCalculate := gollm.NewFunction(
|
fnCalculate := gollm.NewFunction(
|
||||||
"calculate",
|
"calculate",
|
||||||
@ -345,11 +331,7 @@ func (o Options) Answer(ctx context.Context, q Question) (Answers, error) {
|
|||||||
return v.String(), nil
|
return v.String(), nil
|
||||||
})
|
})
|
||||||
|
|
||||||
var funcs = []*gollm.Function{fnAnswer, fnCalculate}
|
var funcs = []*gollm.Function{fnAnswer, fnWolfram, fnCalculate}
|
||||||
|
|
||||||
if fnWolfram != nil {
|
|
||||||
funcs = append(funcs, fnWolfram)
|
|
||||||
}
|
|
||||||
|
|
||||||
if o.MaxSearches > 0 {
|
if o.MaxSearches > 0 {
|
||||||
funcs = append(funcs, fnSearch)
|
funcs = append(funcs, fnSearch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user