Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f28e1ae
Update schema.py
ivichadriana Jul 21, 2025
d338798
Update schema.py
ivichadriana Jul 21, 2025
85c38c9
Update agent.py
ivichadriana Jul 21, 2025
5df55fe
Update agent.py
ivichadriana Jul 21, 2025
5d3edb0
Update schema.py
ivichadriana Jul 21, 2025
8d104c2
removed unused import
ivichadriana Jul 21, 2025
07f8125
added prompt to make fig supplemental if specified by user
ivichadriana Jul 21, 2025
f514c32
prompt now includes instructions for results section
ivichadriana Jul 21, 2025
cb7c7fe
updated introduction agent prompt to handle supplementary figures
ivichadriana Jul 21, 2025
ba0808e
typo, ) to "
ivichadriana Jul 21, 2025
7cf74f4
updated methods agent prompt to include supplemental
ivichadriana Jul 21, 2025
c627741
Update prompt.py to include supplemental for discussion
ivichadriana Jul 21, 2025
2ea522f
removed extra "
ivichadriana Jul 21, 2025
a4cf955
removed extra "
ivichadriana Jul 21, 2025
eab49fd
supplemental figure updating
ivichadriana Jul 21, 2025
86aff3e
added supplemental if there are any
ivichadriana Jul 21, 2025
ddc08c9
removed extra "
ivichadriana Jul 21, 2025
2d70986
updated reviewer to check supplemental
ivichadriana Jul 21, 2025
7884c97
Create test_supplemental_figures.py to test changes for supp. fig han…
ivichadriana Jul 21, 2025
e95c27a
changed test and README added quickstart
ivichadriana Jul 22, 2025
4de10c5
removed readme descritpion found somewhere else
ivichadriana Jul 22, 2025
e79fecd
made names of figures changeable and passed to text too
ivichadriana Jul 22, 2025
3584590
changed prompt variables to have 2 {{}} instead of {}
ivichadriana Jul 22, 2025
0f822a3
making names of figures be used by text genration
ivichadriana Jul 23, 2025
5dc316f
removing unused test for supp. figures (currently just using user's n…
ivichadriana Aug 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions frontend/src/components/AppArtifacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ const acceptFiles = async (files: any[]) => {
if (uploadedFileName.value === "") {
uploadedFileName.value = file.filename;
}

const name = uploadedFileName.value.trim() || file.filename
try {
const response = await uploadArtifact(props.session, file.filename, uploadContent, file.mimetype)
const response = await uploadArtifact(
props.session,
name,
uploadContent,
file.mimetype)

console.log("File uploaded successfully:", response);

Expand All @@ -94,7 +98,7 @@ const acceptFiles = async (files: any[]) => {

// add it to the list of artifacts
artifacts.value.push({
filename: `Figure ${desc.figure_number}`,
filename: name,
title: desc.title,
description: desc.description,
mimetype: file.mimetype,
Expand Down
Binary file added packages/.DS_Store
Binary file not shown.
Binary file added packages/manugen-ai/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def manuscript_assembler(callback_context: CallbackContext) -> Optional[types.Co

# then remove the instruction key from the state
callback_context.state[instructions_key] = ""

# ---------- Append Supplementary Figures section, if any ----------
if "supplementary_figures" in current_state and current_state["supplementary_figures"].strip():
manuscript_content += (
"\n# Supplementary Figures\n\n"
f"{current_state['supplementary_figures']}"
)
# ------------------------------------------------------------------

return types.Content(
parts=[types.Part(text=manuscript_content)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ async def _run_async_impl(
# simulate an event that there was a transfer of agent
yield self.get_transfer_to_agent_event(ctx, agent)

# remove "display_name" since adk does not support it
if last_user_input.inline_data is not None:
last_user_input.inline_data.display_name = None
# --- if the user gave a filename, inject it as a text part ---
if last_user_input.inline_data and last_user_input.inline_data.display_name:
from google.genai.types import Part
file_name = last_user_input.inline_data.display_name
# just inject the “Filename:” hint so the LLM sees it
ctx.user_content.parts.insert(
0,
Part(text=f"Filename: {file_name}")
)
# ------------------------------------------------------------------

# call agent
async for event in agent.run_async(ctx):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
deal with these weaknesses. The fifth paragraph may then culminate in a
description of how the paper moves the field forward. Step by step, the reader
thus learns to put the paper’s conclusions into the right context.

* When referring to data presented in supplementary figures (i.e., those figures with
the words Supp., Supplemental, S, etc.), cite them with the format the user used,
for example “Figure S1” is Figure S1, "Supplemental Figure 1" is Suplemental Figure 1, etc.
```

# Output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,21 @@ def process_figure_response(
# get current state
state = callback_context.state

# get agent description about figure
figure_desc = llm_response.content.parts[0].text
figure_desc_obj = SingleFigureDescription.model_validate_json(figure_desc)

# parse the LLM’s JSON into our Pydantic model
raw = llm_response.content.parts[0].text
figure_desc_obj = SingleFigureDescription.model_validate_json(raw)

# locate the uploaded‐file part anywhere in user_content.parts
incoming = None
for part in callback_context._invocation_context.user_content.parts:
if getattr(part, "inline_data", None) is not None:
incoming = part.inline_data
break

# if the user gave a filename, stash it and override figure title
if incoming and getattr(incoming, "display_name", None):
callback_context.state["current_display_name"] = incoming.display_name
figure_desc_obj.title = incoming.display_name
# compute figure number
current_figure_id = 1
if FIGURES_KEY in state:
Expand Down Expand Up @@ -75,16 +86,20 @@ def update_figure_state(

current_figure = state[CURRENT_FIGURE_KEY]
current_figure_obj = SingleFigureDescription.model_validate(current_figure)
# load or initialize the figures dict, then store it back on state
current_figure_state = state.get(FIGURES_KEY, {})
state[FIGURES_KEY] = current_figure_state

if FIGURES_KEY not in state:
state[FIGURES_KEY] = {}

current_figure_state = state[FIGURES_KEY]
current_figure_state[current_figure_obj.figure_number] = {
k: v for k, v in current_figure_obj.model_dump().items() if k != "figure_number"
entry = {
k: v
for k, v in current_figure_obj.model_dump().items()
if k != "figure_number"
}

state[FIGURES_KEY] = current_figure_state
# preserve any user‑provided filename exactly
display_label = state.get("current_display_name", None)
if display_label is not None:
entry["display_name"] = display_label
current_figure_state[current_figure_obj.figure_number] = entry

state[CURRENT_FIGURE_KEY] = ""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Prompt for the abstract_agent"""
"""Prompt for the figure agent"""

import json

Expand All @@ -13,6 +13,9 @@
* Analyze the figure in the context of a scientific paper.
* Generate an in-depth description of the figure. If you need to add formatting to
the description, use Markdown.
* If the figure’s name (title or file name) contains “Supp.“, “supp.“, “Supplemental“,
“supplemental“, “Supplementary“, "S", or any clear variant indicating it is a supplementary figure,
then set "figure_type": "supplemental"; otherwise leave it as "main".
* Generate a short title for the figure. If you need to add formatting to the title,
use Markdown.
* Respond ONLY with a JSON object matching this schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
the following ways: it does not need to present the context (which has just been
given), it is somewhat more specific about the results, and it only briefly
previews the conclusion of the paper, if at all.

* When referring to data presented in supplementary figures (i.e., those figures with
the words Supp., Supplemental, S, etc.), cite them with the format the user used,
for example “Figure S1” is Figure S1, "Supplemental Figure 1" is Suplemental Figure 1, etc.
```

# Output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
give exact volumes, times, and temperatures. Clarity: avoid jargon; define any
uncommon abbreviation at first use. Self-contained: every reagent or piece of
equipment needed to reproduce should be listed here or in a table.

* When referring to data presented in supplementary figures (i.e., those figures with
the words Supp., Supplemental, S, etc.), cite them with the format the user used,
for example “Figure S1” is Figure S1, "Supplemental Figure 1" is Suplemental Figure 1, etc.
```

# Output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
statement, and paragraphs farther down in the text rely on the logical
conclusions of previous paragraphs, much as theorems are built in mathematical
literature.

* When referring to data presented in supplementary figures (i.e., those figures with
the words Supp., Supplemental, S, etc.), cite them with the format the user used,
for example “Figure S1” is Figure S1, "Supplemental Figure 1" is Suplemental Figure 1, etc.

```

# Output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
Your job:
1. Provide a concise bullet-list of any changes needed.
2. If **no** changes are needed (content is publication-ready), call the tool `exit_loop` instead of returning bullets.
3. Ensure there are no captions in `{supplementary_figures}` that lack a matching citation


Return either:
- A JSON list of feedback bullets,
Expand Down
15 changes: 8 additions & 7 deletions packages/manugen-ai/src/manugen_ai/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ def prepare_instructions(callback_context: CallbackContext) -> Optional[types.Co
callback_context.state[key1] = ""

# add figures descriptions
figure_descriptions = ""
callback_context.state[FIGURES_DESCRIPTIONS_KEY] = ""
if FIGURES_KEY in current_state:
current_figure_state = current_state[FIGURES_KEY]
for figure_number, figure_data in current_figure_state.items():
figure_descriptions += f"Figure {figure_number}: {figure_data['title']}\n{figure_data['description']}\n\n"

callback_context.state[FIGURES_DESCRIPTIONS_KEY] = figure_descriptions.strip()

figure_descriptions = ""
for num, fig in current_state[FIGURES_KEY].items():
label = fig.get("display_name", f"Figure {num}")
figure_descriptions += (
f"{label}: {fig['title']}\n{fig['description']}\n\n"
)
callback_context.state[FIGURES_DESCRIPTIONS_KEY] = figure_descriptions.strip()

class ManuscriptStructure(BaseModel):
title: str = Field(default="")
Expand Down