|
126 | 126 | "system_message_prompt = SystemMessagePromptTemplate.from_template(template)\n", |
127 | 127 | "\n", |
128 | 128 | "human_template = \"{question}\"\n", |
129 | | - "human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)\n", |
130 | | - "\n", |
| 129 | + "human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)" |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "cell_type": "code", |
| 134 | + "execution_count": null, |
| 135 | + "id": "bbd06c94", |
| 136 | + "metadata": {}, |
| 137 | + "outputs": [], |
| 138 | + "source": [ |
131 | 139 | "chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt])" |
132 | 140 | ] |
133 | 141 | }, |
|
485 | 493 | "Let's create a `model_config` for our model:" |
486 | 494 | ] |
487 | 495 | }, |
| 496 | + { |
| 497 | + "cell_type": "code", |
| 498 | + "execution_count": null, |
| 499 | + "id": "1053c839", |
| 500 | + "metadata": {}, |
| 501 | + "outputs": [], |
| 502 | + "source": [ |
| 503 | + "# Useful variable that will also go into our config\n", |
| 504 | + "template = \"\"\"You are a helpful assistant who answers user's questions about Python.\n", |
| 505 | + "A user will pass in a question, and you should answer it very objectively.\n", |
| 506 | + "Use AT MOST 5 sentences. If you need more than 5 sentences to answer, say that the\n", |
| 507 | + "user should make their question more objective.\"\"\"" |
| 508 | + ] |
| 509 | + }, |
488 | 510 | { |
489 | 511 | "cell_type": "code", |
490 | 512 | "execution_count": null, |
|
498 | 520 | " \"modelType\": \"shell\",\n", |
499 | 521 | " \"prompt\": [ # Optionally log the prompt, following the same format as OpenAI\n", |
500 | 522 | " {\"role\": \"system\", \"content\": template}, \n", |
501 | | - " {\"role\": \"user\", \"content\": human_template}\n", |
| 523 | + " {\"role\": \"user\", \"content\": \"{question}\"}\n", |
502 | 524 | " ], \n", |
503 | 525 | " \"metadata\": { # Can add anything here, as long as it is a dict\n", |
504 | 526 | " \"output_parser\": None,\n", |
|
0 commit comments