Skip to content

Commit

Permalink
reuse logic for run mode, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scosman committed Feb 1, 2025
1 parent ca6672d commit 6d5980e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,17 @@ async def _run(self, input: Dict | str) -> RunOutput:
if run_strategy == "cot_as_message":
if not cot_prompt:
raise ValueError("cot_prompt is required for cot_as_message strategy")
messages.append({"role": "system", "content": cot_prompt})
messages.append(SystemMessage(content=cot_prompt))
elif run_strategy == "cot_two_call":
if not cot_prompt:
raise ValueError("cot_prompt is required for cot_two_call strategy")
# Base model (without structured output) used for COT message
base_model = await self.langchain_model_from()
messages.append(
SystemMessage(content=cot_prompt),
)

# Base model (without structured output) used for COT message
base_model = await self.langchain_model_from()

cot_messages = [*messages]
cot_response = await base_model.ainvoke(cot_messages)
intermediate_outputs["chain_of_thought"] = cot_response.content
Expand Down

0 comments on commit 6d5980e

Please sign in to comment.