answer/pkg/agent/wolfram.go
Steve Dudenhoeffer 090b28d956 Update LLM integration and add new agent tools and utilities
Refactored LLM handling to use updated langchaingo models and tools, replacing gollm dependencies. Introduced agent-related utilities, tools, and counters for better modular functionality. Added a parser for LLM model configuration and revamped the answering mechanism with enhanced support for tool-based interaction.
2025-02-25 22:56:32 -05:00

29 lines
634 B
Go

package agent
import (
"fmt"
"os"
"github.com/Edw590/go-wolfram"
)
var WolframTool = FromFunction(
func(ctx *Context, args struct {
Query string `description:"what to ask wolfram alpha"`
}) (FuncResponse, error) {
var cl = wolfram.Client{
AppID: os.Getenv("WOLFRAM_APPID"),
}
unit := wolfram.Imperial
a, err := cl.GetShortAnswerQuery(args.Query, unit, 10)
if err != nil {
return FuncResponse{}, fmt.Errorf("failed to get short answer from wolfram: %w", err)
}
return FuncResponse{Result: a, Source: "Wolfram|Alpha"}, nil
}).
WithName("wolfram").
WithDescription("ask wolfram alpha for the answer")