model

package
v1.3.3-0...-f31c912 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const InitialAIResponse = `Hey, I'm Teleport - a powerful tool that can assist you in managing your Teleport cluster via OpenAI GPT-4.`
View Source
const PromptSummarizeCommand = `` /* 227-byte string literal not displayed */
View Source
const PromptSummarizeTitle = `You will be given a message. Create a short summary of that message.
Respond only with summary, nothing else.`

Variables

This section is empty.

Functions

func ConversationCommandResult

func ConversationCommandResult(result map[string][]byte) string

func MessageClassificationPrompt

func MessageClassificationPrompt(classes map[string]string) string

func PromptCharacter

func PromptCharacter(username string) string

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent is a model storing static state which defines some properties of the chat model.

func NewAgent

func NewAgent(toolCtx *tools.ToolContext, tools ...tools.Tool) *Agent

NewAgent creates a new agent. The Assist agent which defines the model responsible for the Assist feature.

func (*Agent) DoAction

func (a *Agent) DoAction(ctx context.Context, llm *openai.Client, action *AgentAction) (any, *tokens.TokenCount, error)

func (*Agent) PlanAndExecute

func (a *Agent) PlanAndExecute(ctx context.Context, llm *openai.Client, chatHistory []openai.ChatCompletionMessage, humanMessage openai.ChatCompletionMessage, progressUpdates func(*AgentAction)) (any, *tokens.TokenCount, error)

PlanAndExecute runs the agent with a given input until it arrives at a text answer it is satisfied with or until it times out.

type AgentAction

type AgentAction struct {
	// The action to take, typically a tool name.
	Action string `json:"action"`

	// The input to the action, varies depending on the action.
	Input string `json:"input"`

	// The log is either a direct tool response or a thought prompt correlated to the input.
	Log string `json:"log"`

	// The reasoning is a string describing the reasoning behind the action.
	Reasoning string `json:"reasoning"`
}

AgentAction is an event type representing the decision to take a single action, typically a tool invocation.

type PlanOutput

type PlanOutput struct {
	Action      string `json:"action"`
	ActionInput any    `json:"action_input"`
	Reasoning   string `json:"reasoning"`
}

PlanOutput describes the expected JSON output after asking it to plan its next action.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL