Skip to content
Open
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions quantmind/flows/paper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from typing import Any, TypeVar

from agents import Agent, RunHooks, Tool
from agents import Agent, AgentOutputSchema, RunHooks, Tool

from quantmind.configs import PaperFlowCfg
from quantmind.configs.paper import (
Expand Down Expand Up @@ -86,6 +86,11 @@ async def paper_flow(
"""
cfg = cfg or PaperFlowCfg()
out_type: type[Paper] = output_type or Paper # type: ignore[assignment]
resolved_output_type: Any = (
AgentOutputSchema(Paper, strict_json_schema=False)
if out_type is Paper
else out_type
)

raw_md, source_meta = await _fetch_and_format(input)

Expand All @@ -98,7 +103,7 @@ async def paper_flow(
),
"model": cfg.model,
"tools": list(extra_tools or []),
"output_type": out_type,
"output_type": resolved_output_type,
"input_guardrails": list(extra_input_guardrails or []),
"output_guardrails": list(extra_output_guardrails or []),
}
Expand Down