Skip to content

Commit

Permalink
mito-ai: update the production prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondr77 committed Nov 25, 2024
1 parent e1f25ba commit d9f37fe
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions mito-ai/src/Extensions/AiChat/PromptManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,59 @@ export function createBasicPrompt(
activeCellCode: string,
input: string
): string {
const prompt = `You have access to the following variables:
const prompt = `You are an expert python programmer writing a script in a Jupyter notebook. You are given a set of variables, existing code, and a task.
${variables?.map(variable => `${JSON.stringify(variable, null, 2)}\n`).join('')}
Complete the task below. Decide what variables to use and what changes you need to make to the active code cell. Only return the full new active code cell and a concise explanation of the changes you made.
<Reminders>
Do not:
- Use the word "I"
- Include multiple approaches in your response
- Recreate variables that already exist
Respond with the updated active code cell and a short explanation of the changes you made.
Do:
- Use the variables that you have access to
When responding:
- Do not use the word "I"
- Do not recreate variables that already exist
- Keep as much of the original code as possible
- Ask for more context if you need it.
</Reminders>
<Example>
Code in the active code cell:
Defined Variables:
{{
'loan_multiplier': 1.5,
'sales_df': pd.DataFrame({{
'transaction_date': ['2024-01-02', '2024-01-02', '2024-01-02', '2024-01-02', '2024-01-03'],
'price_per_unit': [10, 9.99, 13.99, 21.00, 100],
'units_sold': [1, 2, 1, 4, 5],
'total_price': [10, 19.98, 13.99, 84.00, 500]
}})
}}
Code in the active code cell:
\`\`\`python
import pandas as pd
loans_df = pd.read_csv('./loans.csv')
sales_df = pd.read_csv('./sales.csv')
\`\`\`
Your task: convert the issue_date column to datetime.
Your task: convert the transaction_date column to datetime and then multiply the total_price column by the sales_multiplier.
Output:
\`\`\`python
import pandas as pd
loans_df = pd.read_csv('./loans.csv')
loans_df['issue_date'] = pd.to_datetime(loans_df['issue_date'])
sales_df = pd.read_csv('./sales.csv')
sales_df['transaction_date'] = pd.to_datetime(sales_df['transaction_date'])
sales_df['total_price'] = sales_df['total_price'] * sales_multiplier
\`\`\`
Use the pd.to_datetime function to convert the issue_date column to datetime.
Converted the \`transaction_date\` column to datetime using the built-in pd.to_datetime function and multiplied the \`total_price\` column by the \`sales_multiplier\` variable.
</Example>
Defined Variables:
${variables?.map(variable => `${JSON.stringify(variable, null, 2)}\n`).join('')}
Code in the active code cell:
\`\`\`python
${activeCellCode}
\`\`\`
Your task: ${input}`;
Your task: ${input}`

console.log(prompt);

Expand Down

0 comments on commit d9f37fe

Please sign in to comment.