Skip to content

Feat/tool call iteration count parameter#134

Merged
srebrek merged 7 commits into
mainfrom
feat/tool-call-iteration-count-parameter
May 31, 2026
Merged

Feat/tool call iteration count parameter#134
srebrek merged 7 commits into
mainfrom
feat/tool-call-iteration-count-parameter

Conversation

@srebrek
Copy link
Copy Markdown
Collaborator

@srebrek srebrek commented May 28, 2026

Allow user to set call LLM/MCP iteration limit to override the hardcoded value.

Example:

await AIHub.Chat()
      .WithModel(Models.OpenAi.Gpt4o)
      .WithMessage("Research the weather in Warsaw, then check forecast for next 3 days")
      .WithTools(new ToolsConfigurationBuilder()
          .AddTool("get_weather", "Get current weather",
              parameters: new { type = "object", properties = new { city = new { type = "string" } } },
              execute: (args) => $"Weather in {args}: sunny, 22°C")
          .WithMaxIterations(3)
          .Build())
      .CompleteAsync();

Do TODO: try to share logic of adding tool to the list across methods

srebrek added 2 commits May 28, 2026 12:22
The MaxIterations parameter allows user to configure the call iterations limit instead of relying on the hardcoded value.

Some cleanups (blank lines and == null changed to is null)
@srebrek srebrek marked this pull request as draft May 28, 2026 11:51
srebrek added 4 commits May 28, 2026 14:41
- OpenAiService uses virtual property instead of hardcoded max iterations.
- Extracted MaxIteration validation
@srebrek srebrek marked this pull request as ready for review May 28, 2026 13:30
wisedev-pstach
wisedev-pstach previously approved these changes May 30, 2026
@srebrek srebrek merged commit 4fb8ec7 into main May 31, 2026
@srebrek srebrek deleted the feat/tool-call-iteration-count-parameter branch May 31, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants