aarmens702-hub opened a new pull request, #76701:
URL: https://github.com/apache/airflow/pull/76701

   ## Human Summary
   
   HookToolset builds the tool descriptions it sends to the LLM from hook 
docstrings, and some parameter descriptions come out wrong in three ways:
   
   - The last parameter takes in all the text after it. In the docs’ own S3 
example, one parameter ends up 601 characters long and includes a code block.
   - A :class: reference that wraps onto the next line cuts the description off 
mid-sentence, leaving just “Either a”.
   - A parameter with no description picks up the next field instead, like 
:return:.
   
   As a result, the model gets wrong or noisy parameter descriptions. This 
change parses the docstrings the way reStructuredText does: a description keeps 
going as long as the next lines are indented deeper. It changes 61 of the 1,690 
hook-method descriptions, and I checked each one.
   
   ## AI Summary
   
   <details><summary>Click here</summary>
   
   `HookToolset` builds each tool's parameter descriptions from the hook 
method's `:param` docs, using a regex that runs until the next line starting 
with `:` or the end of the docstring. That goes wrong in three ways:
   
   - **The last parameter absorbs everything after it.** In `S3Hook.list_keys` 
(the example in the HookToolset docs), `apply_wildcard` gets a 601-character 
description that includes an example and a code block. `FTPHook.retrieve_file` 
gives `block_size` 850 characters.
   - **A continuation line starting with a role cuts the description short.** 
In `BigQueryHook.create_routine`, `routine` is described only as "The routine 
to create. Either a", because the next line starts with `:class:`.
   - **A parameter with no description takes the next field.** For example, a 
`:return:` line becomes the parameter's description.
   
   This follows how reStructuredText field lists work instead: a description 
continues while lines are indented deeper than its `:param` line, and empty 
descriptions are left out.
   
   Across all 1,690 provider hook methods with `:param` docs, 61 descriptions 
change: 23 are trimmed, 27 are completed and 11 empty ones are dropped. I read 
through the changed ones.
   
   Tests: three new cases in `TestParseParamDocs` (trailing text after the last 
param, a continuation line starting with a role, and a param without a 
description). All three fail on main and pass here. The full `test_hook.py` 
passes (106 passed). The Google-style `Args:` branch is unchanged.
   
   </details>
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to