For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DASHBOARDPLAYGROUNDDOCSCOMMUNITYLOG IN
Guides and conceptsAPI ReferenceRelease NotesLLMUCookbooks
Guides and conceptsAPI ReferenceRelease NotesLLMUCookbooks
  • Cohere API
    • About
    • Teams and Roles
    • Errors
    • Migrating From API v1 to API v2
    • Using the OpenAI SDK
  • Endpoints
  • Deprecated
      • POSTSummarize
LogoLogodocs
DASHBOARDPLAYGROUNDDOCSCOMMUNITYLOG IN
Deprecatedv1/summarize

Summarize

Deprecated
POST
https://api.cohere.com/v1/summarize
POST
/v1/summarize
1import cohere
2
3co = cohere.Client()
4
5text = (
6 "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. "
7 "It may be made from milk or cream and is flavoured with a sweetener, "
8 "either sugar or an alternative, and a spice, such as cocoa or vanilla, "
9 "or with fruit such as strawberries or peaches. "
10 "It can also be made by whisking a flavored cream base and liquid nitrogen together. "
11 "Food coloring is sometimes added, in addition to stabilizers. "
12 "The mixture is cooled below the freezing point of water and stirred to incorporate air spaces "
13 "and to prevent detectable ice crystals from forming. The result is a smooth, "
14 "semi-solid foam that is solid at very low temperatures (below 2 °C or 35 °F). "
15 "It becomes more malleable as its temperature increases.\n\n"
16 'The meaning of the name "ice cream" varies from one country to another. '
17 'In some countries, such as the United States, "ice cream" applies only to a specific variety, '
18 "and most governments regulate the commercial use of the various terms according to the "
19 "relative quantities of the main ingredients, notably the amount of cream. "
20 "Products that do not meet the criteria to be called ice cream are sometimes labelled "
21 '"frozen dairy dessert" instead. In other countries, such as Italy and Argentina, '
22 "one word is used fo\r all variants. Analogues made from dairy alternatives, "
23 "such as goat's or sheep's milk, or milk substitutes "
24 "(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are "
25 "lactose intolerant, allergic to dairy protein or vegan."
26)
27
28response = co.summarize(
29 text=text,
30)
31print(response)
1{
2 "id": "aa0b828e-f9cf-484d-a84d-cb62f556e841",
3 "summary": "Ice cream is a frozen dessert made by whipping a cream base and liquid nitrogen together. It is then flavoured with sweeteners, spices and fruits. Ice cream can also be made using alternative milks, such as soy or almond, for those who are lactose intolerant or vegan.",
4 "meta": {
5 "api_version": {
6 "version": "1"
7 },
8 "billed_units": {
9 "input_tokens": 321,
10 "output_tokens": 55
11 }
12 }
13}
<Warning> This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API. </Warning> Generates a summary in English for a given text.
Was this page helpful?
Previous

Release Notes

Next
Built with

This API is marked as “Legacy” and is no longer maintained. Follow the migration guide to start using the Chat API.

Generates a summary in English for a given text.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Headers

X-Client-NamestringOptional
The name of the project that is making the request.

Request

textstringRequired250-50000 characters
The text to generate a summary for. Can be up to 100,000 characters long. Currently the only supported language is English.
lengthenumOptionalDefaults to medium

One of short, medium, long, or auto defaults to auto. Indicates the approximate length of the summary. If auto is selected, the best option will be picked based on the input text.

Allowed values:
formatenumOptionalDefaults to paragraph

One of paragraph, bullets, or auto, defaults to auto. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If auto is selected, the best option will be picked based on the input text.

Allowed values:
modelstringOptional

The identifier of the model to generate the summary with. Currently available models are command (default), command-nightly (experimental), command-light, and command-light-nightly (experimental). Smaller, “light” models are faster, while larger models will perform better.

extractivenessenumOptionalDefaults to low
One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text.
Allowed values:
temperaturedoubleOptional0-5Defaults to 0.3

Ranges from 0 to 5. Controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output. The sweet spot is typically between 0 and 1.

additional_commandstringOptional

A free-form instruction for modifying how the summaries get generated. Should complete the sentence “Generate a summary _”. Eg. “focusing on the next steps” or “written by Yoda”

Response headers

X-API-Warningstring
The name of the project that is making the request.

Response

OK
idstring
Generated ID for the summary
summarystring
Generated summary for the text
metaobject

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
498
Invalid Token Error
499
Client Closed Request Error
500
Internal Server Error
501
Not Implemented Error
503
Service Unavailable Error
504
Gateway Timeout Error

One of low, medium, high, or auto, defaults to auto. Controls how close to the original text the summary is. high extractiveness summaries will lean towards reusing sentences verbatim, while low extractiveness summaries will tend to paraphrase more. If auto is selected, the best option will be picked based on the input text.