Spaces:
Sleeping
Sleeping
update page number to recieve zero
Browse files- document_generator_v3.py +5 -4
document_generator_v3.py
CHANGED
|
@@ -30,8 +30,8 @@ OUTPUT IN FOLLOWING JSON FORMAT enclosed in <output> tags
|
|
| 30 |
}
|
| 31 |
</output>"""
|
| 32 |
|
| 33 |
-
DOCUMENT_OUTLINE_PROMPT_USER = """Generate a document outline
|
| 34 |
-
|
| 35 |
DOCUMENT_SECTION_PROMPT_SYSTEM = """You are a document generator, replace the section/subsection prompts with the requested content.
|
| 36 |
OUTPUT AS A WELL FORMATED DOCUMENT ENCLOSED IN <response></response> tags
|
| 37 |
<overall_objective>{overall_objective}</overall_objective>
|
|
@@ -71,7 +71,7 @@ OUTPUT IN FOLLOWING JSON FORMAT enclosed in <output> tags
|
|
| 71 |
}
|
| 72 |
</output>"""
|
| 73 |
|
| 74 |
-
DOCUMENT_TEMPLATE_PROMPT_USER = """Generate a document template outline
|
| 75 |
|
| 76 |
DOCUMENT_TEMPLATE_SECTION_PROMPT_SYSTEM = """You are a document template generator, replace the section/subsection prompts with the requested content, Use placeholder text/examples/tables wherever required.
|
| 77 |
FORMAT YOUR OUTPUT AS A TEMPLATE ENCLOSED IN <response></response> tags
|
|
@@ -355,9 +355,10 @@ class DocumentGenerator:
|
|
| 355 |
|
| 356 |
@log_execution
|
| 357 |
def generate_document_outline(self, query: str, num_pages:int, template: bool = False, image_context: str = "", max_retries: int = 3) -> Optional[Dict]:
|
|
|
|
| 358 |
messages = [
|
| 359 |
{"role": "system", "content": DOCUMENT_OUTLINE_PROMPT_SYSTEM if not template else DOCUMENT_TEMPLATE_OUTLINE_PROMPT_SYSTEM},
|
| 360 |
-
{"role": "user", "content": DOCUMENT_OUTLINE_PROMPT_USER.format(query=query, num_pages=
|
| 361 |
]
|
| 362 |
# Update user content to include image context if provided
|
| 363 |
if image_context:
|
|
|
|
| 30 |
}
|
| 31 |
</output>"""
|
| 32 |
|
| 33 |
+
DOCUMENT_OUTLINE_PROMPT_USER = """Generate a document outline {num_pages}for the following query: <prompt>{query}</prompt>"""
|
| 34 |
+
|
| 35 |
DOCUMENT_SECTION_PROMPT_SYSTEM = """You are a document generator, replace the section/subsection prompts with the requested content.
|
| 36 |
OUTPUT AS A WELL FORMATED DOCUMENT ENCLOSED IN <response></response> tags
|
| 37 |
<overall_objective>{overall_objective}</overall_objective>
|
|
|
|
| 71 |
}
|
| 72 |
</output>"""
|
| 73 |
|
| 74 |
+
DOCUMENT_TEMPLATE_PROMPT_USER = """Generate a document template outline {num_pages} for the following query:<prompt>{query}</prompt>"""
|
| 75 |
|
| 76 |
DOCUMENT_TEMPLATE_SECTION_PROMPT_SYSTEM = """You are a document template generator, replace the section/subsection prompts with the requested content, Use placeholder text/examples/tables wherever required.
|
| 77 |
FORMAT YOUR OUTPUT AS A TEMPLATE ENCLOSED IN <response></response> tags
|
|
|
|
| 355 |
|
| 356 |
@log_execution
|
| 357 |
def generate_document_outline(self, query: str, num_pages:int, template: bool = False, image_context: str = "", max_retries: int = 3) -> Optional[Dict]:
|
| 358 |
+
pages_prompt = "" if num_pages == 0 else f"consisting of {num_pages} pages "
|
| 359 |
messages = [
|
| 360 |
{"role": "system", "content": DOCUMENT_OUTLINE_PROMPT_SYSTEM if not template else DOCUMENT_TEMPLATE_OUTLINE_PROMPT_SYSTEM},
|
| 361 |
+
{"role": "user", "content": DOCUMENT_OUTLINE_PROMPT_USER.format(query=query, num_pages=pages_prompt) if not template else DOCUMENT_TEMPLATE_PROMPT_USER.format(query=query, num_pages=pages_prompt)}
|
| 362 |
]
|
| 363 |
# Update user content to include image context if provided
|
| 364 |
if image_context:
|