syntax fix
Browse files
generate_module_activities.png
ADDED
|
pipelines/generate_module_activities.py
CHANGED
|
@@ -53,10 +53,10 @@ pipeline.add_component("llm", instance=generator)
|
|
| 53 |
pipeline.connect("prompt_builder", "llm")
|
| 54 |
|
| 55 |
# Save the pipeline as a YAML file and generate a diagram
|
| 56 |
-
with open("./pipelines/
|
| 57 |
pipeline.dump(file)
|
| 58 |
|
| 59 |
-
pipeline.draw(path=Path("
|
| 60 |
|
| 61 |
# Function to generate content for all modules in the outline
|
| 62 |
def generate_content_for_outline(outline):
|
|
|
|
| 53 |
pipeline.connect("prompt_builder", "llm")
|
| 54 |
|
| 55 |
# Save the pipeline as a YAML file and generate a diagram
|
| 56 |
+
with open("./pipelines/generate_module_activities.yml", "w") as file:
|
| 57 |
pipeline.dump(file)
|
| 58 |
|
| 59 |
+
pipeline.draw(path=Path("generate_module_activities.png"))
|
| 60 |
|
| 61 |
# Function to generate content for all modules in the outline
|
| 62 |
def generate_content_for_outline(outline):
|
pipelines/generate_module_activities.yml
CHANGED
|
@@ -5,7 +5,7 @@ components:
|
|
| 5 |
model: meta-llama/Llama-3.2-3B-Instruct
|
| 6 |
api_type: serverless_inference_api
|
| 7 |
generation_kwargs:
|
| 8 |
-
max_new_tokens:
|
| 9 |
stop:
|
| 10 |
- <stop>
|
| 11 |
stop_sequences: []
|
|
@@ -19,19 +19,21 @@ components:
|
|
| 19 |
prompt_builder:
|
| 20 |
init_parameters:
|
| 21 |
required_variables: null
|
| 22 |
-
template: "\nYou are an instructional designer creating engaging
|
| 23 |
-
\ for training modules.\nYour
|
| 24 |
-
\
|
| 25 |
-
\
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
\
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
\
|
|
|
|
|
|
|
| 35 |
variables: null
|
| 36 |
type: haystack.components.builders.prompt_builder.PromptBuilder
|
| 37 |
connections:
|
|
|
|
| 5 |
model: meta-llama/Llama-3.2-3B-Instruct
|
| 6 |
api_type: serverless_inference_api
|
| 7 |
generation_kwargs:
|
| 8 |
+
max_new_tokens: 5000
|
| 9 |
stop:
|
| 10 |
- <stop>
|
| 11 |
stop_sequences: []
|
|
|
|
| 19 |
prompt_builder:
|
| 20 |
init_parameters:
|
| 21 |
required_variables: null
|
| 22 |
+
template: "\nYou are an instructional designer tasked with creating engaging\
|
| 23 |
+
\ and comprehensive content for training modules. \nYour goal is to generate\
|
| 24 |
+
\ detailed educational material that fully explains each sub module, ensuring\
|
| 25 |
+
\ that employees gain \na complete understanding of the subject matter.\n\n\
|
| 26 |
+
Task: Produce valid Markdown output containing the **content** for the following\
|
| 27 |
+
\ training module.\n\nModule Details:\n{{module}}\n\nInstructions:\n- Return\
|
| 28 |
+
\ only a Markdown document that follows the provided format (no extra text).\n\
|
| 29 |
+
- Do not include code fences or additional commentary.\n- Ensure that the\
|
| 30 |
+
\ content in each sub module is sufficiently detailed to properly educate\
|
| 31 |
+
\ an employee.\n\nExample Format:\n<start>\n## Content\n\n### Subtopic 1\n\
|
| 32 |
+
Detailed content explaining the topic comprehensively.\n\n### Subtopic 2\n\
|
| 33 |
+
In-depth explanation covering all necessary details.\n<stop>\n\n{% if invalid_replies\
|
| 34 |
+
\ and error_message %}\nYour previous Markdown output was invalid. Error:\
|
| 35 |
+
\ {{error_message}}. \nPlease return only valid Markdown, with no extra text,\
|
| 36 |
+
\ enclosed by <start> and <stop>.\n{% endif %}\n"
|
| 37 |
variables: null
|
| 38 |
type: haystack.components.builders.prompt_builder.PromptBuilder
|
| 39 |
connections:
|
pipelines/generate_module_content.py
CHANGED
|
@@ -3,7 +3,7 @@ from haystack.components.builders import PromptBuilder
|
|
| 3 |
from haystack.components.generators import HuggingFaceAPIGenerator
|
| 4 |
from haystack.utils import Secret
|
| 5 |
from components.json_grabber import JSONGrabber
|
| 6 |
-
from pathlib import Path
|
| 7 |
|
| 8 |
# Template for generating detailed module content
|
| 9 |
content_template = """
|
|
|
|
| 3 |
from haystack.components.generators import HuggingFaceAPIGenerator
|
| 4 |
from haystack.utils import Secret
|
| 5 |
from components.json_grabber import JSONGrabber
|
| 6 |
+
from pathlib import Path
|
| 7 |
|
| 8 |
# Template for generating detailed module content
|
| 9 |
content_template = """
|
pipelines/generate_module_content.yml
CHANGED
|
@@ -21,13 +21,13 @@ components:
|
|
| 21 |
required_variables: null
|
| 22 |
template: "\nYou are an instructional designer tasked with creating engaging\
|
| 23 |
\ and comprehensive content for training modules. \nYour goal is to generate\
|
| 24 |
-
\ detailed educational material that fully explains each sub
|
| 25 |
\ that employees gain \na complete understanding of the subject matter.\n\n\
|
| 26 |
Task: Produce valid Markdown output containing the **content** for the following\
|
| 27 |
\ training module.\n\nModule Details:\n{{module}}\n\nInstructions:\n- Return\
|
| 28 |
\ only a Markdown document that follows the provided format (no extra text).\n\
|
| 29 |
- Do not include code fences or additional commentary.\n- Ensure that the\
|
| 30 |
-
\ content in each sub
|
| 31 |
\ an employee.\n\nExample Format:\n<start>\n## Content\n\n### Subtopic 1\n\
|
| 32 |
Detailed content explaining the topic comprehensively.\n\n### Subtopic 2\n\
|
| 33 |
In-depth explanation covering all necessary details.\n<stop>\n\n{% if invalid_replies\
|
|
|
|
| 21 |
required_variables: null
|
| 22 |
template: "\nYou are an instructional designer tasked with creating engaging\
|
| 23 |
\ and comprehensive content for training modules. \nYour goal is to generate\
|
| 24 |
+
\ detailed educational material that fully explains each sub-module, ensuring\
|
| 25 |
\ that employees gain \na complete understanding of the subject matter.\n\n\
|
| 26 |
Task: Produce valid Markdown output containing the **content** for the following\
|
| 27 |
\ training module.\n\nModule Details:\n{{module}}\n\nInstructions:\n- Return\
|
| 28 |
\ only a Markdown document that follows the provided format (no extra text).\n\
|
| 29 |
- Do not include code fences or additional commentary.\n- Ensure that the\
|
| 30 |
+
\ content in each sub-module is sufficiently detailed to properly educate\
|
| 31 |
\ an employee.\n\nExample Format:\n<start>\n## Content\n\n### Subtopic 1\n\
|
| 32 |
Detailed content explaining the topic comprehensively.\n\n### Subtopic 2\n\
|
| 33 |
In-depth explanation covering all necessary details.\n<stop>\n\n{% if invalid_replies\
|