-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9936b02
commit 18c8ccb
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package ai | ||
|
||
import ( | ||
_ "embed" | ||
"fmt" | ||
|
||
"github.com/liushuangls/go-anthropic/v2" | ||
"github.com/liushuangls/go-anthropic/v2/jsonschema" | ||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
type StaticConfig struct { | ||
Tools []struct { | ||
Name string `yaml:"name"` | ||
Type string `yaml:"type"` | ||
Description string `yaml:"description"` | ||
Result string `yaml:"result"` | ||
} `yaml:"tools"` | ||
} | ||
|
||
//go:embed static.yml | ||
var staticContent []byte | ||
|
||
func (ai *Ai) staticTools() ([]tool, error) { | ||
var config StaticConfig | ||
|
||
if err := yaml.Unmarshal(staticContent, &config); err != nil { | ||
return nil, fmt.Errorf("could not unmarshal StaticConfig content: %w", err) | ||
} | ||
|
||
tools := make([]tool, len(config.Tools)) | ||
for i, t := range config.Tools { | ||
fmt.Println(t.Result) | ||
tools[i] = tool{ | ||
Definition: anthropic.ToolDefinition{ | ||
Name: t.Name, | ||
Description: t.Description, | ||
InputSchema: jsonschema.Definition{ | ||
Type: jsonschema.Object, | ||
Properties: map[string]jsonschema.Definition{}, | ||
Required: []string{""}, | ||
}, | ||
}, | ||
Fn: func(_ string) (string, error) { | ||
return t.Result, nil | ||
}, | ||
} | ||
} | ||
|
||
return tools, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tools: | ||
- name: "special_beers" | ||
description: "Sometimes the pub offers limited special beer. Usually different brand or some local brewery" | ||
result: | | ||
Current special beers offer from 4.12.2024 to 8.12.2024: | ||
- Kozi Kabrón 12 - Starší z bratrů Kabrónů je dostupný pouze v čisté (filtrované) variantě. To z něj dělá jediné filtrované pivo v naší nabídce. Jde o tradiční český ležák, uvařený tradičním způsobem z tradičních surovin. Chutná špicově. | ||
- Hořký Kozi 11 - Příjemně hořký škopek, který se dá lámat jeden za druhým. Tohle pivo rozhodně nemůže soutěžit v kategorii tradiční český ležák. Vaříme jej sice tradičně, ale s podílem (pro ležák) netradičního žitného sladu. Přichmeleno francouzským chmelem. | ||
- Theodor Pilsner 11 - Ležák plzeňského typu. Pivo je vařeno podle tradičních receptur, podpořeno českými slady a chmely. Naše vlajková loď vám zpříjemní jakoukoli životní plavbu. | ||
type: "text" |