package
0.1.0
Repository: https://github.com/zenmodel/zenmodel-contrib.git
Documentation: pkg.go.dev

# README

OpenAI Agent With Tools

Usage

  1. write main.go
import (
	"encoding/json"
	"fmt"
	"os"
	"testing"

	"github.com/sashabaranov/go-openai"
	"github.com/zenmodel/zenmodel-contrib/brain/openai_tool_agent"
	"github.com/zenmodel/zenmodel-contrib/tools"
)

func main() {
    // clone community shared brainprint, and set some tool cal definitions(support multi definitions)
	bp := openai_tool_agent.CloneBrainprint(tools.OpenWeatherToolCallDefinition())
	// build brain
	brain := bp.Build()
	// set memory and trig all entry links
	_ = brain.EntryWithMemory(
		"messages", []openai.ChatCompletionMessage{{Role: openai.ChatMessageRoleUser, Content: "What is the weather in Boston today?"}})

	// block process util brain sleeping
	brain.Wait()

    // get messages finally 
	messages, _ := json.Marshal(brain.GetMemory("messages"))
	fmt.Printf("messages: %s\n", messages)
}
  1. run it !
export OPENAI_API_KEY=chage_it
export OPEN_WEATHER_API_KEY=chage_it
go run main.go

# Functions

No description provided by the author

# Structs

No description provided by the author