fml_doc_gen.autogen

Functions

fill_docstring_with_ai(→ str)

Generates a detailed docstring for a given function source by filling in a provided template

Module Contents

fml_doc_gen.autogen.fill_docstring_with_ai(docstring_template: str, function_source: str) str[source]

Generates a detailed docstring for a given function source by filling in a provided template using OpenAI’s language model.

Parameters:
  • docstring_template (str) – The docstring template with placeholders for descriptions.

  • function_source (str) – The source code of the function to extract context.

Returns:

The completed docstring with detailed descriptions.

Return type:

str

Raises:
  • ValueError – If either docstring_template or function_source is empty.

  • RuntimeError – If the API request fails or returns an unexpected response.