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
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,32 @@ export const ParameterSection = ({
if (!isNullOrUndefined(newValue) && !isNullOrUndefined(oldValue) && newValue !== oldValue && !isNullOrUndefined(connector)) {
dispatch(dynamicallyLoadAgentConnection({ nodeId, connector, modelType: newValue }));
}

// Clear deploymentModelProperties when switching away from MicrosoftFoundry.
// For AzureOpenAI the backend derives model info from the deployment itself.
if (newValue !== 'MicrosoftFoundry') {
updatedDependencies.inputs ??= {};
for (const key of [
'inputs.$.agentModelSettings.deploymentModelProperties.name',
'inputs.$.agentModelSettings.deploymentModelProperties.format',
'inputs.$.agentModelSettings.deploymentModelProperties.version',
]) {
const targetParam = parameterGroup.parameters.find((param) => equals(key, param.parameterKey, true));
if (targetParam) {
updatedDependencies.inputs[key] = {
definition: targetParam.schema,
dependencyType: 'AgentSchema' as const,
dependentParameters: { [id]: { isValid: true } },
parameter: {
key,
name: targetParam.parameterName ?? '',
type: targetParam.type ?? '',
value: [createLiteralValueSegment('')],
},
};
}
}
}
}

const isAgentDeployment = isAgentConnectorAndDeploymentId(operationInfo.connectorId ?? '', parameter?.parameterName ?? '');
Expand All @@ -1052,48 +1078,38 @@ export const ParameterSection = ({

if (isAgentDeployment) {
const selectedModelId = value?.length ? value[0]?.value : undefined;
const currentModelType = findFoundryParam(nodeInputs.parameterGroups, group.id, agentModelTypeParameterKey)?.value?.[0]?.value;

// Look up the deployment from the API response (deployment.name = deploymentId, deployment.properties.model.name = modelId)
const deploymentInfo = selectedModelId
? deploymentsForCognitiveServiceAccount?.find((deployment: any) => deployment.name === selectedModelId)
: undefined;

const modelName = deploymentInfo?.properties?.model?.name;
let modelFormat = deploymentInfo?.properties?.model?.format;
let modelVersion = deploymentInfo?.properties?.model?.version;

// For MicrosoftFoundry, format and version are not in the ARM response — fill from AGENT_MODEL_CONFIG
if (!modelFormat || !modelVersion) {
const config = modelName ? AGENT_MODEL_CONFIG[modelName] : undefined;
if (!modelFormat) {
modelFormat = config?.format ?? 'OpenAI';
}
if (!modelVersion) {
modelVersion = config?.version;
}
}
// Only populate deploymentModelProperties for MicrosoftFoundry.
// For AzureOpenAI the backend derives model info from the deployment itself.
if (currentModelType === 'MicrosoftFoundry' && selectedModelId) {
const config = AGENT_MODEL_CONFIG[selectedModelId];
const modelName = selectedModelId;
const modelFormat = config?.format ?? 'OpenAI';
const modelVersion = config?.version;
Comment thread
Elaina-Lee marked this conversation as resolved.

updatedDependencies.inputs ??= {};
updatedDependencies.inputs ??= {};

const agentDeploymentKeys = [
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.name',
default: modelName,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.format',
default: modelFormat,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.version',
default: modelVersion,
},
];
const agentDeploymentKeys = [
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.name',
default: modelName,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.format',
default: modelFormat,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.version',
default: modelVersion,
},
];

for (const { key, default: defaultValue } of agentDeploymentKeys) {
const dependency = buildDependentParam(key, defaultValue);
if (dependency) {
updatedDependencies.inputs[key] = dependency;
for (const { key, default: defaultValue } of agentDeploymentKeys) {
const dependency = buildDependentParam(key, defaultValue);
if (dependency) {
updatedDependencies.inputs[key] = dependency;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,54 +1031,70 @@ export const ParameterSection = ({
})
);
}

// Clear deploymentModelProperties when switching away from MicrosoftFoundry.
// For AzureOpenAI the backend derives model info from the deployment itself.
if (newValue !== 'MicrosoftFoundry') {
updatedDependencies.inputs ??= {};
for (const key of [
'inputs.$.agentModelSettings.deploymentModelProperties.name',
'inputs.$.agentModelSettings.deploymentModelProperties.format',
'inputs.$.agentModelSettings.deploymentModelProperties.version',
]) {
const targetParam = parameterGroup.parameters.find((param) => equals(key, param.parameterKey, true));
if (targetParam) {
updatedDependencies.inputs[key] = {
definition: targetParam.schema,
dependencyType: 'AgentSchema' as const,
dependentParameters: { [id]: { isValid: true } },
parameter: {
key,
name: targetParam.parameterName ?? '',
type: targetParam.type ?? '',
value: [createLiteralValueSegment('')],
},
};
}
}
}
}

const isAgentDeployment = isAgentConnectorAndDeploymentId(operationInfo.connectorId ?? '', parameter?.parameterName ?? '');

if (isAgentDeployment) {
const selectedModelId = value?.length ? value[0]?.value : undefined;
const currentModelType = findFoundryParam(nodeInputs.parameterGroups, group.id, agentModelTypeParameterKey)?.value?.[0]?.value;

// Look up the deployment from the API response (deployment.name = deploymentId, deployment.properties.model.name = modelId)
const deploymentInfo = selectedModelId
? deploymentsForCognitiveServiceAccount?.find((deployment: any) => deployment.name === selectedModelId)
: undefined;
// Only populate deploymentModelProperties for MicrosoftFoundry.
// For AzureOpenAI the backend derives model info from the deployment itself.
if (currentModelType === 'MicrosoftFoundry' && selectedModelId) {
const config = AGENT_MODEL_CONFIG[selectedModelId];
const modelName = selectedModelId;
Comment thread
Elaina-Lee marked this conversation as resolved.
const modelFormat = config?.format ?? 'OpenAI';
const modelVersion = config?.version;

const modelName = deploymentInfo?.properties?.model?.name;
let modelFormat = deploymentInfo?.properties?.model?.format;
let modelVersion = deploymentInfo?.properties?.model?.version;
updatedDependencies.inputs ??= {};

// For MicrosoftFoundry, format and version are not in the ARM response — fill from AGENT_MODEL_CONFIG
if (!modelFormat || !modelVersion) {
const config = modelName ? AGENT_MODEL_CONFIG[modelName] : undefined;
if (!modelFormat) {
modelFormat = config?.format ?? 'OpenAI';
}
if (!modelVersion) {
modelVersion = config?.version;
}
}

updatedDependencies.inputs ??= {};

const agentDeploymentKeys = [
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.name',
default: modelName,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.format',
default: modelFormat,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.version',
default: modelVersion,
},
];
const agentDeploymentKeys = [
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.name',
default: modelName,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.format',
default: modelFormat,
},
{
key: 'inputs.$.agentModelSettings.deploymentModelProperties.version',
default: modelVersion,
},
];

for (const { key, default: defaultValue } of agentDeploymentKeys) {
const dependency = buildDependentParam(id, key, defaultValue);
if (dependency) {
updatedDependencies.inputs[key] = dependency;
for (const { key, default: defaultValue } of agentDeploymentKeys) {
const dependency = buildDependentParam(id, key, defaultValue);
if (dependency) {
updatedDependencies.inputs[key] = dependency;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,12 @@ export default {
title: 'Model name',
description: 'Name of the model which you want to use for the agent',
type: 'string',
default: 'gpt-4.1',
'x-ms-input-dependencies': {
type: 'visibility',
parameters: [
{
name: 'agentModelType',
values: ['AzureOpenAI', 'MicrosoftFoundry'],
values: ['MicrosoftFoundry'],
},
],
},
Expand All @@ -513,13 +512,12 @@ export default {
title: 'Model format',
description: 'Format of the model you are using',
type: 'string',
default: 'OpenAI',
'x-ms-input-dependencies': {
type: 'visibility',
parameters: [
{
name: 'agentModelType',
values: ['AzureOpenAI', 'MicrosoftFoundry'],
values: ['MicrosoftFoundry'],
},
],
},
Expand All @@ -528,13 +526,12 @@ export default {
title: 'Model version',
description: 'Version of the model you are using',
type: 'string',
default: '2025-06-10',
'x-ms-input-dependencies': {
type: 'visibility',
parameters: [
{
name: 'agentModelType',
values: ['AzureOpenAI', 'MicrosoftFoundry'],
values: ['MicrosoftFoundry'],
},
],
},
Expand Down
Loading