Text summarization
==================

``aidb.summarize_text()`` condenses a single text string into a concise
summary using a registered language model.
``aidb.summarize_text_aggregate()`` is the SQL aggregate form — use it
with ``GROUP BY`` to summarize text across multiple rows, returning one
summary per group.

For parameter tables and return types, see :ref:`Reference → Functions <Pipelines API reference>`  .

aidb.summarize_text()
---------------------

**Step 1: Register a model**

.. code:: sql

   SELECT aidb.create_model(my_t5_model, t5_local);

**Step 2: Summarize a text string**

edb_notranlate_1 sql SELECT aidb.summarize_text( input => ‘Long article
text…’, options => aidb.summarize_text_config( ‘my_t5_model’, prompt =>
‘Summarize the key points for a non-technical audience’ )::json );

edb_notranlate_2 sql SELECT \* FROM aidb.summarize_text( input => ‘Long
article text…’, options => aidb.summarize_text_config( ‘my_llm’, NULL,
‘Create a brief summary’, NULL, NULL, aidb.inference_config( temperature
=> 0.3, max_tokens => 50, seed => 42 ) )::json );

.. _text-summarization-1:

Text summarization
==================

- 

  - Fails at call time SELECT \* FROM aidb.summarize_text( input =>
    ‘Hello world’, options => aidb.summarize_text_config(model =>
    ‘bert_model’)::json );

**OUTPUT** ERROR: The requested adapter is not supported by the model
provider: bert_local \``\`

.. _text-summarization-2:

Text summarization
==================

.. csv-table::
  :header: ------------------------------------------------------------------------,-----------------------------------------------------,-----------------------------------------------------------------------------------
  :widths: 12,25,15
  :align: left
  :class: longtable

  `Provider 'bert_local' does not support language operations`,Embedding-only provider used for summarization,"Use `completions`, `openai_completions`, `t5_local`, or another language provider"
  `Invalid parameters: 'desired_length' must be greater than 0`,Invalid chunk config,Use a positive integer for `desired_length`
  `Invalid parameters: 'max_length' must be >= 'desired_length'`,`max_length` is smaller than `desired_length`,Set `max_length >= desired_length`
  `Invalid parameters: 'overlap_length' must be less than 'desired_length'`,Overlap too large,Reduce `overlap_length` (10–20% of `desired_length` is typical)
  `Text summarization failed to reduce size`,`reduce` strategy produced output longer than input,Increase chunk size (use `>= 50 words` or `>= 800 chars`)

.. toctree::
  :maxdepth: 3

  sql-functions--summarize-text--use-cases
  sql-functions--summarize-text--cookbook
