test

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteSuite

func ExecuteSuite(suitesPath string) error

Types

type AgentTestRunner added in v1.19.0

type AgentTestRunner struct {
	*BaseRunner
	// contains filtered or unexported fields
}

AgentTestRunner handles the execution of agent-to-agent tests

func NewAgentTestRunner added in v1.19.0

func NewAgentTestRunner(environmentName, userID, apiKeyOverride, subdomainOverride string, logCollector *LogCollector) *AgentTestRunner

NewAgentTestRunner creates a new agent test runner

func (*AgentTestRunner) ExecuteAgentTest added in v1.19.0

func (atr *AgentTestRunner) ExecuteAgentTest(agentTest tests.AgentTest, newSessionPerTest bool) error

ExecuteAgentTest runs an agent-to-agent test

type BaseRunner added in v1.19.0

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

BaseRunner provides common functionality for both agent runners

func NewBaseRunner added in v1.19.0

func NewBaseRunner(environmentName, userID, apiKeyOverride, subdomainOverride string, logCollector *LogCollector) *BaseRunner

NewBaseRunner creates a new base runner with common functionality

func (*BaseRunner) AddLog added in v1.19.0

func (br *BaseRunner) AddLog(message string)

AddLog logs to both the log collector and the global logger for immediate visibility

func (*BaseRunner) AddToChatHistory added in v1.19.0

func (br *BaseRunner) AddToChatHistory(role, content string)

AddToChatHistory adds a message to the chat history

func (*BaseRunner) CallOpenAI added in v1.19.0

func (br *BaseRunner) CallOpenAI(messages []ChatMessage) (string, error)

CallOpenAI makes a request to the OpenAI API

func (*BaseRunner) ExtractMessage added in v1.19.0

func (br *BaseRunner) ExtractMessage(voiceflowResponse []interact.InteractionResponse) string

ExtractMessage extracts the message text from Voiceflow response

func (*BaseRunner) GetChatHistory added in v1.19.0

func (br *BaseRunner) GetChatHistory() []ChatMessage

GetChatHistory returns the current chat history

func (*BaseRunner) InteractWithVoiceflow added in v1.19.0

func (br *BaseRunner) InteractWithVoiceflow(messageType, message, environmentName, userID, apiKey string) ([]interact.InteractionResponse, error)

InteractWithVoiceflow sends a message to a Voiceflow Dialog Manager

func (*BaseRunner) IsGoalAchieved added in v1.19.0

func (br *BaseRunner) IsGoalAchieved(goal string) (bool, error)

IsGoalAchieved uses OpenAI to evaluate if the goal has been achieved

func (*BaseRunner) LogOpenAIConfig added in v1.19.0

func (br *BaseRunner) LogOpenAIConfig()

LogOpenAIConfig logs the OpenAI configuration being used

func (*BaseRunner) ProcessResponses added in v1.19.0

func (br *BaseRunner) ProcessResponses(responses []interact.InteractionResponse) []interact.InteractionResponse

ProcessResponses handles multiple responses by concatenating messages

func (*BaseRunner) SetOpenAIConfig added in v1.19.0

func (br *BaseRunner) SetOpenAIConfig(config *tests.OpenAIConfig)

SetOpenAIConfig sets the OpenAI configuration

type ChatMessage added in v1.19.0

type ChatMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

ChatMessage represents a message in the conversation history

type ExecuteSuiteResult added in v1.16.0

type ExecuteSuiteResult struct {
	Success bool
	Error   error
	Logs    []string
}

ExecuteSuiteResult holds the result of test suite execution including logs

func ExecuteFromHTTPRequest added in v1.16.0

func ExecuteFromHTTPRequest(suiteReq HTTPSuiteRequest) *ExecuteSuiteResult

ExecuteFromHTTPRequest executes a test suite directly from HTTP request data

type HTTPSuiteRequest added in v1.16.0

type HTTPSuiteRequest struct {
	Name               string              `json:"name"`
	Description        string              `json:"description"`
	EnvironmentName    string              `json:"environment_name"`
	NewSessionPerTest  bool                `json:"new_session_per_test,omitempty"` // Optional flag to create a new user session for each test (default: false)
	Tests              []HTTPTestRequest   `json:"tests"`
	ApiKey             string              `json:"api_key,omitempty"`             // Optional token to override global.VoiceflowAPIKey
	VoiceflowSubdomain string              `json:"voiceflow_subdomain,omitempty"` // Optional subdomain to override global.VoiceflowSubdomain
	OpenAIConfig       *tests.OpenAIConfig `json:"openAIConfig,omitempty"`        // Optional OpenAI configuration for agent tests
}

HTTPSuiteRequest represents a test suite from HTTP request

type HTTPTestRequest added in v1.16.0

type HTTPTestRequest struct {
	ID   string     `json:"id"`
	Test tests.Test `json:"test"`
}

HTTPTestRequest represents a test from HTTP request

type LogCollector added in v1.16.0

type LogCollector struct {
	Logs []string
}

LogCollector is used to collect logs during test execution

func (*LogCollector) AddLog added in v1.16.0

func (lc *LogCollector) AddLog(message string)

AddLog adds a log message to the collector

type VoiceflowAgentTestRunner added in v1.19.0

type VoiceflowAgentTestRunner struct {
	*BaseRunner
	// contains filtered or unexported fields
}

VoiceflowAgentTestRunner handles the execution of agent-to-agent tests using a Voiceflow agent as the tester

func NewVoiceflowAgentTestRunner added in v1.19.0

func NewVoiceflowAgentTestRunner(environmentName, userID, apiKeyOverride, subdomainOverride string, logCollector *LogCollector) *VoiceflowAgentTestRunner

NewVoiceflowAgentTestRunner creates a new Voiceflow agent test runner

func (*VoiceflowAgentTestRunner) ExecuteAgentTest added in v1.19.0

func (vatr *VoiceflowAgentTestRunner) ExecuteAgentTest(agentTest tests.AgentTest, newSessionPerTest bool) error

ExecuteAgentTest runs an agent-to-agent test using a Voiceflow agent as the tester

Jump to

Keyboard shortcuts

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