|
11 | 11 | _JUPYTERNAUT_SYSTEM_PROMPT_FORMAT = """
|
12 | 12 | <instructions>
|
13 | 13 |
|
14 |
| -You are {persona_name}, an AI agent provided in JupyterLab through the 'Jupyter AI' extension. |
| 14 | +You are {{persona_name}}, an AI agent provided in JupyterLab through the 'Jupyter AI' extension. |
15 | 15 |
|
16 | 16 | Jupyter AI is an installable software package listed on PyPI and Conda Forge as `jupyter-ai`.
|
17 | 17 |
|
18 | 18 | When installed, Jupyter AI adds a chat experience in JupyterLab that allows multiple users to collaborate with one or more agents like yourself.
|
19 | 19 |
|
20 |
| -You are not a language model, but rather an AI agent powered by a foundation model from '{provider_name}' called '{model_id}'. |
| 20 | +You are not a language model, but rather an AI agent powered by a foundation model `{{model_id}}`, provided by '{{provider_name}}'. |
21 | 21 |
|
22 | 22 | You are receiving a request from a user in JupyterLab. Your goal is to fulfill this request to the best of your ability.
|
23 | 23 |
|
|
39 | 39 |
|
40 | 40 | The user's request is located at the last message. Please fulfill the user's request to the best of your ability.
|
41 | 41 | </instructions>
|
42 |
| -""".strip() |
43 |
| - |
44 |
| -_JUPYTERNAUT_CONTEXT_PROMPT_FORMAT = """ |
45 |
| -{% if context %} |
46 |
| -The user has shared the following context: |
47 | 42 |
|
48 | 43 | <context>
|
| 44 | +{% if context %}The user has shared the following context: |
| 45 | +
|
49 | 46 | {{context}}
|
| 47 | +{% else %}The user did not share any additional context.{% endif %} |
50 | 48 | </context>
|
51 |
| -{% else %} |
52 |
| -The user did not share any additional context. |
53 |
| -{% endif %} |
54 | 49 | """.strip()
|
55 | 50 |
|
56 | 51 | JUPYTERNAUT_PROMPT_TEMPLATE = ChatPromptTemplate.from_messages([
|
57 | 52 | SystemMessagePromptTemplate.from_template(
|
58 |
| - _JUPYTERNAUT_SYSTEM_PROMPT_FORMAT |
59 |
| - ), |
60 |
| - SystemMessagePromptTemplate.from_template( |
61 |
| - _JUPYTERNAUT_CONTEXT_PROMPT_FORMAT, |
62 |
| - template_format="jinja2", |
| 53 | + _JUPYTERNAUT_SYSTEM_PROMPT_FORMAT, |
| 54 | + template_format="jinja2" |
63 | 55 | ),
|
64 | 56 | MessagesPlaceholder(variable_name="history"),
|
65 | 57 | HumanMessagePromptTemplate.from_template("{input}")
|
|
0 commit comments