├── news_summary_app ├── __init__.py ├── __pycache__ │ └── news_summary_app.cpython-39.pyc ├── app.py ├── shortcuts.py ├── templates │ └── index.html └── news_summary_app.py ├── requirements.txt ├── __pycache__ └── news_summary_app.cpython-39.pyc ├── setup.py └── README.md /news_summary_app/__init__.py: -------------------------------------------------------------------------------- 1 | from .news_summary_app import main 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | newspaper3k==0.2.8 2 | openai==0.10.3 3 | Flask==2.0.1 4 | notion-client>=0.2.0,<0.7.0 5 | lxml==4.6.3 6 | -------------------------------------------------------------------------------- /__pycache__/news_summary_app.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrtyndall/GPTNewsSummary/HEAD/__pycache__/news_summary_app.cpython-39.pyc -------------------------------------------------------------------------------- /news_summary_app/__pycache__/news_summary_app.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrtyndall/GPTNewsSummary/HEAD/news_summary_app/__pycache__/news_summary_app.cpython-39.pyc -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup( 4 | name='news_summary_app', 5 | version='1.0', 6 | author='Priceless Misc', 7 | author_email='matt@pricelessmisc.com', 8 | description='A Python app that generates summaries for news articles', 9 | packages=find_packages(), 10 | install_requires=[ 11 | 'newspaper3k==0.2.8', 12 | 'openai==0.10.3', 13 | 'Flask==2.0.1', 14 | 'notion-client==0.6.1' 15 | ], 16 | entry_points={ 17 | 'console_scripts': [ 18 | 'news-summary-app=news_summary_app:main' 19 | ] 20 | } 21 | ) 22 | -------------------------------------------------------------------------------- /news_summary_app/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, jsonify 2 | from news_summary_app import main 3 | 4 | app = Flask(__name__) 5 | 6 | @app.route('/', methods=['GET', 'POST']) 7 | def home(): 8 | if request.method == 'POST': 9 | url = request.json['url'] 10 | if not url: 11 | return jsonify({"error": "URL is required"}), 400 12 | result = main(url) 13 | formatted_result = { 14 | "title": result["title"], 15 | "summary": result["summary"].replace("\n", "
"), 16 | "outline": result["outline"].replace("\n", "
"), 17 | "bullet_points": result["bullet_points"].replace("\n", "
"), 18 | "key_quotes": result["key_quotes"].replace("\n", "
") 19 | } 20 | return jsonify(formatted_result) 21 | else: 22 | return render_template('index.html') 23 | 24 | if __name__ == '__main__': 25 | app.run(host='0.0.0.0', port=5000, debug=True) -------------------------------------------------------------------------------- /news_summary_app/shortcuts.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, jsonify 2 | from news_summary_app import main 3 | 4 | app = Flask(__name__) 5 | 6 | @app.route('/', methods=['GET', 'POST']) 7 | def home(): 8 | if request.method == 'POST': 9 | url = request.form['url'] 10 | if not url: 11 | return jsonify({"error": "URL is required"}), 400 12 | result = main(url) 13 | formatted_result = { 14 | "title": result["title"], 15 | "summary": result["summary"].replace("\n", "
"), 16 | "outline": result["outline"].replace("\n", "
"), 17 | "bullet_points": result["bullet_points"].replace("\n", "
"), 18 | "key_quotes": result["key_quotes"].replace("\n", "
") 19 | } 20 | return jsonify(formatted_result) 21 | else: 22 | return render_template('index.html') 23 | 24 | @app.route('/news_summary') 25 | def news_summary(): 26 | url = request.args.get('url') 27 | if not url: 28 | return jsonify({"error": "URL is required"}), 400 29 | result = main(url) 30 | formatted_result = { 31 | "title": result["title"], 32 | "summary": result["summary"].replace("\n", "
"), 33 | "outline": result["outline"].replace("\n", "
"), 34 | "bullet_points": result["bullet_points"].replace("\n", "
"), 35 | "key_quotes": result["key_quotes"].replace("\n", "
") 36 | } 37 | return jsonify(formatted_result) 38 | 39 | if __name__ == '__main__': 40 | app.run(host='0.0.0.0', port=8080, debug=True) 41 | -------------------------------------------------------------------------------- /news_summary_app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | News Summary App 5 | 6 | 7 | 8 | 9 | 10 |
11 |

News Summary App

12 |
13 |
14 |
15 | 16 | 17 |
18 | 19 |
20 |
21 |
22 | Loading... 23 |
24 |
Generating summary...
25 |
26 |
27 |

Summary

28 |
29 |
30 |
31 |
32 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /news_summary_app/news_summary_app.py: -------------------------------------------------------------------------------- 1 | __all__ = ['main'] 2 | import requests 3 | from newspaper import Article 4 | import openai 5 | from notion_client import Client 6 | from lxml import html 7 | 8 | def extract_article_links(url): 9 | article = Article(url, keep_article_html=True) 10 | article.download() 11 | article.parse() 12 | 13 | article_top_node = article.clean_top_node 14 | 15 | if article_top_node is not None: 16 | links = [a.get('href') for a in article_top_node.cssselect('a[href]')] 17 | else: 18 | links = [] 19 | 20 | cleaned_links = [f"{link}" for link in links if link.startswith("http") and link != url] 21 | return cleaned_links 22 | 23 | 24 | def extract_article_text(url, max_tokens=4000): 25 | article = Article(url) 26 | article.download() 27 | article.parse() 28 | article_text = article.text 29 | # Split the text into chunks 30 | chunks = [article_text[i:i+max_tokens] for i in range(0, len(article_text), max_tokens)] 31 | return chunks 32 | 33 | openai.api_key = "" 34 | 35 | def extract_article_title(url): 36 | article = Article(url) 37 | article.download() 38 | article.parse() 39 | return article.title 40 | 41 | def generate_text(prompt, n=1): 42 | response = openai.Completion.create( 43 | engine="text-davinci-003", 44 | prompt=prompt, 45 | max_tokens=1500, 46 | n=n, 47 | stop=None, 48 | temperature=0.7, 49 | logprobs=10, # Add this line 50 | ) 51 | choices = response.choices 52 | choices = sorted(choices, key=lambda x: sum(x.logprobs.token_logprobs) if x.logprobs and x.logprobs.token_logprobs else float("-inf"), reverse=True) 53 | full_text = choices[0].text.strip() 54 | 55 | # Remove any incomplete sentences at the beginning and end of the generated text 56 | sentences = full_text.split(".") 57 | if len(sentences) > 1: 58 | first_sentence = sentences[0].strip() 59 | if not first_sentence[0].isupper() or not first_sentence[-1].isalnum(): 60 | full_text = full_text[len(first_sentence):].strip() 61 | 62 | last_sentence = sentences[-1].strip() 63 | if not last_sentence or not last_sentence[-1].isalnum(): # Add check for empty string 64 | full_text = full_text[:len(full_text) - len(last_sentence)].strip() 65 | 66 | # Additional cleanup 67 | full_text = full_text.strip(".”") 68 | return full_text 69 | 70 | 71 | 72 | def generate_summary(article_chunks): 73 | summaries = [] 74 | for chunk in article_chunks: 75 | prompt = f"Please provide an executive summary of the following news article in 3-5 sentences, clearly stating the main topic, key points, and implications:\n\n---\n{chunk}\n---\nSummary:" 76 | summary = generate_text(prompt) 77 | summaries.append(summary) 78 | 79 | # Combine the summaries of all chunks 80 | combined_summary = " ".join(summaries) 81 | return combined_summary 82 | 83 | prompt = f"Please provide an executive summary of the following news article in 3-5 sentences, clearly stating the main topic, key points, and implications:\n\n---\n{article_text}\n---\nSummary:" 84 | return generate_text(prompt) 85 | 86 | def generate_outline(article_chunks): 87 | prompt = f"Please provide a comprehensive summary of the following news article in a well-organized and clearly written outline format. Focus on conveying the key information and important details about each game featured in the article. The outline should enable the reader to gain a high-level understanding of the information in the article without needing to read the full text. Keep the output to under 2000 characters.:\n\n---\n{article_chunks}\n---\n\nOutline:" 88 | return generate_text(prompt) 89 | 90 | def generate_bullet_points(article_chunks): 91 | prompt = f"Please provide 3-5 bullet points summarizing the main points and key takeaways of the following article, ensuring they are concise and informative:\n\n{article_chunks}" 92 | raw_text = generate_text(prompt) 93 | return raw_text.replace("•", "\n•").strip() 94 | 95 | def generate_key_quotes(article_chunks): 96 | prompt = f"Please provide 3-5 key quotes from the following article that represent important statements or opinions, and include the speaker's name, title (if applicable), and a brief context for the quote:\n\n{article_chunks}" 97 | raw_text = generate_text(prompt) 98 | return raw_text.replace("A.", "\n\nA.").replace("B.", "\n\nB.").replace("C.", "\n\nC.").strip() 99 | 100 | 101 | notion = Client(auth="") 102 | 103 | def format_for_notion(text): 104 | formatted_text = text.replace("1.", "\n\nA.") 105 | formatted_text = formatted_text.replace("2.", "\n\nB.") 106 | formatted_text = formatted_text.replace("3.", "\n\nC.") 107 | formatted_text = formatted_text.replace("4.", "\n\nD.") 108 | formatted_text = formatted_text.replace("5.", "\n\nE.") 109 | return formatted_text.strip() 110 | 111 | 112 | def create_notion_page(title, url, summary, outline, bullet_points, key_quotes, formatted_summary, formatted_outline, formatted_bullet_points, formatted_key_quotes, article_text, sources): 113 | # Replace the following line with the ID of the Notion database you want to use 114 | database_id = "" 115 | 116 | new_page = { 117 | "Title": {"title": [{"text": {"content": title}}]}, 118 | "Summary": {"rich_text": [{"text": {"content": formatted_summary}}]}, 119 | "Outline": {"rich_text": [{"text": {"content": formatted_outline}}]}, 120 | "Bullet Points": {"rich_text": [{"text": {"content": formatted_bullet_points}}]}, 121 | "Key Quotes": {"rich_text": [{"text": {"content": formatted_key_quotes}}]}, 122 | "Article URL": {"url": url}, 123 | "Sources": {"rich_text": [{"text": {"content": sources}}]}, 124 | } 125 | 126 | 127 | created_page = notion.pages.create(parent={"database_id": database_id}, properties=new_page, has_children=True) 128 | 129 | # Split article_text into chunks of 2000 characters or less 130 | article_text_chunks = [article_text[i:i + 2000] for i in range(0, len(article_text), 2000)] 131 | 132 | # Add content to the page's content area 133 | page_content = [ 134 | { 135 | "object": "block", 136 | "type": "heading_1", 137 | "heading_1": { 138 | "rich_text": [{"type": "text", "text": {"content": "Summary"}}] 139 | }, 140 | }, 141 | { 142 | "object": "block", 143 | "type": "paragraph", 144 | "paragraph": { 145 | "rich_text": [{"type": "text", "text": {"content": formatted_summary}}] 146 | }, 147 | }, 148 | { 149 | "object": "block", 150 | "type": "heading_1", 151 | "heading_1": { 152 | "rich_text": [{"type": "text", "text": {"content": "Outline"}}] 153 | }, 154 | }, 155 | { 156 | "object": "block", 157 | "type": "paragraph", 158 | "paragraph": { 159 | "rich_text": [{"type": "text", "text": {"content": formatted_outline}}] 160 | }, 161 | }, 162 | { 163 | "object": "block", 164 | "type": "heading_1", 165 | "heading_1": { 166 | "rich_text": [{"type": "text", "text": {"content": "Bullet Points"}}] 167 | }, 168 | }, 169 | { 170 | "object": "block", 171 | "type": "paragraph", 172 | "paragraph": { 173 | "rich_text": [{"type": "text", "text": {"content": formatted_bullet_points}}] 174 | }, 175 | }, 176 | { 177 | "object": "block", 178 | "type": "heading_1", 179 | "heading_1": { 180 | "rich_text": [{"type": "text", "text": {"content": "Key Quotes"}}] 181 | }, 182 | }, 183 | { 184 | "object": "block", 185 | "type": "paragraph", 186 | "paragraph": { 187 | "rich_text": [{"type": "text", "text": {"content": formatted_key_quotes}}] 188 | }, 189 | }, 190 | { 191 | "object": "block", 192 | "type": "heading_1", 193 | "heading_1": { 194 | "rich_text": [{"type": "text", "text": {"content": "Article Text"}}] 195 | }, 196 | }, 197 | ] 198 | 199 | # Add the article text chunks as separate paragraph blocks 200 | for chunk in article_text_chunks: 201 | page_content.append({ 202 | "object": "block", 203 | "type": "paragraph", 204 | "paragraph": { 205 | "rich_text": [{"type": "text", "text": {"content": chunk}}] 206 | }, 207 | }) 208 | 209 | 210 | 211 | page_content.append({ 212 | "object": "block", 213 | "type": "heading_1", 214 | "heading_1": { 215 | "rich_text": [ 216 | { 217 | "type": "text", 218 | "text": { 219 | "content": "Sources and Backlinks" 220 | } 221 | } 222 | ] 223 | } 224 | }) 225 | 226 | # Add the sources as separate paragraph blocks with clickable links 227 | for link in sources.split("\n"): 228 | page_content.append({ 229 | "object": "block", 230 | "type": "paragraph", 231 | "paragraph": { 232 | "rich_text": [ 233 | { 234 | "type": "text", 235 | "text": {"content": link, "link": {"url": link}} 236 | } 237 | ] 238 | }, 239 | }) 240 | 241 | 242 | 243 | # Add the content to the Notion page 244 | notion.blocks.children.append(created_page["id"], children=page_content) 245 | 246 | 247 | def main(url): 248 | article_chunks = extract_article_text(url) 249 | 250 | # Store the article chunks (you can use a cache or database to store them) 251 | stored_article_chunks = article_chunks 252 | 253 | # Read the stored article chunks 254 | article_chunks = stored_article_chunks 255 | 256 | # Make separate API calls for each part of the article 257 | summary = generate_summary(article_chunks) 258 | 259 | # Replace 'article_text' with 'article_chunks' in the following three function calls 260 | outline = generate_outline(article_chunks) 261 | bullet_points = generate_bullet_points(article_chunks) 262 | key_quotes = generate_key_quotes(article_chunks) 263 | 264 | formatted_summary = format_for_notion(summary) 265 | formatted_outline = format_for_notion(outline) 266 | formatted_bullet_points = format_for_notion(bullet_points) 267 | formatted_key_quotes = format_for_notion(key_quotes) 268 | 269 | # Extract the title from the article text 270 | title = extract_article_title(url) 271 | 272 | # Join the article chunks into a single string 273 | article_text = " ".join(article_chunks) 274 | 275 | # Extract the links from the article 276 | links = extract_article_links(url) 277 | sources = "\n".join(f"{link}" for link in links) 278 | 279 | 280 | create_notion_page(title, url, summary, outline, bullet_points, key_quotes, formatted_summary, formatted_outline, formatted_bullet_points, formatted_key_quotes, article_text, sources) 281 | # Return the generated content as a dictionary 282 | return { 283 | 'title': title, 284 | 'url': url, 285 | 'summary': summary, 286 | 'outline': outline, 287 | 'bullet_points': bullet_points, 288 | 'key_quotes': key_quotes, 289 | } 290 | 291 | 292 | 293 | if __name__ == "__main__": 294 | url = "https://www.npr.org/2023/03/27/1165899152/ted-lasso-brett-goldstein-shrinking" # Replace with a URL for testing 295 | main(url) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ***Introduction*** 2 | 3 | GPTNews Summary is a Python application that leverages OpenAI's GPT-3 and the Notion API to generate summaries, outlines, bullet points, and key quotes from news articles. The generated content is then added to a Notion page, simplifying the process of organizing and reviewing information from various sources. 4 | 5 | ***Contents*** 6 | 7 | Features 8 | Installation 9 | Configuration 10 | Usage 11 | Function Breakdown 12 | Contributing 13 | License 14 | --- 15 | 16 | ### 1. Features 17 | 18 | The GPTNews Summary app offers a range of features designed to streamline the process of summarizing, organizing, and reviewing news articles. These features include: 19 | 20 | - **Extract article text and links from a given URL**: GPTNews Summary uses the **`newspaper`** library to efficiently extract the main text and associated links from a given news article URL. This process removes unnecessary content such as ads, comments, and navigation elements, leaving only the core information for further processing. 21 | - **Generate summaries, outlines, bullet points, and key quotes using GPT-3**: By leveraging the power of OpenAI's GPT-3, GPTNews Summary can create concise summaries, informative outlines, easy-to-read bullet points, and highlight key quotes from the extracted article text. GPT-3's advanced natural language understanding capabilities ensure that the generated content is coherent and relevant. 22 | - *Summaries*: GPTNews Summary produces succinct summaries that capture the main points and context of the article, allowing users to quickly understand the content without reading the full text. 23 | - *Outlines*: The app generates outlines that present the article's structure and main topics, offering users a clear roadmap of the content and making it easier to navigate. 24 | - *Bullet points*: GPTNews Summary creates bullet points that emphasize important details and key facts from the article, making it simple for users to review the critical information. 25 | - *Key quotes*: The app identifies and extracts key quotes from the article, showcasing the most compelling or significant statements for users to reference. 26 | - **Create and populate Notion pages with the generated content**: GPTNews Summary automates the process of organizing and storing the generated summaries, outlines, bullet points, and key quotes in a Notion database. By integrating with the Notion API, the app creates new pages for each summarized article and populates them with the generated content, facilitating easy access, review, and management of the information within the Notion platform. 27 | 28 | ### 2. Libraries and Dependencies 29 | 30 | GPTNews Summary relies on several Python libraries and APIs to perform its functions effectively. This section provides an overview of these libraries and how they contribute to the app's functionality. 31 | 32 | - **OpenAI GPT-3**: GPTNews Summary uses OpenAI's GPT-3 language model to generate summaries, outlines, bullet points, and key quotes from news articles. To interact with GPT-3, the app utilizes the **`openai`** Python library, which provides an interface to OpenAI's API. 33 | - **Notion API**: The app integrates with the Notion API to create and populate Notion pages with the generated content. The **`notion-client`** library is used to interact with the Notion API, enabling the app to authenticate, create pages, and manage content within a Notion database. 34 | - **Newspaper3k**: The **`newspaper3k`** library is used to extract article text, links, and titles from a given URL. This library simplifies the process of obtaining the core content from news articles by automatically filtering out unnecessary elements such as ads, comments, and navigation items. 35 | - **Flask**: The Flask web framework is used to create a lightweight web application that allows users to input a news article URL and receive the generated summaries, outlines, bullet points, and key quotes. Flask provides a simple and flexible way to build web applications in Python. 36 | - **Requests**: The **`requests`** library is used to make HTTP requests and interact with web services, such as the OpenAI API and Notion API. This library simplifies the process of sending and receiving data over the internet. 37 | 38 | To install the required libraries and dependencies, run the following command: 39 | 40 | ``` 41 | pip install -r requirements.txt 42 | ``` 43 | 44 | This command will automatically install the necessary Python packages listed in the **`requirements.txt`** file. By utilizing these libraries, GPTNews Summary can efficiently perform its tasks and provide a seamless experience for users. 45 | 46 | ### 3. Installation 47 | 48 | 1. Clone this repository to your local machine: 49 | 50 | ``` 51 | git clone 52 | 53 | ``` 54 | 55 | 2. Install the required Python libraries: 56 | 57 | ``` 58 | pip install -r requirements.txt 59 | 60 | ``` 61 | 62 | 63 | ### 4. Configuration 64 | 65 | 1. Replace **``** with your OpenAI API key in the **`main.py`** file. 66 | 2. Replace **``** with your Notion API key in the **`main.py`** file. 67 | 3. Replace **``** with the ID of the Notion database you want to use in the **`main.py`** file. 68 | 69 | ### 5. Usage 70 | 71 | GPTNews Summary can be used in two ways: 72 | 73 | 1. Running the **`app.py`** file, which allows you to paste a URL at your address (e.g., **`example.com:5000`**): 74 | 75 | ```python 76 | python app.py 77 | ``` 78 | 79 | After running the script, open your web browser and go to the address where the app is hosted (e.g., **`http://localhost:5000`**). Enter the URL of the news article you want to summarize and click the "Submit" button. 80 | 81 | 2. Running the **`shortcuts.py`** file, which allows you to run the summarizer via a GET URL method with a URL formatted like **`example.com/news_summary?url=example.com`**: 82 | 83 | ``` 84 | python shortcuts.py 85 | ``` 86 | 87 | After running the script, open your web browser and go to the address where the app is hosted, followed by **`/news_summary?url=`** and the URL of the news article you want to summarize (e.g., **`http://localhost:5000/news_summary?url=https://www.example.com/news-article`**). 88 | 89 | 90 | Both methods will generate a summary, outline, bullet points, and key quotes for the news article and create a Notion page with the generated content. 91 | 92 | ### 6. Function Breakdown 93 | 94 | Here's a brief explanation of each function in the news_summary_app.py script: 95 | 96 | - **`extract_article_links(url)`**: Extracts article links from the given URL using the **`newspaper`** library. 97 | - **`extract_article_text(url, max_tokens=4000)`**: Extracts the article text from the given URL using the **`newspaper`** library and splits the text into chunks with a maximum token count. 98 | - **`extract_article_title(url)`**: Extracts the article title from the given URL using the **`newspaper`** library. 99 | - `generate_text(prompt, n=1)` is a function that utilizes the OpenAI GPT-3 API to generate text from a given prompt. The function takes two arguments: `prompt`, a string containing the text prompt to generate the response from, and `n`, an optional integer specifying the number of responses to generate (default is 1). 100 | 101 | The function calls the `openai.Completion.create()` method to generate the text, which is a powerful tool that allows users to generate various types of text, such as articles, stories, summaries, and much more. 102 | 103 | One parameter of the `openai.Completion.create()` method is `engine`, which specifies the GPT-3 engine to use for text generation. In this case, the `text-davinci-003` engine is used, which is one of the most advanced and expensive models available. 104 | 105 | Another parameter is `max_tokens`, which specifies the maximum number of tokens (words) that the generated text can have. This parameter is essential because it controls the length of the generated text, which can affect the quality and coherence of the output. 106 | 107 | The `n` parameter specifies the number of responses to generate, which can be useful when trying to generate multiple versions of the same prompt or when attempting to generate text with different styles or tones. 108 | 109 | The `stop` parameter is a string or list of strings used to indicate when the response should stop generating. If `None`, the response will continue generating until the `max_tokens` limit is reached. This parameter is useful when generating text with a specific goal or objective, such as summarizing an article, creating a bullet point list, or generating a conclusion. 110 | 111 | The `temperature` parameter is a float value between 0 and 1 that controls the randomness of the generated text. A higher value will produce more random text, while a lower value will produce more predictable text. This parameter can affect the coherence and quality of the output and must be adjusted accordingly. 112 | 113 | Finally, the `logprobs` parameter is an optional integer that controls the amount of information the API returns about its prediction process. This parameter can be useful for debugging and troubleshooting purposes, but it can also slow down the text generation process. 114 | 115 | In summary, the `generate_text()` function is a powerful tool that allows users to generate high-quality text from a given prompt using the OpenAI GPT-3 API. By adjusting the various parameters of the `openai.Completion.create()` method, users can generate text with different lengths, styles, tones, and degrees of randomness, making it a versatile and flexible tool for various text generation tasks. 116 | 117 | - ***Open AI API Prompts:*** 118 | 119 | These four functions are critical to the functionality of the GPTNews Summary application. Each of them uses GPT-3 to generate different types of summary and key information from the news article. 120 | 121 | `generate_summary(article_chunks)` generates a 3-5 sentence summary for each chunk of text passed to it, combining them into a single string. The function uses a prompt that asks GPT-3 to provide an executive summary of the news article in 3-5 sentences, clearly stating the main topic, key points, and implications. The prompt can be customized as per the user's needs. 122 | 123 | `generate_outline(article_chunks)` prompts GPT-3 to generate a comprehensive summary of the article in a well-organized and clearly written outline format. The outline focuses on conveying the key information and important details about each game featured in the article. The output of this function is limited to under 2000 characters. The prompt can be customized as per the user's needs. 124 | 125 | `generate_bullet_points(article_chunks)` prompts GPT-3 to generate 3-5 bullet points that summarize the main points and key takeaways of the article. The function ensures that the bullet points are concise and informative. The prompt can be customized as per the user's needs. 126 | 127 | `generate_key_quotes(article_chunks)` prompts GPT-3 to generate 3-5 key quotes from the article that represent important statements or opinions. The quotes include the speaker's name, title (if applicable), and a brief context for the quote. The prompt can be customized as per the user's needs. 128 | 129 | These functions are all built on the `generate_text(prompt)` function, which is used to prompt GPT-3 to generate text based on the given prompt. The prompt can be modified to change the output of the function. 130 | 131 | By using these functions, the GPTNews Summary application can quickly summarize news articles and extract key information, making it easier to organize and review information from various sources. Additionally, the prompts can be modified to generate summaries and key information for different types of articles or documents, making the application flexible and versatile for various use cases. 132 | 133 | --- 134 | 135 | - **`format_for_notion(text)`**: Formats text for compatibility with the Notion API. 136 | - **`create_notion_page(...)`**: Creates a Notion page and populates it with the given content. 137 | - **`main(url)`**: The main function, which ties together all the other functions. Takes a URL as input, extracts and processes the article text, generates summaries, outlines, bullet points, and key quotes, and creates a Notion page with the generated content. 138 | 139 | ### 7. Contributing 140 | 141 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 142 | 143 | If you would like to contribute to the project, please submit a pull request on GitHub with your proposed changes. All contributions are welcome. 144 | 145 | ### 8. License 146 | 147 | This project is licensed under the MIT License. 148 | 149 | GPTNews Summary utilizes the following third-party libraries, which are subject to their respective licenses: 150 | 151 | - **OpenAI GPT-3**: The **`openai`** Python library is used to interact with GPT-3. Please refer to **[OpenAI's Terms of Service](https://platform.openai.com/docs/terms-of-service)** and the library's **[LICENSE](https://github.com/openai/openai/blob/master/LICENSE.txt)** for more details. 152 | - **Notion API**: The **`notion-client`** library is used to interact with the Notion API. The library is licensed under the MIT License. Please refer to the library's **[LICENSE](https://github.com/ramnes/notion-sdk-py/blob/main/LICENSE)** for more details. 153 | - **Newspaper3k**: The **`newspaper3k`** library is licensed under the Apache License 2.0. Please refer to the library's **[LICENSE](https://github.com/codelucas/newspaper/blob/master/LICENSE)** for more details. 154 | - **Flask**: The Flask web framework is licensed under the BSD-3-Clause License. Please refer to Flask's **[LICENSE](https://github.com/pallets/flask/blob/main/LICENSE.rst)** for more details. 155 | - **Requests**: The **`requests`** library is licensed under the Apache License 2.0. Please refer to the library's **[LICENSE](https://github.com/psf/requests/blob/main/LICENSE)** for more details. 156 | 157 | Please ensure that you adhere to the terms and conditions of each library's license when using GPTNews Summary. 158 | --------------------------------------------------------------------------------