MCPcopy Create free account
hub / github.com/rilldata/rill / userPrompt

Method userPrompt

runtime/ai/developer_agent.go:123–164  ·  view source on GitHub ↗
(ctx context.Context, args *DeveloperAgentArgs)

Source from the content-addressed store, hash-verified

121}
122
123func (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 }}
143The user is currently viewing/editing the file: {{ .current_file_path }}
144Their request may or may not relate to this file.
145{{ end }}
146
147{{ if .init_project }}
148The project is currently empty apart from a few boilerplate files (like rill.yaml).
149You should help them set up their initial project based on their task description.
150Ideally you should set up a full initial data source to dashboard journey.
151If the user did not explicitly mention an initial data source, generate a model with mock data.
152Feel free to change the default OLAP connector if it makes sense for the task.
153{{ end }}
154
155{{ if .ai_instructions }}
156The 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
159For context, here are some details about the project's default OLAP connector: {{ .default_olap_info }}.
160Note that you can only use it in model resources if it is not readonly.
161
162Task: {{ .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).

Callers 1

HandlerMethod · 0.95

Calls 5

defaultOLAPInfoFunction · 0.85
GetSessionFunction · 0.85
InstanceIDMethod · 0.80
ProjectInstructionsMethod · 0.80
executeTemplateFunction · 0.70

Tested by

no test coverage detected