Documentation ¶
Index ¶
- Variables
- func NewMongoChatMemory(databaseURI, databaseName string) *mongo.Collection
- func NewStreamWriter() *_stream.StreamWriter
- func NewTool(name string, description string, ...) tools.BaseTool
- type AgentSynapse
- type ConvLLM
- type LLM
- type LLMArgs
- func (args *LLMArgs) AddAPIKey(apiKey []byte)
- func (args *LLMArgs) AddModelKwargs(maxTokens int, temperature float64, stream bool, stopSequences []string)
- func (args *LLMArgs) AddPromptKey(key string, value []byte)
- func (cargs *LLMArgs) NewConvLLM() (*ConvLLM, error)
- func (cargs *LLMArgs) NewLLM() (*LLM, error)
- func (cargs *LLMArgs) NewSuitedAgent() (*AgentSynapse, error)
- func (args *LLMArgs) SetChatInstruction(prompt []byte)
- func (args *LLMArgs) SetChatSystemInstruction(systemPrompt []byte)
- func (args *LLMArgs) SetModelType(key, value string)
- func (args *LLMArgs) SetMongoDBChatMemory(collection *mongo.Collection)
Constants ¶
This section is empty.
Variables ¶
var GoogleSearch = tools.GoogleTool
GoogleSearch is a premade tool provided by the framework from the tools package.
var ToolNodes = tools.ToolNodes
ToolNodes is a slice that holds all registered tools, allowing them to be accessed by their indices.
var ToolNodesMeta = tools.ToolNodesMeta
ToolNodesMeta is a variable that holds metadata for all registered tools. This is useful when you need to pass extra data to the logic of a tool from other systems
Functions ¶
func NewMongoChatMemory ¶ added in v0.0.4
func NewMongoChatMemory(databaseURI, databaseName string) *mongo.Collection
func NewStreamWriter ¶ added in v0.0.4
func NewStreamWriter() *_stream.StreamWriter
func NewTool ¶ added in v0.0.4
func NewTool(name string, description string, toolFunc func(string, string, map[string]interface{}) (string, []interface{}, error)) tools.BaseTool
NewTool creates a new instance of BaseTool with the specified name, description, and tool function. The tool function is a callback that takes a string and a slice of interfaces as input and returns a string and a slice of interfaces.
Example usage:
myTool := darksuitAI.NewTool("exampleTool", "This is an example tool", func(input string,string, data []interface{}) (string, []interface{},error) { // Your tool logic here return input, data, nil }) darksuitAI.ToolNodes = append(darksuitAI.ToolNodes,myTool) fmt.Printf("all tools created: %v",darksuitAI.ToolNodes) // to see all your tools
Types ¶
type AgentSynapse ¶ added in v0.0.4
type AgentSynapse struct {
// contains filtered or unexported fields
}
func (*AgentSynapse) Chat ¶ added in v0.0.4
func (a *AgentSynapse) Chat(input string) (string, any, error)
Chat processes the input query and returns the response. It optionally triggers a callback if verbose mode is enabled.
Parameters:
- input: The user's input query as a string.
- sessionId: A string representing the session identifier.
Returns:
- A string containing the response from the agent.
- An interface containing any additional tool data.
- An error if the execution fails.
type ConvLLM ¶
type ConvLLM struct {
// contains filtered or unexported fields
}
type LLM ¶
type LLM struct {
// contains filtered or unexported fields
}
type LLMArgs ¶ added in v0.0.4
DarkSuitAI is the main struct that users will interact with
func NewLLMArgs ¶ added in v0.0.4
func NewLLMArgs() *LLMArgs
NewLLMArgs creates a new LLMArgs with default values
func (*LLMArgs) AddAPIKey ¶ added in v0.0.4
AddAPIKey sets the API key for the LLMArgs instance.
This method allows you to securely store the API key required for authenticating requests to the chat model service.
Example:
args := darksuitAI.NewLLMArgs()
args.AddAPIKey([]byte("your-api-key"))
In this example, the byte slice containing the API key is set, enabling the chat model to authenticate and process requests.
func (*LLMArgs) AddModelKwargs ¶ added in v0.0.4
func (args *LLMArgs) AddModelKwargs(maxTokens int, temperature float64, stream bool, stopSequences []string)
AddModelKwargs adds a new set of model arguments to the ModelKwargs slice in LLMArgs.
This method allows you to specify various parameters for the model's behavior.
Example:
args := darksuitAI.NewLLMArgs()
args.AddModelKwargs(500, 0.8, true, []string{"Human:"})
In this example, the model arguments are set with a maximum of 1500 tokens, a temperature of 0.8, streaming enabled, and a stop sequence of "Human:".
func (*LLMArgs) AddPromptKey ¶ added in v0.0.4
AddPromptKey adds a key-value pair to the PromptKeys map in LLMArgs.
This method allows you to dynamically insert or update prompt-specific variables that can be used within the chat instruction template.
Example:
args := darksuitAI.NewLLMArgs()
args.AddPromptKey("year", []byte(`2024`))
args.AddPromptKey("month", []byte(`June`))
In this example, the keys "year" and "month" with their respective values "2024" and "June" are added to the PromptKeys map, which can then be referenced in the chat instruction template.
func (*LLMArgs) NewConvLLM ¶ added in v0.0.4
NewConvLLM creates a new instance of DarkSuitAI LLM
func (*LLMArgs) NewSuitedAgent ¶ added in v0.0.4
func (cargs *LLMArgs) NewSuitedAgent() (*AgentSynapse, error)
NewSuitedAgent creates a new instance of DarkSuitAI Agent
func (*LLMArgs) SetChatInstruction ¶ added in v0.0.4
SetChatInstruction sets the chat instruction in LLMArgs.
This method allows you to define the main instruction or prompt that will guide the chat model's responses.
Example:
args := darksuitAI.NewLLMArgs()
args.SetChatInstruction([]byte("Your chat instruction goes here"))
In this example, the byte slice containing the chat instruction is set, which will be used by the chat model to generate responses.
func (*LLMArgs) SetChatSystemInstruction ¶ added in v0.0.4
SetChatSystemInstruction sets the system-level instruction in LLMArgs.
This method allows you to define the overarching system prompt that will guide the chat model's behavior.
Example:
args := darksuitAI.NewLLMArgs()
args.SetChatSystemInstruction([]byte("Your system prompt goes here"))
In this example, the byte slice containing the system prompt is set, which will be used by the chat model to maintain context and behavior.
func (*LLMArgs) SetModelType ¶ added in v0.0.4
SetModelType sets a key-value pair in the ModelType map in LLMArgs.
This method allows you to specify the type of model to be used for the chat.
Example:
args := darksuitAI.NewLLMArgs()
args.SetModelType("openai", "gpt-4o")
In this example, the key "openai" with the value "gpt-4o" is added to the ModelType map, indicating the model type to be used.
func (*LLMArgs) SetMongoDBChatMemory ¶ added in v0.0.4
func (args *LLMArgs) SetMongoDBChatMemory(collection *mongo.Collection)
SetMongoDBChatMemory sets the MongoDB collection in LLMArgs.
This method allows you to set MongoDB that will be used for storing and retrieving chat-related data.
Example:
args := darksuitAI.NewLLMArgs()
args.SetMongoDBChatMemory(mongoCollection)
In this example, the MongoDB ChatMemory is set, which will be used for chat history operations.