mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
feat: add AI Querier module with custom output schema support and refactor common model calling logic
- Add new AI Querier module for structured information extraction from screenshots - Support custom output schema for structured data response - Implement automatic type conversion and data validation - Add comprehensive test suite with various data structure examples - Refactor callModelWithLogging to utils.go as shared function for planner, asserter, and querier - Eliminate code duplication across AI modules (30+ lines of repeated code) - Improve maintainability with unified logging and timing logic - Add environment variable checks in test setup to handle missing API keys gracefully Key features: - Custom output schema support with JSON Schema generation - Automatic data type conversion with reflection - Fallback mechanisms for robust parsing - Comprehensive documentation and usage examples - Backward compatibility with existing functionality
This commit is contained in:
@@ -29,7 +29,7 @@ func TestVLMPlanning(t *testing.T) {
|
||||
|
||||
userInstruction += "\n\n请基于以上游戏规则,给出下一步可点击的两个图标坐标"
|
||||
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250328)
|
||||
require.NoError(t, err)
|
||||
|
||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||
@@ -72,7 +72,7 @@ func TestXHSPlanning(t *testing.T) {
|
||||
|
||||
userInstruction := "点击第二个帖子的作者头像"
|
||||
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250328)
|
||||
require.NoError(t, err)
|
||||
|
||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||
@@ -115,7 +115,7 @@ func TestChatList(t *testing.T) {
|
||||
|
||||
userInstruction := "请结合图片的文字信息,请告诉我一共有多少个群聊,哪些群聊右下角有绿点"
|
||||
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250328)
|
||||
require.NoError(t, err)
|
||||
|
||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||
@@ -147,7 +147,7 @@ func TestChatList(t *testing.T) {
|
||||
|
||||
func TestHandleSwitch(t *testing.T) {
|
||||
userInstruction := "检查发送框下方的联网搜索开关,蓝色为开启状态,灰色为关闭状态;若开关处于关闭状态,则点击进行开启"
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250428)
|
||||
modelConfig, err := GetModelConfig(option.DOUBAO_1_5_UI_TARS_250328)
|
||||
require.NoError(t, err)
|
||||
|
||||
planner, err := NewPlanner(context.Background(), modelConfig)
|
||||
|
||||
Reference in New Issue
Block a user