Understanding and Configuring Request Parameters
Eric @ CodableAI
Last Update vor 2 Jahren
To fully leverage the capabilities of the Document Summarization API, it's essential to understand and configure the various request parameters available. This guide provides a comprehensive breakdown of mandatory and optional parameters, their constraints, and examples of how to use them effectively.
ContentsMandatory Parameters (text or urls)
You must provide either the text parameter or the urls parameter in your request payload. Both serve as the source for summarization but in different forms.
text: Directly provide the text you want to summarize.
jsonCopy code{ "text": "Your document text here." }urls: Provide an array of URLs pointing to documents you want to summarize.
jsonCopy code{ "urls": [ "https://example.com/document1.pdf", "https://example.com/document2.docx" ] }
Constraints:
- text: Maximum of 10,000 characters per request.
- urls: Maximum of 3 URLs per request. Each URL must point to a publicly accessible document.
Optional Parameters (format, model, customization, summary_type, query, target_language)
These parameters allow you to customize the summarization output according to your specific needs.
format:
Defines the format of the summary output. Supported values:
- bullet_points
- paragraph
- executive
Example:
jsonCopy code"format": "bullet_points"model:
Selects the summarization model variant. Supported models:
- standard
- advanced
Example:
jsonCopy code"model": "standard"customization:
Allows for further tailoring of the summary's tone and length.
tone:
Adjusts the tone of the summary. Supported values:
- neutral
- formal
- informal
- energetic
- calm
Example:
jsonCopy code"customization": { "tone": "formal" }summary_length:
Sets the desired length of the summary. Supported values:
- short
- standard
- detailed
Example:
jsonCopy code"customization": { "summary_length": "detailed" }
Combined Example:
jsonCopy code"customization": { "tone": "formal", "summary_length": "standard" }summary_type:
Specifies the type of summary to generate. Supported values:
- executive
- conversation
- bullet_points
- paragraph
Example:
jsonCopy code"summary_type": "executive"query:
An optional field to include a specific query that the summary should address.
Example:
jsonCopy code"query": "What are the key benefits of AI in healthcare?"target_language:
Translates the summary into a supported language. Supported languages include the top 25 languages by native speakers.
Example:
jsonCopy code"target_language": "es"Supported Language Codes:
- en – English
- es – Spanish
- fr – French
- de – German
- zh – Mandarin
- ... (other language codes)
Parameter Constraints and Validations
- Mutual Exclusivity: You must provide either text or urls, not both.
- Character Limits: Ensure that the text parameter does not exceed 10,000 characters.
- URL Accessibility: Verify that all URLs provided are publicly accessible and point to supported document formats (PDF, DOCX).
- Valid Enumerations: Use only supported values for parameters like format, model, tone, etc.
Examples of Configured Requests
Basic Text Summarization:
jsonCopy code{ "text": "Artificial Intelligence is transforming the world by enhancing various industries...", "format": "paragraph", "model": "standard" }URL-Based Summarization with Customization:
jsonCopy code{ "urls": [ "https://example.com/report1.pdf", "https://example.com/report2.docx" ], "format": "bullet_points", "customization": { "tone": "formal", "summary_length": "detailed" }, "target_language": "fr" }Summarization with Specific Query:
jsonCopy code{ "text": "Artificial Intelligence is transforming the world by enhancing various industries...", "summary_type": "executive", "query": "How has AI improved diagnostic accuracy?", "model": "advanced" }
Armed with a thorough understanding of request parameters, proceed to the next article, "Customizing Your Summaries," to learn how to tailor summaries to your specific requirements.
