Enhance Assistant Configuration with RobotPrompt Support
- Added support for a new `RobotPrompt` field in the `Uses` struct to allow for custom robot system prompts. - Updated the `Load` function to initialize `RobotPrompt` with a default value if not provided. - Modified the `SystemConfig` struct to include a connector for the new `RobotPrompt` agent. - Enhanced the asset binding to include new files related to the `robot_prompt` assistant. - Updated related documentation and tests to reflect the addition of the `RobotPrompt` functionality.
This commit is contained in:
parent
add933d34c
commit
111fc28634
6 changed files with 352 additions and 191 deletions
|
|
@ -24,6 +24,7 @@ var systemAgents = []string{
|
|||
"querydsl",
|
||||
"title",
|
||||
"prompt",
|
||||
"robot_prompt",
|
||||
"needsearch",
|
||||
"entity",
|
||||
}
|
||||
|
|
@ -31,13 +32,14 @@ var systemAgents = []string{
|
|||
// SystemConfig holds the system agents connector configuration
|
||||
// This is set from agent.yml system block
|
||||
type SystemConfig struct {
|
||||
Default string // Default connector for all system agents
|
||||
Keyword string // Connector for __yao.keyword agent
|
||||
QueryDSL string // Connector for __yao.querydsl agent
|
||||
Title string // Connector for __yao.title agent
|
||||
Prompt string // Connector for __yao.prompt agent
|
||||
NeedSearch string // Connector for __yao.needsearch agent
|
||||
Entity string // Connector for __yao.entity agent
|
||||
Default string // Default connector for all system agents
|
||||
Keyword string // Connector for __yao.keyword agent
|
||||
QueryDSL string // Connector for __yao.querydsl agent
|
||||
Title string // Connector for __yao.title agent
|
||||
Prompt string // Connector for __yao.prompt agent
|
||||
RobotPrompt string // Connector for __yao.robot_prompt agent
|
||||
NeedSearch string // Connector for __yao.needsearch agent
|
||||
Entity string // Connector for __yao.entity agent
|
||||
}
|
||||
|
||||
// systemConfig holds the system agents configuration (global variable like others in load.go)
|
||||
|
|
@ -223,6 +225,10 @@ func resolveSystemConnector(agentID string) string {
|
|||
if systemConfig.Prompt != "" {
|
||||
return systemConfig.Prompt
|
||||
}
|
||||
case "__yao.robot_prompt":
|
||||
if systemConfig.RobotPrompt != "" {
|
||||
return systemConfig.RobotPrompt
|
||||
}
|
||||
case "__yao.needsearch":
|
||||
if systemConfig.NeedSearch != "" {
|
||||
return systemConfig.NeedSearch
|
||||
|
|
|
|||
|
|
@ -52,14 +52,19 @@ func Load(cfg config.Config) error {
|
|||
setting.Uses = &types.Uses{Default: "mohe"} // Agent is the developer name, Mohe is the brand name of the assistant
|
||||
}
|
||||
|
||||
// Title Assistant
|
||||
// Title Assistant (default to system agent)
|
||||
if setting.Uses.Title == "" {
|
||||
setting.Uses.Title = setting.Uses.Default
|
||||
setting.Uses.Title = "__yao.title"
|
||||
}
|
||||
|
||||
// Prompt Assistant
|
||||
// Prompt Assistant (default to system agent)
|
||||
if setting.Uses.Prompt == "" {
|
||||
setting.Uses.Prompt = setting.Uses.Default
|
||||
setting.Uses.Prompt = "__yao.prompt"
|
||||
}
|
||||
|
||||
// RobotPrompt Assistant (default to system agent)
|
||||
if setting.Uses.RobotPrompt == "" {
|
||||
setting.Uses.RobotPrompt = "__yao.robot_prompt"
|
||||
}
|
||||
|
||||
agentDSL = &setting
|
||||
|
|
|
|||
|
|
@ -40,13 +40,14 @@ type DSL struct {
|
|||
// Uses the default assistant settings
|
||||
// ===============================
|
||||
type Uses struct {
|
||||
Default string `json:"default,omitempty" yaml:"default,omitempty"` // The default assistant to use
|
||||
Title string `json:"title,omitempty" yaml:"title,omitempty"` // The assistant for generating the topic title.
|
||||
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"` // The assistant for generating the prompt.
|
||||
Vision string `json:"vision,omitempty" yaml:"vision,omitempty"` // The assistant for generating the image/video description, if the assistant enable the vision and model not support vision, use the vision model to describe the image/video, and return the messages with the image/video's description. Format: "agent" or "mcp:mcp_server_id"
|
||||
Audio string `json:"audio,omitempty" yaml:"audio,omitempty"` // The assistant for processing audio (speech-to-text, text-to-speech). If the model doesn't support audio, use this to convert audio to text. Format: "agent" or "mcp:mcp_server_id"
|
||||
Search string `json:"search,omitempty" yaml:"search,omitempty"` // The assistant for searching the knowledge, global web search. If not set, and the assistant enable the knowledge, it will search the result from the knowledge automatically.
|
||||
Fetch string `json:"fetch,omitempty" yaml:"fetch,omitempty"` // The assistant for fetching the http/https/ftp/sftp/etc. file, and return the file's content. if not set, use the http process to fetch the file.
|
||||
Default string `json:"default,omitempty" yaml:"default,omitempty"` // The default assistant to use
|
||||
Title string `json:"title,omitempty" yaml:"title,omitempty"` // The assistant for generating the topic title.
|
||||
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"` // The assistant for generating the prompt.
|
||||
RobotPrompt string `json:"robot_prompt,omitempty" yaml:"robot_prompt,omitempty"` // The assistant for generating Robot's system prompt (responsibilities description).
|
||||
Vision string `json:"vision,omitempty" yaml:"vision,omitempty"` // The assistant for generating the image/video description, if the assistant enable the vision and model not support vision, use the vision model to describe the image/video, and return the messages with the image/video's description. Format: "agent" or "mcp:mcp_server_id"
|
||||
Audio string `json:"audio,omitempty" yaml:"audio,omitempty"` // The assistant for processing audio (speech-to-text, text-to-speech). If the model doesn't support audio, use this to convert audio to text. Format: "agent" or "mcp:mcp_server_id"
|
||||
Search string `json:"search,omitempty" yaml:"search,omitempty"` // The assistant for searching the knowledge, global web search. If not set, and the assistant enable the knowledge, it will search the result from the knowledge automatically.
|
||||
Fetch string `json:"fetch,omitempty" yaml:"fetch,omitempty"` // The assistant for fetching the http/https/ftp/sftp/etc. file, and return the file's content. if not set, use the http process to fetch the file.
|
||||
|
||||
// Search-related processing tools (NLP)
|
||||
Web string `json:"web,omitempty" yaml:"web,omitempty"` // Web search handler: "builtin", "<assistant-id>", "mcp:<server>.<tool>"
|
||||
|
|
@ -58,13 +59,14 @@ type Uses struct {
|
|||
// System configures connectors for system agents
|
||||
// ===============================
|
||||
type System struct {
|
||||
Default string `json:"default,omitempty" yaml:"default,omitempty"` // Default connector for all system agents
|
||||
Keyword string `json:"keyword,omitempty" yaml:"keyword,omitempty"` // Connector for __yao.keyword agent
|
||||
QueryDSL string `json:"querydsl,omitempty" yaml:"querydsl,omitempty"` // Connector for __yao.querydsl agent
|
||||
Title string `json:"title,omitempty" yaml:"title,omitempty"` // Connector for __yao.title agent
|
||||
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"` // Connector for __yao.prompt agent
|
||||
NeedSearch string `json:"needsearch,omitempty" yaml:"needsearch,omitempty"` // Connector for __yao.needsearch agent
|
||||
Entity string `json:"entity,omitempty" yaml:"entity,omitempty"` // Connector for __yao.entity agent
|
||||
Default string `json:"default,omitempty" yaml:"default,omitempty"` // Default connector for all system agents
|
||||
Keyword string `json:"keyword,omitempty" yaml:"keyword,omitempty"` // Connector for __yao.keyword agent
|
||||
QueryDSL string `json:"querydsl,omitempty" yaml:"querydsl,omitempty"` // Connector for __yao.querydsl agent
|
||||
Title string `json:"title,omitempty" yaml:"title,omitempty"` // Connector for __yao.title agent
|
||||
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"` // Connector for __yao.prompt agent
|
||||
RobotPrompt string `json:"robot_prompt,omitempty" yaml:"robot_prompt,omitempty"` // Connector for __yao.robot_prompt agent
|
||||
NeedSearch string `json:"needsearch,omitempty" yaml:"needsearch,omitempty"` // Connector for __yao.needsearch agent
|
||||
Entity string `json:"entity,omitempty" yaml:"entity,omitempty"` // Connector for __yao.entity agent
|
||||
}
|
||||
|
||||
// Mention Structure
|
||||
|
|
|
|||
380
data/bindata.go
380
data/bindata.go
File diff suppressed because one or more lines are too long
9
yao/assistants/robot_prompt/package.yao
Normal file
9
yao/assistants/robot_prompt/package.yao
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Robot Prompt Generator",
|
||||
"description": "Generate system prompts for autonomous robots",
|
||||
"type": "worker",
|
||||
"uses": { "search": "disabled" },
|
||||
"options": {
|
||||
"temperature": 0.7
|
||||
}
|
||||
}
|
||||
91
yao/assistants/robot_prompt/prompts.yml
Normal file
91
yao/assistants/robot_prompt/prompts.yml
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
- role: system
|
||||
content: |
|
||||
You are an expert at crafting system prompts for autonomous AI robots (agents).
|
||||
|
||||
Task:
|
||||
Given a brief role description, generate a comprehensive system prompt that defines:
|
||||
1. Identity: Who the robot is
|
||||
2. Responsibilities: What the robot should do
|
||||
3. Constraints: Rules and limitations
|
||||
4. Style: Communication tone and approach
|
||||
|
||||
Output:
|
||||
- Return ONLY the system prompt text
|
||||
- NO markdown code blocks, NO quotes, NO explanation
|
||||
- Just the prompt content itself
|
||||
- Use the SAME LANGUAGE as the user's input
|
||||
|
||||
Structure (adapt based on role):
|
||||
```
|
||||
You are [role description].
|
||||
|
||||
## Core Responsibilities
|
||||
- [duty 1]
|
||||
- [duty 2]
|
||||
- [duty 3]
|
||||
|
||||
## Working Principles
|
||||
- [principle 1]
|
||||
- [principle 2]
|
||||
|
||||
## Constraints
|
||||
- [constraint 1]
|
||||
- [constraint 2]
|
||||
|
||||
## Communication Style
|
||||
- [style guideline]
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
Input: "Sales Analyst"
|
||||
Output:
|
||||
You are a Sales Analyst responsible for analyzing sales data and providing actionable insights.
|
||||
|
||||
## Core Responsibilities
|
||||
- Analyze daily/weekly/monthly sales trends
|
||||
- Identify top-performing products and regions
|
||||
- Generate sales forecast reports
|
||||
- Alert on significant anomalies or opportunities
|
||||
|
||||
## Working Principles
|
||||
- Always base conclusions on data, not assumptions
|
||||
- Prioritize actionable insights over raw statistics
|
||||
- Consider seasonal factors and market context
|
||||
|
||||
## Constraints
|
||||
- Only access authorized sales databases
|
||||
- Do not make pricing or strategy decisions
|
||||
- Escalate sensitive findings to management
|
||||
|
||||
## Communication Style
|
||||
- Clear, concise, business-focused language
|
||||
- Use charts and tables when presenting data
|
||||
- Lead with key findings, details follow
|
||||
|
||||
---
|
||||
|
||||
Input: "你是工程师"
|
||||
Output:
|
||||
你是一名专注于技术问题解决的工程师助手。
|
||||
|
||||
## 核心职责
|
||||
- 分析和诊断技术问题
|
||||
- 提供解决方案和最佳实践建议
|
||||
- 编写和审查代码
|
||||
- 监控系统健康状态
|
||||
|
||||
## 工作原则
|
||||
- 先理解问题根因,再提供解决方案
|
||||
- 优先考虑稳定性和可维护性
|
||||
- 遵循团队编码规范和架构标准
|
||||
|
||||
## 约束条件
|
||||
- 仅在授权范围内操作系统
|
||||
- 重大变更需人工确认
|
||||
- 不自行决定架构重构
|
||||
|
||||
## 沟通风格
|
||||
- 技术准确,表达简洁
|
||||
- 提供代码示例时注明语言和版本
|
||||
- 复杂概念配合示意图说明
|
||||
Loading…
Add table
Reference in a new issue