Skip to content

Conversation

@MarcoRossignoli
Copy link
Contributor

Add AI support to the Microsoft.Testing.Platform

Copy link
Member

@nohwnd nohwnd left a comment

Choose a reason for hiding this comment

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

Any tests possible for this?

MarcoRossignoli and others added 5 commits October 22, 2025 11:29
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
@MarcoRossignoli
Copy link
Contributor Author

Any tests possible for this?

At the moment nope it's experimental for now...I need to play a bit with the usage to understand, I would not ship the core ai and the extension lib for now, the plumbing is internal and should not affect the normal run if not registered.

We can try to add some real test when complete...but not sure if we will be able to test the AI interaction, but let's see maybe we will do it in some way.

@Youssef1313
Copy link
Member

Should we avoid publishing it publicly for now until we implement something that uses it and we have more confidence of the design? Maybe we should set <IsShipping>false</IsShipping> in the new projects?

@MarcoRossignoli
Copy link
Contributor Author

MarcoRossignoli commented Oct 25, 2025

Should we avoid publishing it publicly for now until we implement something that uses it and we have more confidence of the design? Maybe we should set false in the new projects?

wonder if we can ship it inside not official nuget feed but in the dogfooding testing one so I can pick it up to do some experiment outside the testfx repo.

We can always delist there in case.

@Youssef1313
Copy link
Member

I'm fine publishing to test-tools feed and not nuget.org. But I want to ensure we don't end up publishing to nuget.org accidentally. I think setting IsShipping to false is not going to prevent publishing to test-tools feed as long as the pattern here is adjusted to match NonShipping.

@MarcoRossignoli
Copy link
Contributor Author

I'm fine publishing to test-tools feed and not nuget.org. But I want to ensure we don't end up publishing to nuget.org accidentally. I think setting IsShipping to false is not going to prevent publishing to test-tools feed as long as the pattern here is adjusted to match NonShipping.

Done!

Marco Rossignoli added 4 commits October 26, 2025 10:41
…mplementation

- Make AzureOpenAIChatClientProvider internal
- Add public AddAzureOpenAIChatClientProvider extension method
- Extract IEnvironment service and store in field instead of keeping IServiceProvider
- Remove unnecessary InternalsVisibleTo from Microsoft.Testing.Platform.AI
- Update Playground sample to use new extension method
Copy link
Member

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

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

Playground project is now run during tests and so it fails

@MarcoRossignoli MarcoRossignoli marked this pull request as ready for review October 27, 2025 12:17
@MarcoRossignoli MarcoRossignoli enabled auto-merge (squash) October 27, 2025 12:17
/// Gets a value indicating whether the chat client supports tool calling
/// (e.g., MCP tools or functions).
/// </summary>
bool SupportsToolCalling { get; }
Copy link
Member

Choose a reason for hiding this comment

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

Maybe HasToolCapability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in LLM space the feature is called "tool calling", tool capability looks pretty generic imo

Comment on lines +98 to +99
void AddChatClientProvider(Func<IServiceProvider, object> chatClientProvider);
void RegisterChatClientProvider(ServiceProvider serviceProvider);
Copy link
Member

Choose a reason for hiding this comment

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

It's not easy to grasp difference between APIs here.

Copy link
Contributor Author

@MarcoRossignoli MarcoRossignoli Oct 27, 2025

Choose a reason for hiding this comment

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

Propose a name pls it's all internal, register is "to register to the service provider" looks clear to me, but open to different naming

Comment on lines +120 to +128
<data name="AzureOpenAIEndpointNotSet" xml:space="preserve">
<value>AZURE_OPENAI_ENDPOINT environment variable is not set.</value>
</data>
<data name="AzureOpenAIDeploymentNameNotSet" xml:space="preserve">
<value>AZURE_OPENAI_DEPLOYMENT_NAME environment variable is not set.</value>
</data>
<data name="AzureOpenAIApiKeyNotSet" xml:space="preserve">
<value>AZURE_OPENAI_API_KEY environment variable is not set.</value>
</data>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe reverse order in the message and create a single resx entry: Environment variable '{0}' is not set

Comment on lines +34 to +36
!string.IsNullOrEmpty(_environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")) &&
!string.IsNullOrEmpty(_environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME")) &&
!string.IsNullOrEmpty(_environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY"));
Copy link
Member

Choose a reason for hiding this comment

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

Use the string helper (not sure to recall the name in testfx repo).

/// Initializes a new instance of the <see cref="AzureOpenAIChatClientProvider"/> class.
/// </summary>
/// <param name="serviceProvider">The service provider.</param>
internal AzureOpenAIChatClientProvider(IServiceProvider serviceProvider)
Copy link
Member

Choose a reason for hiding this comment

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

I would take IEnvironment here. It's easier to grasp what the service needs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's all internal but it's fine I'll update the ctor

/// <summary>
/// Provider interface for creating and configuring chat clients.
/// </summary>
public interface IChatClientProvider
Copy link
Member

Choose a reason for hiding this comment

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

Shall we make it Experimental to give us time to refine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We won't ship in public for now, I'll anyway add experimental.

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.

4 participants