MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / get_max_tool_iterations

Function get_max_tool_iterations

web/pgadmin/llm/utils.py:569–590  ·  view source on GitHub ↗

Get the maximum number of tool iterations for AI conversations. Checks user preferences first, then falls back to system configuration. Returns: The maximum tool iterations (default 20).

()

Source from the content-addressed store, hash-verified

567
568
569def get_max_tool_iterations():
570 """
571 Get the maximum number of tool iterations for AI conversations.
572
573 Checks user preferences first, then falls back to system configuration.
574
575 Returns:
576 The maximum tool iterations (default 20).
577 """
578 try:
579 pref_module = Preferences.module('ai')
580 if pref_module:
581 pref = pref_module.preference('max_tool_iterations')
582 if pref:
583 value = pref.get()
584 if value is not None:
585 return int(value)
586 except Exception:
587 pass
588
589 # Fall back to system configuration
590 return getattr(config, 'MAX_LLM_TOOL_ITERATIONS', 20)
591
592
593def get_llm_config():

Callers 2

chat_with_databaseFunction · 0.90

Calls 3

moduleMethod · 0.80
preferenceMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected