knowsuchagency commited on
Commit
8bf1635
1 Parent(s): 1a8723f

update the prompt to make it less likely to include brackets with variables and to have the main points of the text reiterated at the end of the dialogue

Browse files
Files changed (1) hide show
  1. main.py +13 -10
main.py CHANGED
@@ -1,7 +1,10 @@
1
  import concurrent.futures as cf
 
2
  import io
3
  import os
 
4
  from pathlib import Path
 
5
  from typing import List, Literal
6
 
7
  import gradio as gr
@@ -12,10 +15,6 @@ from promptic import llm
12
  from pydantic import BaseModel, ValidationError
13
  from pypdf import PdfReader
14
  from tenacity import retry, retry_if_exception_type
15
- from tempfile import NamedTemporaryFile
16
- import glob
17
- import os
18
- import time
19
 
20
  sentry_sdk.init(os.getenv("SENTRY_DSN"))
21
 
@@ -39,7 +38,7 @@ class Dialogue(BaseModel):
39
 
40
 
41
  @retry(retry=retry_if_exception_type(ValidationError))
42
- @llm(model="gemini/gemini-1.5-flash")
43
  def generate_dialogue(text: str) -> Dialogue:
44
  """
45
  Your task is to take the input text provided and turn it into an engaging, informative podcast dialogue. The input text may be messy or unstructured, as it could come from a variety of sources like PDFs or web pages. Don't worry about the formatting issues or any irrelevant information; your goal is to extract the key points and interesting facts that could be discussed in a podcast.
@@ -47,25 +46,29 @@ def generate_dialogue(text: str) -> Dialogue:
47
  Here is the input text you will be working with:
48
 
49
  <input_text>
50
- {text}
51
  </input_text>
52
 
53
  First, carefully read through the input text and identify the main topics, key points, and any interesting facts or anecdotes. Think about how you could present this information in a fun, engaging way that would be suitable for an audio podcast.
54
 
55
  <scratchpad>
56
- Brainstorm creative ways to discuss the main topics and key points you identified in the input text. Consider using analogies, storytelling techniques, or hypothetical scenarios to make the content more relatable and engaging for listeners.
57
 
58
  Keep in mind that your podcast should be accessible to a general audience, so avoid using too much jargon or assuming prior knowledge of the topic. If necessary, think of ways to briefly explain any complex concepts in simple terms.
59
 
60
  Use your imagination to fill in any gaps in the input text or to come up with thought-provoking questions that could be explored in the podcast. The goal is to create an informative and entertaining dialogue, so feel free to be creative in your approach.
61
 
62
- Write your brainstorming ideas and a rough outline for the podcast dialogue here.
63
  </scratchpad>
64
 
65
- Now that you have brainstormed ideas and created a rough outline, it's time to write the actual podcast dialogue. Aim for a natural, conversational flow between the host and any guest speakers. Incorporate the best ideas from your brainstorming session and make sure to explain any complex topics in an easy-to-understand way.
66
 
67
  <podcast_dialogue>
68
- Write your engaging, informative podcast dialogue here, based on the key points and creative ideas you came up with during the brainstorming session. Use a conversational tone and include any necessary context or explanations to make the content accessible to a general audience. Don't include variable brackets like `[Host Name]` or `[Guest Name]`. Use made-up names for the hosts and guests to create a more engaging and immersive experience for listeners. Design your output to be read aloud -- it will be directly converted into audio.
 
 
 
 
69
  </podcast_dialogue>
70
  """
71
 
 
1
  import concurrent.futures as cf
2
+ import glob
3
  import io
4
  import os
5
+ import time
6
  from pathlib import Path
7
+ from tempfile import NamedTemporaryFile
8
  from typing import List, Literal
9
 
10
  import gradio as gr
 
15
  from pydantic import BaseModel, ValidationError
16
  from pypdf import PdfReader
17
  from tenacity import retry, retry_if_exception_type
 
 
 
 
18
 
19
  sentry_sdk.init(os.getenv("SENTRY_DSN"))
20
 
 
38
 
39
 
40
  @retry(retry=retry_if_exception_type(ValidationError))
41
+ @llm(model="gemini/gemini-1.5-flash", max_tokens=8192)
42
  def generate_dialogue(text: str) -> Dialogue:
43
  """
44
  Your task is to take the input text provided and turn it into an engaging, informative podcast dialogue. The input text may be messy or unstructured, as it could come from a variety of sources like PDFs or web pages. Don't worry about the formatting issues or any irrelevant information; your goal is to extract the key points and interesting facts that could be discussed in a podcast.
 
46
  Here is the input text you will be working with:
47
 
48
  <input_text>
49
+ {text}
50
  </input_text>
51
 
52
  First, carefully read through the input text and identify the main topics, key points, and any interesting facts or anecdotes. Think about how you could present this information in a fun, engaging way that would be suitable for an audio podcast.
53
 
54
  <scratchpad>
55
+ Brainstorm creative ways to discuss the main topics and key points you identified in the input text. Consider using analogies, storytelling techniques, or hypothetical scenarios to make the content more relatable and engaging for listeners.
56
 
57
  Keep in mind that your podcast should be accessible to a general audience, so avoid using too much jargon or assuming prior knowledge of the topic. If necessary, think of ways to briefly explain any complex concepts in simple terms.
58
 
59
  Use your imagination to fill in any gaps in the input text or to come up with thought-provoking questions that could be explored in the podcast. The goal is to create an informative and entertaining dialogue, so feel free to be creative in your approach.
60
 
61
+ Write your brainstorming ideas and a rough outline for the podcast dialogue here. Be sure to note the key insights and takeaways you want to reiterate at the end.
62
  </scratchpad>
63
 
64
+ Now that you have brainstormed ideas and created a rough outline, it's time to write the actual podcast dialogue. Aim for a natural, conversational flow between the host and any guest speakers. Incorporate the best ideas from your brainstorming session and make sure to explain any complex topics in an easy-to-understand way.
65
 
66
  <podcast_dialogue>
67
+ Write your engaging, informative podcast dialogue here, based on the key points and creative ideas you came up with during the brainstorming session. Use a conversational tone and include any necessary context or explanations to make the content accessible to a general audience. Use made-up names for the hosts and guests to create a more engaging and immersive experience for listeners. Do not include any bracketed placeholders like [Host] or [Guest]. Design your output to be read aloud -- it will be directly converted into audio.
68
+
69
+ Make the dialogue as long and detailed as possible, while still staying on topic and maintaining an engaging flow. Aim to use your full output capacity to create the longest podcast episode you can, while still communicating the key information from the input text in an entertaining way.
70
+
71
+ At the end of the dialogue, have the host and guest speakers naturally summarize the main insights and takeaways from their discussion. This should flow organically from the conversation, reiterating the key points in a casual, conversational manner. Avoid making it sound like an obvious recap - the goal is to reinforce the central ideas one last time before signing off.
72
  </podcast_dialogue>
73
  """
74