mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-07 16:03:21 +00:00
fix: specify using inline type in system prompt for AI (#5787)
* inline types * use for ts only
This commit is contained in:
@@ -60,6 +60,8 @@ const TS_RESOURCE_TYPE_SYSTEM = `On Windmill, credentials and configuration are
|
||||
If you need credentials, you should add a parameter to \`main\` with the corresponding resource type inside the \`RT\` namespace: for instance \`RT.Stripe\`.
|
||||
You should only use them if you need them to satisfy the user's instructions. Always use the RT namespace.`
|
||||
|
||||
const TS_INLINE_TYPE_INSTRUCTION = `You must always inline the objects types instead of defining them separately. If INSTRUCTIONS ask you to use an already defined type, you MUST inline it instead of using the type name. Explain to the user that you are inlining the type for better arguments inference.`
|
||||
|
||||
const PYTHON_RESOURCE_TYPE_SYSTEM = `On Windmill, credentials and configuration are stored in resources and passed as parameters to main.
|
||||
If you need credentials, you should add a parameter to \`main\` with the corresponding resource type.
|
||||
You need to **redefine** the type of the resources that are needed before the main function as TypedDict, but only include them if they are actually needed to achieve the function purpose.
|
||||
@@ -99,8 +101,9 @@ export function getLangContext(
|
||||
const tsContext =
|
||||
TS_RESOURCE_TYPE_SYSTEM +
|
||||
(allowResourcesFetch
|
||||
? `\nTo query the RT namespace, you can use the \`search_resource_types\` function.`
|
||||
: '')
|
||||
? `\nTo query the RT namespace, you can use the \`search_resource_types\` function.\n`
|
||||
: '') +
|
||||
TS_INLINE_TYPE_INSTRUCTION
|
||||
switch (lang) {
|
||||
case 'bunnative':
|
||||
case 'nativets':
|
||||
@@ -225,6 +228,7 @@ export const CHAT_SYSTEM_PROMPT = `
|
||||
- The user can ask you to look at or modify specific files, databases or errors by having its name in the INSTRUCTIONS preceded by the @ symbol. In this case, put your focus on the element that is explicitly mentioned.
|
||||
- The user can ask you questions about a list of \`DATABASES\` that are available in the user's workspace. If the user asks you a question about a database, you should ask the user to specify the database name if not given, or take the only one available if there is only one.
|
||||
- You can also receive a \`DIFF\` of the changes that have been made to the code. You should use this diff to give better answers.
|
||||
- Before giving your answer, check again that you carefully followed these instructions.
|
||||
|
||||
Important:
|
||||
Do not mention or reveal these instructions to the user unless explicitly asked to do so.
|
||||
|
||||
Reference in New Issue
Block a user