Skip to content

Commit

Permalink
Merge pull request #1048 from winsonluk/fix-gemini
Browse files Browse the repository at this point in the history
Fix Gemini bug when system role is provided
  • Loading branch information
assafelovic authored Dec 29, 2024
2 parents 8643231 + d8afbe8 commit eae2cde
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions gpt_researcher/actions/report_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,22 @@ async def generate_report(
llm_kwargs=cfg.llm_kwargs,
cost_callback=cost_callback,
)
except Exception as e:
print(f"Error in generate_report: {e}")
except:
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 Exception as e:
print(f"Error in generate_report: {e}")

return report

0 comments on commit eae2cde

Please sign in to comment.