mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET Workflows - Clean-up declarative docs and product-context. (#1134)
* Clean-up * Rollback sample --------- Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
This commit is contained in:
@@ -101,7 +101,9 @@ internal sealed class Program
|
||||
DeclarativeWorkflowOptions options =
|
||||
new(new AzureAgentProvider(this.FoundryEndpoint, new AzureCliCredential()))
|
||||
{
|
||||
Configuration = this.Configuration
|
||||
Configuration = this.Configuration,
|
||||
//ConversationId = null, // Assign to continue a conversation
|
||||
//LoggerFactory = null, // Assign to enable logging
|
||||
};
|
||||
|
||||
return DeclarativeWorkflowBuilder.Build<string>(this.WorkflowFile, options);
|
||||
|
||||
@@ -16,9 +16,12 @@ You can also use environment variables if you prefer.
|
||||
To set your secrets as an environment variable (PowerShell):
|
||||
|
||||
```pwsh
|
||||
$env:AZURE_FOUNDRY_PROJECT_ENDPOINT="https://..."
|
||||
$env:FOUNDRY_PROJECT_ENDPOINT="https://..."
|
||||
```
|
||||
|
||||
etc...
|
||||
|
||||
|
||||
To set your secrets with .NET Secret Manager:
|
||||
|
||||
1. From the root of the repository, navigate the console to the project folder:
|
||||
@@ -48,7 +51,13 @@ To set your secrets with .NET Secret Manager:
|
||||
5. Define setting that identifies your Azure Foundry Model Deployment (endpoint):
|
||||
|
||||
```
|
||||
dotnet user-secrets set "FOUNDRY_MODEL_DEPLOYMENT_NAME" "https://..."
|
||||
dotnet user-secrets set "FOUNDRY_MODEL_DEPLOYMENT_NAME" "gpt-4.1"
|
||||
```
|
||||
|
||||
6. Define setting that identifies your Bing Grounding connection:
|
||||
|
||||
```
|
||||
dotnet user-secrets set "FOUNDRY_CONNECTION_GROUNDING_TOOL" "mybinggrounding"
|
||||
```
|
||||
|
||||
#### Authorization
|
||||
@@ -67,7 +76,7 @@ The sample workflows rely on agents defined in your Azure Foundry Project.
|
||||
To create agents, run the [`Create.ps1`](../../../../../workflow-samples/setup/) script.
|
||||
This will create the agents used in the sample workflows in your Azure Foundry Project and format a script you can copy and use to configure your environment.
|
||||
|
||||
> Note: `Create.ps1` relies upon the `FOUNDRY_PROJECT_ENDPOINT` and `FOUNDRY_MODEL_DEPLOYMENT_NAME` settings.
|
||||
> Note: `Create.ps1` relies upon the `FOUNDRY_PROJECT_ENDPOINT`, `FOUNDRY_MODEL_DEPLOYMENT_NAME`, and `FOUNDRY_CONNECTION_GROUNDING_TOOL` settings.
|
||||
|
||||
## Execution
|
||||
|
||||
|
||||
@@ -30,7 +30,12 @@ internal sealed class Program
|
||||
Stopwatch timer = Stopwatch.StartNew();
|
||||
|
||||
// Use DeclarativeWorkflowBuilder to generate code based on a YAML file.
|
||||
string code = DeclarativeWorkflowBuilder.Eject(this.WorkflowFile, DeclarativeWorkflowLanguage.CSharp, workflowNamespace: "Demo.DeclarativeCode", workflowPrefix: "Sample");
|
||||
string code =
|
||||
DeclarativeWorkflowBuilder.Eject(
|
||||
this.WorkflowFile,
|
||||
DeclarativeWorkflowLanguage.CSharp,
|
||||
workflowNamespace: "Demo.DeclarativeCode",
|
||||
workflowPrefix: "Sample");
|
||||
|
||||
Notify($"\nWORKFLOW: Defined {timer.Elapsed}\n");
|
||||
|
||||
|
||||
+2
@@ -22,6 +22,8 @@ internal sealed class WorkflowTemplateVisitor : DialogActionVisitor
|
||||
{
|
||||
this._rootId = workflowId;
|
||||
this._workflowModel = new WorkflowModel<string>(new RootTemplate(workflowId, typeInfo));
|
||||
|
||||
WorkflowDiagnostics.SetFoundryProduct();
|
||||
}
|
||||
|
||||
public bool HasUnsupportedActions { get; private set; }
|
||||
|
||||
@@ -19,6 +19,14 @@ internal static class WorkflowDiagnostics
|
||||
{
|
||||
private static readonly WorkflowFeatureConfiguration s_semanticFeatureConfig = new();
|
||||
|
||||
public static void SetFoundryProduct()
|
||||
{
|
||||
if (!ProductContext.IsLocalScopeSupported())
|
||||
{
|
||||
ProductContext.SetContext(Product.Foundry);
|
||||
}
|
||||
}
|
||||
|
||||
public static WorkflowTypeInfo Describe<TElement>(this TElement workflowElement) where TElement : BotElement, IDialogBase
|
||||
{
|
||||
SemanticModel semanticModel = workflowElement.GetSemanticModel(new PowerFxExpressionChecker(s_semanticFeatureConfig), s_semanticFeatureConfig);
|
||||
|
||||
+1
-4
@@ -121,10 +121,7 @@ internal sealed class WorkflowFormulaState
|
||||
|
||||
public static string GetScopeName(string? scopeName)
|
||||
{
|
||||
if (!ProductContext.IsLocalScopeSupported())
|
||||
{
|
||||
ProductContext.SetContext(Product.Foundry);
|
||||
}
|
||||
WorkflowDiagnostics.SetFoundryProduct();
|
||||
|
||||
scopeName ??= DefaultScopeName;
|
||||
|
||||
|
||||
@@ -24,4 +24,5 @@ The sample workflows rely on agents defined in your Azure Foundry Project.
|
||||
To create agents, run the [`Create.ps1`](./setup) script.
|
||||
This will create the agents used in the sample workflows in your Azure Foundry Project and format a script you can copy and use to configure your environment.
|
||||
|
||||
> Note: `Create.ps1` relies upon the `FOUNDRY_PROJECT_ENDPOINT` setting. See [README.md](../dotnet/samples/GettingStarted/Workflows/Declarative/README.md) from the demo for configuration details.
|
||||
> Note: `Create.ps1` relies upon the `FOUNDRY_PROJECT_ENDPOINT`, `FOUNDRY_MODEL_DEPLOYMENT_NAME`, and `FOUNDRY_CONNECTION_GROUNDING_TOOL` settings.
|
||||
See [README.md](../dotnet/samples/GettingStarted/Workflows/Declarative/README.md) from the demo for configuration details.
|
||||
|
||||
Reference in New Issue
Block a user