Skip to content

Commit

Permalink
Fix Gemini bug when system role is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
winsonluk committed Dec 28, 2024
1 parent 8643231 commit 02d3afe
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion gpt_researcher/actions/report_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,21 @@ async def generate_report(
cost_callback=cost_callback,
)
except Exception as e:
print(f"Error in generate_report: {e}")
try:
report = await create_chat_completion(
model=cfg.smart_llm_model,
messages=[
{"role": "user", "content": f"{agent_role_prompt}\n\n{content}"},
],
temperature=0.35,
llm_provider=cfg.smart_llm_provider,
stream=True,
websocket=websocket,
max_tokens=cfg.smart_token_limit,
llm_kwargs=cfg.llm_kwargs,
cost_callback=cost_callback,
)
except:
print(f"Error in generate_report: {e}")

return report

0 comments on commit 02d3afe

Please sign in to comment.