File size: 875 Bytes
738b789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from llama_index.core import PromptTemplate


instruction_str = """\

    1. Convert the query to executable Python code using Pandas.

    2. The final line of code should be a Python expression that can be called with the `eval()` function.

    3. The code should represent a solution to the query.

    4. PRINT ONLY THE EXPRESSION.

    5. Do not quote the expression."""

new_prompt = PromptTemplate(
    """\

    You are working with a pandas dataframe in Python.

    The name of the dataframe is `df`.

    This is the result of `print(df.head())`:

    {df_str}



    Follow these instructions:

    {instruction_str}

    Query: {query_str}



    Expression: """
)

context = """Purpose: The primary role of this agent is to assist users by providing accurate 

            information about world population statistics and details about a country. """