How to Summarize Long Texts with Eden AI

How to Summarize Long Texts with Eden AI

In today’s information-driven world, we are constantly bombarded with an overwhelming amount of text. Whether it’s news articles, research papers, or business reports, the sheer volume of information can be difficult to manage and process. This is where the importance of summarizing long texts comes into play.

By condensing lengthy content into concise summaries, we can quickly gain a clear understanding of the key points without having to sift through pages of text. In this article, we will provide a step-by-step guide on how to use Eden AI to generate accurate and concise summaries.

What is Text Summarization

Text summarization is the process of condensing a longer document or a piece of text into a shorter version, while retaining the key information and meaning of the original content. The resulting summary should be a concise and coherent representation of the main points or ideas conveyed in the original text.

Extractive and abstractive text summarization

There are two main types of text summarization: extractive and abstractive. Extractive summarization involves selecting and extracting the most important sentences or phrases from the original text, while abstractive summarization involves generating a summary by rephrasing and synthesizing the information in the original text using natural language generation techniques.

Text summarization applications

Text summarization is widely used in various applications, such as news aggregation, document management, and information retrieval, to provide users with a quick overview of the content and help them save time and effort in reading and processing large amounts of information.

How To Summarize Long Text with Eden AI

If you want to summarize long texts effectively, you can use the Text Summarization API provided by Eden AI. Here are the steps to summarize a long text using Eden AI:

Step 1. Obtain your Eden AI API Key

To start using Text Summarization, you need to create an account on Eden AI for free. Then, you'll be able to get your API key directly from the homepage and use it with free credits offered by Eden AI.

Step 2. Install the necessary libraries and dependencies

To make requests to the API, you need to have the appropriate libraries and dependencies installed in your development environment. In this case, you will need to install the requests library and the JSONLibrary.

Step 3. Write your Python script

You can use the Python script provided by Eden AI to summarize long text. Here’s the sample code you can use:

import json
import requests

# Enter your API Key obtained from Eden AI here

# Define the maximum length of each section of the text

# Define the text you want to summarize
text = " SAMPLE TEXT"

# Split the text into smaller sections
sections = [text[i:i+MAX_SECTION_LENGTH] for i in range(0, len(text), MAX_SECTION_LENGTH)]

# Initialize an empty list to store the summaries
summaries = []

# Loop over the sections and generate a summary for each section using Eden AI
for section in sections:
    headers = {"Authorization": f"Bearer {API_KEY}"}
    url =""
    payload = {"providers": "microsoft,connexun", "language": "en", "text": section}
    response =, json=payload, headers=headers)
    result = json.loads(response.text)
    summary = result['microsoft']['result']

# Concatenate the summaries to get a summary of the entire text
full_summary = ' '.join(summaries)

# Print the summary

Within this code, you can customize the MAX_SECTION_LENGTH variable to regulate the maximum length of each section of the text. The text variable should be replaced with your own lengthy text. The API_KEY variable should be set to your actual API Key obtained from Eden AI.

The code will split the long text into smaller sections, each adhering to the defined maximum length outlined by MAX_SECTION_LENGTH. For every section, a summary is generated by Eden AI and added to a list.

Finally, the code will concatenate all the summaries to get a summary of the entire text, and print it to the console.

Step 4. Run your Python script

Once you have written your Python script, you can run it to summarize your lengthy text. The script will make a request to the Text Summarization API using your API Key, and it will return a summary of your text.

Best Practices for using Eden AI’s Summarization Feature

Here are some best practices to consider when using Eden AI’s Summarization API:

  1. Use quality text: The quality of your input text will have a significant impact on the quality of the summary generated by the API. Therefore, it is important to use high-quality text that is well-written and free from grammatical errors. Fortunately, Eden AI provides a Grammar and Spell Check API to assist you with this!
  2. Evaluate the quality of the summaries: After generating the summaries, it is important to evaluate their quality. You can do this by comparing them with the original text and assessing how well they capture the key points and ideas of the text.
  3. Use multiple providers: Eden AI’s Summarization API offers multiple providers to choose from. Using multiple providers can improve the quality of the summaries by providing a more diverse range of summarization models and techniques.

Benefits of using Text Summarization with Eden AI

Save time and cost

We offer a unified API for all providers: simple and standard to use, with a quick switch between providers and access to the specific features of each provider.

Easy to integrate

The JSON output format is the same for all suppliers thanks to Eden AI's standardization work. The response elements are also standardized thanks to Eden AI's powerful matching algorithms.


With Eden AI you have the possibility to integrate a third-party platform: we can quickly develop connectors. To go further and customize your Summarization request with specific parameters, check out our documentation.

Related Posts

Try Eden AI for free.

You can directly start building now. If you have any questions, feel free to schedule a call with us!

Get startedContact sales