Examples

Summarize Text

Detailed guide on the request parameters for customizing API calls to Aipify.

Example:

After creating summarize endpoint with one field summary of type string we can use this sample text for out request:

The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometres (1,400 mi) over an area of approximately 344,400 square kilometres (133,000 sq mi). The reef is located in the Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms, known as coral polyps. It supports a wide diversity of life and was selected as a World Heritage Site in 1981. CNN labelled it one of the seven natural wonders of the world

Request:

Terminal
    curl --request POST \
      --url https://api.aipify.co/summarize \
      --header 'Authorization: Bearer daa015e25ee5b85xxxxxxxxxxxx' \
      --header 'Content-Type: application/json' \
      --data '{
        "messages" : [
           { "role": "user", "content": `This is a long text document that needs to be summarized ${text}` }
        ]
      }'

Response:

{
    "data": {
        "summary": "The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometres. Located in the Coral Sea, off the coast of Queensland, Australia, it is a structure that can be seen from outer space and is made up by billions of tiny organisms called coral polyps."
    }
}

Copyright © 2024