Skip to content

fix(ai template): avoid nullable filenameFilter tool schema for Ollama#7368

Open
SergioChan wants to merge 1 commit intodotnet:mainfrom
SergioChan:copilot/fix-issue-7350-filenamefilter
Open

fix(ai template): avoid nullable filenameFilter tool schema for Ollama#7368
SergioChan wants to merge 1 commit intodotnet:mainfrom
SergioChan:copilot/fix-issue-7350-filenamefilter

Conversation

@SergioChan
Copy link

@SergioChan SergioChan commented Mar 7, 2026

Summary

  • change SearchAsync's filenameFilter parameter in the AI Chat Web template from nullable string to non-null string defaulting to empty
  • this keeps the generated function schema compatible with OllamaSharp's current mapper expectation for type: "string"
  • preserves existing behavior because empty string already means "search all files"

Testing

  • Static validation: confirmed the template now emits a non-nullable string filenameFilter = "" signature at Chat.razor (single-line scoped change)
  • Could not run dotnet build in this environment because the dotnet CLI is not installed (dotnet: command not found)

Related

Fixes #7350

Copilot AI review requested due to automatic review settings March 7, 2026 01:28
@SergioChan SergioChan requested a review from a team as a code owner March 7, 2026 01:28
@github-actions github-actions bot added the area-ai-templates Microsoft.Extensions.AI.Templates label Mar 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the AI Chat Web C# project template to avoid generating a nullable filenameFilter tool parameter schema, which currently breaks OllamaSharp’s tool mapper during function/tool serialization.

Changes:

  • Change the SearchAsync tool parameter filenameFilter from string? = null to non-nullable string = "" to prevent a nullable JSON schema type (array) from being emitted.
  • Preserve existing search behavior by continuing to treat empty string as “no filter / search all files”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai-templates Microsoft.Extensions.AI.Templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sending message in chat throws exception (GetStreamingResponseAsync)

2 participants