Repository: microsoft/semantic-kernel
File: dotnet/samples/GettingStartedWithAgents/OpenAIAssistant/Step07_Assistant_Declarative.cs (C#)

Code before:
            """;
        OpenAIAssistantAgentFactory factory = new();

        var agent = await factory.CreateAgentFromYamlAsync(text, new() { Kernel = this._kernel }, configuration: TestConfiguration.ConfigurationRoot);

        await InvokeAgentAsync(agent!, "Cats and Dogs");
    }

    /// <summary>
    /// Demonstrates loading an existing OpenAI Assistant.
    /// </summary>
    [Fact]
    public async Task OpenAIAssistantAgentWithId()
    {
        var text =
            """
            id: ${AzureOpenAI:AgentId}
            type: openai_assistant
            name: StoryAgent
            instructions: Tell a story suitable for children about the topic provided by the user. You always respond in French.
            """;
        OpenAIAssistantAgentFactory factory = new();

        var agent = await factory.CreateAgentFromYamlAsync(text, new() { Kernel = this._kernel }, configuration: TestConfiguration.ConfigurationRoot);

        await InvokeAgentAsync(agent!, "Cats and Dogs", false);
    }

    /// <summary>
    /// Demonstrates creating and using a OpenAI Assistant with templated instructions.
    /// </summary>
    [Fact]
    public async Task OpenAIAssistantAgentWithTemplate()
    {
        var text =
            """
            type: openai_assistant
            name: StoryAgent
            description: A agent that generates a story about a topic.
            instructions: Tell a story about {{$topic}} that is {{$length}} sentences long.
            model:
              id: ${AzureOpenAI:ChatModelId}
            inputs:
                topic:
                    description: The topic of the story.
                    required: true
                    default: Cats
                length:
                    description: The number of sentences in the story.
                    required: true
                    default: 2

Review comment (suggestion):
```suggestion
        await InvokeAgentAsync(agent!, "Cats and Dogs", deleteAgent: false);
```

Code after:
            """;
        OpenAIAssistantAgentFactory factory = new();

        var agent = await factory.CreateAgentFromYamlAsync(text, new() { Kernel = this._kernel }, configuration: TestConfiguration.ConfigurationRoot);

        await InvokeAgentAsync(agent!, "Cats and Dogs");
    }

    /// <summary>
    /// Demonstrates loading an existing OpenAI Assistant.
    /// </summary>
    [Fact]
    public async Task OpenAIAssistantAgentWithId()
    {
        var text =
            """
            id: ${AzureOpenAI:AgentId}
            type: openai_assistant
            name: StoryAgent
            instructions: Tell a story suitable for children about the topic provided by the user. You always respond in French.
            """;
        OpenAIAssistantAgentFactory factory = new();

        var agent = await factory.CreateAgentFromYamlAsync(text, new() { Kernel = this._kernel }, configuration: TestConfiguration.ConfigurationRoot);

        await InvokeAgentAsync(agent!, "Cats and Dogs", deleteAgent: false);
    }

    /// <summary>
    /// Demonstrates creating and using a OpenAI Assistant with templated instructions.
    /// </summary>
    [Fact]
    public async Task OpenAIAssistantAgentWithTemplate()
    {
        var text =
            """
            type: openai_assistant
            name: StoryAgent
            description: A agent that generates a story about a topic.
            instructions: Tell a story about {{$topic}} that is {{$length}} sentences long.
            model:
              id: ${AzureOpenAI:ChatModelId}
            inputs:
                topic:
                    description: The topic of the story.
                    required: true
                    default: Cats
                length:
                    description: The number of sentences in the story.
                    required: true
                    default: 2