Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .azure/modules/azoai-azureopenai.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@description('Name of the Azure OpenAI instance. Must be globally unique and 3-63 characters, using only lowercase letters, numbers, and hyphens, starting and ending with a letter or number.')
@minLength(3)
@maxLength(63)
param name string

@description('Location for the Azure OpenAI resource.')
param location string

@description('Tags to apply to the Azure OpenAI resource.')
param tags object = {}

@description('SKU for Azure OpenAI. Allowed values: Standard, Default is Standard.')
@allowed([
'Standard'
])
param sku string = 'Standard'

resource azoai 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
name: name
location: location
tags: tags
kind: 'OpenAI'
sku: {
name: sku
}
properties: {
apiProperties: {
enableDynamicThrottling: true
}
networkAcls: {
defaultAction: 'Allow'
}
}
}

output id string = azoai.id
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## Developer Workflows
- **Build:** Use `build.cmd` or `build.sh` in `src/` to build the solution.
- **Test:** Integration specs in `src/gherkin Tests.Specs.Integration/` and `src/Tests.Specs.Integration/`.
- **Test:** Integration specs in `src/gherkin Tests.Integration/` and `src/Tests.Integration/`.
- **Run:** Launch via Visual Studio or `dotnet run` from solution root.
- **CI/CD:** Managed by GitHub Actions (`.github/workflows/`).
- **IaC Deploy:** See `can-digital-insights-iac.yml` for infrastructure deployment.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gtc-agent-standalone-web-api-sql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:
SRC_SLN: "Goodtocode.AgentFramework.Blazor.sln"
API_PATH: "Presentation.WebApi"
API_PROJECT: "Presentation.WebApi.csproj"
TEST_PATH: "Tests.Specs.Integration"
TEST_PROJECT: "Tests.Specs.Integration.csproj"
TEST_PATH: "Tests.Integration"
TEST_PROJECT: "Tests.Integration.csproj"
WEB_PATH: "Presentation.Blazor"
WEB_PROJECT: "Presentation.Blazor.csproj"
INFRA_PATH: 'Infrastructure.SqlServer'
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ To get started, follow the steps below:
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
```
```
cd ../Tests.Specs.Integration
cd ../Tests.Integration
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
```
5. Create your SQL Server database & schema (via *dotnet ef* command)
```
cd ../../
dotnet ef database update --project .\src\Infrastructure.SqlServer\Infrastructure.SqlServer.csproj --startup-project .\src\Presentation.WebApi\Presentation.WebApi.csproj --context AgentFrameworkContext --connection "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=AgentFramework;Min Pool Size=3;MultipleActiveResultSets=True;Trusted_Connection=Yes;TrustServerCertificate=True;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"
```
6. Run Tests (Tests.Specs.Integration)
6. Run Tests (Tests.Integration)
```
cd src/Tests.Specs.Integration
cd src/Tests.Integration
dotnet test
```
7. Run Blazor Web Chat Client (Presentation.Blazor) and Web API (Presentation.WebApi)
Expand Down Expand Up @@ -214,14 +214,14 @@ Follow these steps to get your development environment set up:
```

## Setup Azure Open AI or Open AI configuration
**Important:** Do this for both Presentation.WebApi and Tests.Specs.Integration
**Important:** Do this for both Presentation.WebApi and Tests.Integration
### Azure Open AI
```
cd src/Presentation.WebApi
dotnet user-secrets set "AzureOpenAI:ChatDeploymentName" "gpt-4"
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://YOUR_ENDPOINT.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "YOUR_API_KEY"
cd ../Tests.Specs.Integration
cd ../Tests.Integration
dotnet user-secrets set "AzureOpenAI:ChatDeploymentName" "gpt-4"
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://YOUR_ENDPOINT.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "YOUR_API_KEY"
Expand All @@ -234,11 +234,11 @@ AzureOpenAI__ApiKey
```

### Open AI
Set API Key in both Presentation.WebApi and Tests.Specs.Integration projects
Set API Key in both Presentation.WebApi and Tests.Integration projects
```
cd src/Presentation.WebApi
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
cd ../Tests.Specs.Integration
cd ../Tests.Integration
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"
```
Alternately you can set in Environment variables
Expand Down
2 changes: 1 addition & 1 deletion src/Core.Application/Abstractions/IActorsPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Goodtocode.AgentFramework.Core.Application.Abstractions;

public interface IActorsPlugin : ISemanticPluginCompatible
public interface IActorsPlugin
{
Task<IActorResponse> GetActorByIdAsync(Guid actorId, CancellationToken cancellationToken);
Task<ICollection<IActorResponse>> GetActorsByNameAsync(string name, CancellationToken cancellationToken);
Expand Down
2 changes: 1 addition & 1 deletion src/Core.Application/Abstractions/IChatMessagesPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Goodtocode.AgentFramework.Core.Application.Abstractions;

public interface IChatMessagesPlugin : ISemanticPluginCompatible
public interface IChatMessagesPlugin
{
Task<IEnumerable<string>> ListRecentMessagesAsync(DateTime? startDate, DateTime? endDate, CancellationToken cancellationToken);
Task<IEnumerable<string>> GetChatMessagesAsync(Guid sessionId, CancellationToken cancellationToken);
Expand Down
2 changes: 1 addition & 1 deletion src/Core.Application/Abstractions/IChatSessionsPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Goodtocode.AgentFramework.Core.Application.Abstractions;

public interface IChatSessionsPlugin : ISemanticPluginCompatible
public interface IChatSessionsPlugin
{
Task<IEnumerable<string>> ListRecentSessionsAsync(DateTime? startDate, DateTime? endDate, CancellationToken cancellationToken);
Task<string> UpdateChatSessionTitleAsync(Guid sessionId, string newTitle, CancellationToken cancellationToken);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task<ChatMessageDto> Handle(CreateChatMessageCommand request, Cance
chatSession.Messages.Add(chatMessage);
_context.ChatMessages.Add(chatMessage);

var agentReply = response.Contents.LastOrDefault().ToString() ?? string.Empty;
var agentReply = (response?.Contents?.LastOrDefault()?.ToString()) ?? string.Empty;

var chatMessageResponse = ChatMessageEntity.Create(
Guid.NewGuid(),
Expand Down
12 changes: 6 additions & 6 deletions src/Goodtocode.AgentFramework.Blazor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Presentation.Blazor", "Pres
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure.SqlServer", "Infrastructure.SqlServer\Infrastructure.SqlServer.csproj", "{615694FE-4180-4F1F-9ED7-984BA2DFCEA7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Specs.Integration", "Tests.Specs.Integration\Tests.Specs.Integration.csproj", "{5DD2A9DC-4CE9-4E47-BE7D-7EEF208D287F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.AgentFramework", "Infrastructure.AgentFramework\Infrastructure.AgentFramework.csproj", "{21D8E349-812A-A224-C58B-62F682747EFF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Integration", "Tests.Integration\Tests.Integration.csproj", "{AE0BE9C4-FF40-C7E2-B80E-F8BEF27C380B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -43,14 +43,14 @@ Global
{615694FE-4180-4F1F-9ED7-984BA2DFCEA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{615694FE-4180-4F1F-9ED7-984BA2DFCEA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{615694FE-4180-4F1F-9ED7-984BA2DFCEA7}.Release|Any CPU.Build.0 = Release|Any CPU
{5DD2A9DC-4CE9-4E47-BE7D-7EEF208D287F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DD2A9DC-4CE9-4E47-BE7D-7EEF208D287F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DD2A9DC-4CE9-4E47-BE7D-7EEF208D287F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DD2A9DC-4CE9-4E47-BE7D-7EEF208D287F}.Release|Any CPU.Build.0 = Release|Any CPU
{21D8E349-812A-A224-C58B-62F682747EFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21D8E349-812A-A224-C58B-62F682747EFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21D8E349-812A-A224-C58B-62F682747EFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21D8E349-812A-A224-C58B-62F682747EFF}.Release|Any CPU.Build.0 = Release|Any CPU
{AE0BE9C4-FF40-C7E2-B80E-F8BEF27C380B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE0BE9C4-FF40-C7E2-B80E-F8BEF27C380B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE0BE9C4-FF40-C7E2-B80E-F8BEF27C380B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE0BE9C4-FF40-C7E2-B80E-F8BEF27C380B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion src/Goodtocode.AgentFramework.WebApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure.SqlServer",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure.AgentFramework", "Infrastructure.AgentFramework\Infrastructure.AgentFramework.csproj", "{2091EF1C-2E75-488C-A822-9628E639FB98}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Specs.Integration", "Tests.Specs.Integration\Tests.Specs.Integration.csproj", "{5DD2A9DC-4CE9-4E47-BE7D-7EEF208D287F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Integration", "Tests.Integration\Tests.Integration.csproj", "{5DD2A9DC-4CE9-4E47-BE7D-7EEF208D287F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion src/Infrastructure.AgentFramework/Tools/ActorsTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class ActorsTool(IServiceProvider serviceProvider) : AITool, IActo
{
private readonly IServiceProvider _serviceProvider = serviceProvider;

public string PluginName => "AuthorsPlugin";
public static string PluginName => "AuthorsPlugin";
public string FunctionName => _currentFunctionName;
public Dictionary<string, object> Parameters => _currentParameters;

Expand Down
3 changes: 1 addition & 2 deletions src/Infrastructure.AgentFramework/Tools/ChatMessagesTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using System.ComponentModel;

namespace Goodtocode.AgentFramework.Infrastructure.AgentFramework.Tools;
Expand All @@ -11,7 +10,7 @@ public sealed class ChatMessagesTool(IServiceProvider serviceProvider) : AITool,
{
private readonly IServiceProvider _serviceProvider = serviceProvider;

public string PluginName => "ChatMessagesPlugin";
public static string PluginName => "ChatMessagesPlugin";
public string FunctionName => _currentFunctionName;
public Dictionary<string, object> Parameters => _currentParameters;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed class ChatSessionsTool(IServiceProvider serviceProvider) : AITool,
{
private readonly IServiceProvider _serviceProvider = serviceProvider;

public string PluginName => "ChatSessionsPlugin";
public static string PluginName => "ChatSessionsPlugin";
public string FunctionName => _currentFunctionName;
public Dictionary<string, object> Parameters => _currentParameters;

Expand Down
Loading
Loading