- Re-architect VoiceSession into full-bleed studio cockpit with overlay slide-over companion drawer - Eliminate width squishing defect on LiveInsightPanel and add native dark/light theme support - Integrate authentic Google Gemini 3.8 Flash TTS with Fenrir persona and fallback audio pipeline - Implement comprehensive Playwright E2E visual regression suite across Desktop, iPad, and iPhone (21 tests, 45 snapshots) - Migrate core application to Svelte 5 runes (, , ) with reactive stores - Maintain .NET 8 Azure Functions serverless endpoints and clean build hygiene
2.7 KiB
2.7 KiB
name, description
| name | description |
|---|---|
| azure-functions-genai | Guides the design, implementation, and debugging of Azure Functions v4 (.NET 8/10 Isolated Worker) using the official Google.GenAI C# SDK for serverless AI endpoints. |
Azure Functions & Google.GenAI C# SDK Skill
Use this skill when developing, updating, or testing the C# serverless API endpoints located in api/.
1. Solution Architecture
The backend consists of an Azure Functions v4 Isolated Worker targeting .NET 8.0:
- Project file:
api/api.csproj - Runtime:
Microsoft.Azure.Functions.Worker2.50+ &Google.GenAI1.20+ - Host configuration:
api/host.json - Application Insights integration:
Microsoft.ApplicationInsights.WorkerService
2. Google.GenAI C# SDK Integration Patterns
2.1 Namespaces & Types
using Google.GenAI;
using Google.GenAI.Types;
using Type = Google.GenAI.Types.Type; // Disambiguate with System.Type
2.2 Client Initialization
var apiKey = System.Environment.GetEnvironmentVariable("GEMINI_API_KEY");
var client = new Client(apiKey: apiKey);
2.3 Structured Output Generation (JSON Schema)
var schema = new Schema
{
Type = Type.Object,
Properties = new Dictionary<string, Schema>
{
{ "distortionsIdentified", new Schema { Type = Type.Array, Items = new Schema { Type = Type.String } } },
{ "techniquesUsed", new Schema { Type = Type.Array, Items = new Schema { Type = Type.String } } },
{ "clinicalInsight", new Schema { Type = Type.String } },
{ "feedbackType", new Schema { Type = Type.String, Enum = new List<string> { "Constructive", "Positive", "Neutral" } } }
},
Required = new List<string> { "distortionsIdentified", "techniquesUsed", "clinicalInsight", "feedbackType" }
};
var response = await client.Models.GenerateContentAsync(
model: "gemini-2.5-flash",
contents: promptContent,
config: new GenerateContentConfig
{
SystemInstruction = new Content { Parts = new List<Part> { new Part { Text = systemInstruction } } },
ResponseMimeType = "application/json",
ResponseSchema = schema
});
3. Endpoints Matrix
| Route | HTTP Method | Function Name | Purpose |
|---|---|---|---|
/api/chat |
POST |
ChatProgression |
Headless roleplay progression with strict anti-meta guardrails |
/api/analysis |
POST |
ClinicalAnalysis |
Real-time clinical supervisor turn evaluation |
/api/scenario/generate |
POST |
GenerateScenario |
Dynamic CBT roleplay scenario generation |
4. Local Build & Test Verification
# Build the C# API project
dotnet build api/api.csproj
# Run local functions host (requires Azure Functions Core Tools)
func start --csharp --prefix api