(ctx context.Context, args *DeveloperAgentArgs)
| 121 | } |
| 122 | |
| 123 | func (t *DeveloperAgent) userPrompt(ctx context.Context, args *DeveloperAgentArgs) (string, error) { |
| 124 | // Get default OLAP info |
| 125 | olapInfo, err := defaultOLAPInfo(ctx, t.Runtime, GetSession(ctx).InstanceID()) |
| 126 | if err != nil { |
| 127 | return "", err |
| 128 | } |
| 129 | |
| 130 | // Prepare template data. |
| 131 | session := GetSession(ctx) |
| 132 | data := map[string]any{ |
| 133 | "prompt": args.Prompt, |
| 134 | "init_project": args.InitProject, |
| 135 | "current_file_path": args.CurrentFilePath, |
| 136 | "ai_instructions": session.ProjectInstructions(), |
| 137 | "default_olap_info": olapInfo, |
| 138 | } |
| 139 | |
| 140 | // Generate the system prompt |
| 141 | return executeTemplate(` |
| 142 | {{ if .current_file_path }} |
| 143 | The user is currently viewing/editing the file: {{ .current_file_path }} |
| 144 | Their request may or may not relate to this file. |
| 145 | {{ end }} |
| 146 | |
| 147 | {{ if .init_project }} |
| 148 | The project is currently empty apart from a few boilerplate files (like rill.yaml). |
| 149 | You should help them set up their initial project based on their task description. |
| 150 | Ideally you should set up a full initial data source to dashboard journey. |
| 151 | If the user did not explicitly mention an initial data source, generate a model with mock data. |
| 152 | Feel free to change the default OLAP connector if it makes sense for the task. |
| 153 | {{ end }} |
| 154 | |
| 155 | {{ if .ai_instructions }} |
| 156 | The user has configured global additional instructions for you. They may not relate to the current request, and may not even relate to your work as a data engineer agent. Only use them if you find them relevant. They are: {{ .ai_instructions }} |
| 157 | {{ end }} |
| 158 | |
| 159 | For context, here are some details about the project's default OLAP connector: {{ .default_olap_info }}. |
| 160 | Note that you can only use it in model resources if it is not readonly. |
| 161 | |
| 162 | Task: {{ .prompt }} |
| 163 | `, data) |
| 164 | } |
| 165 | |
| 166 | // checkDeveloperAccess checks whether developer tools should be available in the current session. |
| 167 | // If internal is true, it indicates that the tool should not be exposed to external clients (like MCP). |
no test coverage detected