Jaward commited on
Commit
c770fe4
·
verified ·
1 Parent(s): 83f4d88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
  import json
3
  import re
@@ -334,7 +335,7 @@ async def on_generate(api_service, api_key, serpapi_key, title, topic, instructi
334
  model_client=model_client,
335
  handoffs=["slide_agent"],
336
  system_message="You are a Research Agent. Use the search_web tool to gather information on the topic and keywords from the initial message. Summarize the findings concisely in a single message, then use the handoff_to_slide_agent tool to pass the task to the Slide Agent. Do not produce any other output.",
337
- tools=[lambda query: search_web(query, serpapi_key)]
338
  )
339
  slide_agent = AssistantAgent(
340
  name="slide_agent",
@@ -359,7 +360,7 @@ Example output:
359
  model_client=model_client,
360
  handoffs=["feynman_agent"],
361
  system_message=f"""
362
- You are a Script Agent. Access the JSON array of {num_slides + 3} slides from the conversation history. Generate a narration script (1-2 sentences) for each slide, summarizing its content. Output ONLY a JSON array wrapped in ```json ... ``` with exactly {num_slides + 3} strings, one script per slide, in the same order. Ensure the JSON is valid and complete. After outputting, use the handoff_to_feynman_agent tool. If scripts cannot be generated, retry once.
363
  Example for 1 content slide:
364
  ```json
365
  [
@@ -798,4 +799,5 @@ with gr.Blocks(title="Agent Feynman") as demo:
798
  )
799
 
800
  if __name__ == "__main__":
801
- demo.launch()
 
 
1
+ ```python
2
  import os
3
  import json
4
  import re
 
335
  model_client=model_client,
336
  handoffs=["slide_agent"],
337
  system_message="You are a Research Agent. Use the search_web tool to gather information on the topic and keywords from the initial message. Summarize the findings concisely in a single message, then use the handoff_to_slide_agent tool to pass the task to the Slide Agent. Do not produce any other output.",
338
+ tools=[{"function": search_web, "name": "search_web", "description": "Search the web using SerpApi", "parameters": {"query": {"type": "string"}, "serpapi_key": {"type": "string"}} }]
339
  )
340
  slide_agent = AssistantAgent(
341
  name="slide_agent",
 
360
  model_client=model_client,
361
  handoffs=["feynman_agent"],
362
  system_message=f"""
363
+ You are a Script Agent. Access the JSON array of {num_slides + 3} slides from_synced the conversation history. Generate a narration script (1-2 sentences) for each slide, summarizing its content. Output ONLY a JSON array wrapped in ```json ... ``` with exactly {num_slides + 3} strings, one script per slide, in the same order. Ensure the JSON is valid and complete. After outputting, use the handoff_to_feynman_agent tool. If scripts cannot be generated, retry once.
364
  Example for 1 content slide:
365
  ```json
366
  [
 
799
  )
800
 
801
  if __name__ == "__main__":
802
+ demo.launch()
803
+ ```