A collection of samples demonstrating how (Dapr) workflows can be utilized for AI.
- Dapr 1.12 or later
- .NET 8 or later
- Azure subscription and Azure Open AI resource
-
In a terminal, export the following environment variables:
AZURE_OPEN_AI_ENDPOINT
: The endpoint for the Azure Open AI resourceAZURE_OPEN_AI_DEPLOYMENT
: The name of a deployed Azure Open AI modelAZURE_OPEN_AI_KEY
: A key for the Azure Open AI resource
-
Start the Aspire host:
cd src/AspireHost dotnet run
-
Open the Aspire dashboard (listed in the output) to identify the workflow service Swagger endpoint
-
Execute the
start-session
endpoint (using an arbitraryinstanceId
) -
Execute the
continue-session
endpoint (using the sameinstanceId
and an arbitraryprompt
)- Notice the response body is the AI response to the prompt
-
Repeat the prior step as often as desired
- Notice that the AI retains context from prior prompts (e.g. your name, if provided)
-
Execute the
end-session
endpoint (using the sameinstanceId
)