diff --git a/src/ui/ManagementPortal/pages/agents/create.vue b/src/ui/ManagementPortal/pages/agents/create.vue index 33eaa75d41..4b8e9aac1a 100644 --- a/src/ui/ManagementPortal/pages/agents/create.vue +++ b/src/ui/ManagementPortal/pages/agents/create.vue @@ -558,6 +558,43 @@ /> + +
Which AI model should the orchestrator use?
+ + + + + + +
Would you like to assign this agent to a cost center?
@@ -580,53 +617,6 @@ />
- -
System Prompt
@@ -675,6 +665,7 @@ import type { Agent, AgentIndex, AgentDataSource, + AIModel, DataSource, CreateAgentRequest, ExternalOrchestrationService, @@ -711,6 +702,9 @@ const getDefaultFormValues = () => { editTextEmbeddingProfile: false as boolean, selectedTextEmbeddingProfile: null as null | TextEmbeddingProfile, + editAIModel: false as boolean, + selectedAIModel: null as null | AIModel, + chunkSize: 500, overlapSize: 50, @@ -733,34 +727,7 @@ const getDefaultFormValues = () => { orchestration_settings: { orchestrator: 'LangChain' as string, - endpoint_configuration: { - auth_type: 'key' as string, - provider: 'microsoft' as string, - endpoint: 'FoundationaLLM:AzureOpenAI:API:Endpoint' as string, - api_key: 'FoundationaLLM:AzureOpenAI:API:Key' as string, - api_version: 'FoundationaLLM:AzureOpenAI:API:Version' as string, - //operation_type: 'chat' as string, - } as object, - model_parameters: { - deployment_name: 'FoundationaLLM:AzureOpenAI:API:Completions:DeploymentName' as string, - temperature: 0 as number, - } as object, }, - - api_endpoint: 'FoundationaLLM:AzureOpenAI:API:Endpoint', - api_key: 'FoundationaLLM:AzureOpenAI:API:Key', - api_version: 'FoundationaLLM:AzureOpenAI:API:Version', - version: 'FoundationaLLM:AzureOpenAI:API:Completions:ModelVersion', - deployment: 'FoundationaLLM:AzureOpenAI:API:Completions:DeploymentName', - - // resolved_orchestration_settings: { - // endpoint_configuration: { - // endpoint: '' as string, - // api_key: '' as string, - // api_version: '' as string, - // operation_type: 'chat' as string, - // } as object, - // }, }; }; @@ -795,6 +762,7 @@ export default { indexSources: [] as AgentIndex[], textEmbeddingProfileSources: [] as TextEmbeddingProfile[], externalOrchestratorOptions: [] as ExternalOrchestrationService[], + aiModelOptions: [] as AIModel[], orchestratorOptions: [ { @@ -898,6 +866,12 @@ export default { const externalOrchestrationServicesResult = await api.getExternalOrchestrationServices(); this.externalOrchestratorOptions = externalOrchestrationServicesResult.map(result => result.resource); + this.loadingStatusText = 'Retrieving AI models...'; + const aiModelsResult = await api.getAIModels(); + this.aiModelOptions = aiModelsResult.map(result => result.resource); + // Filter the AIModels so we only display the ones where the type is 'completion'. + this.aiModelOptions = this.aiModelOptions.filter((model) => model.type === 'completion'); + // Update the orchestratorOptions with the externalOrchestratorOptions. this.orchestratorOptions = this.orchestratorOptions.concat( this.externalOrchestratorOptions.map((service) => ({ @@ -960,27 +934,6 @@ export default { this.orchestration_settings.orchestrator = agent.orchestration_settings?.orchestrator || this.orchestration_settings.orchestrator; - this.orchestration_settings.endpoint_configuration.endpoint = - agent.orchestration_settings?.endpoint_configuration?.endpoint || - this.orchestration_settings.endpoint_configuration.endpoint; - this.orchestration_settings.endpoint_configuration.api_key = - agent.orchestration_settings?.endpoint_configuration?.api_key || - this.orchestration_settings.endpoint_configuration.api_key; - this.orchestration_settings.endpoint_configuration.api_version = - agent.orchestration_settings?.endpoint_configuration?.api_version || - this.orchestration_settings.endpoint_configuration.api_version; - this.orchestration_settings.endpoint_configuration.operation_type = - agent.orchestration_settings?.endpoint_configuration?.operation_type || - this.orchestration_settings.endpoint_configuration.operation_type; - - this.orchestration_settings.model_parameters.deployment_name = - agent.orchestration_settings?.model_parameters?.deployment_name || - this.orchestration_settings.model_parameters.deployment_name; - this.orchestration_settings.model_parameters.temperature = - agent.orchestration_settings?.model_parameters?.temperature || - this.orchestration_settings.model_parameters.temperature; - - // this.resolved_orchestration_settings = agent.resolved_orchestration_settings || this.resolved_orchestration_settings; if (agent.vectorization) { this.dedicated_pipeline = agent.vectorization.dedicated_pipeline; @@ -1009,20 +962,25 @@ export default { this.dataSources.find( (dataSource) => dataSource.object_id === agent.vectorization?.data_source_object_id, ) || null; + + this.selectedAIModel = + this.aiModelOptions.find( + (aiModel) => aiModel.object_id === agent.ai_model_object_id, + ) || null; this.conversationHistory = agent.conversation_history?.enabled || this.conversationHistory; this.conversationMaxMessages = agent.conversation_history?.max_history || this.conversationMaxMessages; - this.gatekeeperEnabled = Boolean(agent.gatekeeper?.use_system_setting); + this.gatekeeperEnabled = Boolean(agent.gatekeeper_settings?.use_system_setting); - if (agent.gatekeeper && agent.gatekeeper.options) { + if (agent.gatekeeper_settings && agent.gatekeeper_settings.options) { this.selectedGatekeeperContentSafety = this.gatekeeperContentSafetyOptions.filter((localOption) => - agent.gatekeeper?.options?.includes(localOption.code) + agent.gatekeeper_settings?.options?.includes(localOption.code) ) || this.selectedGatekeeperContentSafety; this.selectedGatekeeperDataProtection = this.gatekeeperDataProtectionOptions.filter((localOption) => - agent.gatekeeper?.options?.includes(localOption.code) + agent.gatekeeper_settings?.options?.includes(localOption.code) ) || this.selectedGatekeeperDataProtection; } }, @@ -1096,6 +1054,11 @@ export default { this.editTextEmbeddingProfile = false; }, + handleAIModelSelected(aiModel: AIModel) { + this.selectedAIModel = aiModel; + this.editAIModel = false; + }, + async handleCreateAgent() { const errors = []; if (!this.agentName) { @@ -1116,6 +1079,14 @@ export default { errors.push('Please provide a system prompt.'); } + if (!this.orchestration_settings.orchestrator) { + errors.push('Please select an orchestrator.'); + } + + if (!this.selectedAIModel) { + errors.push('Please select an AI model for the orchestrator.'); + } + // if (!this.selectedDataSource) { // errors.push('Please select a data source.'); // } @@ -1222,7 +1193,7 @@ export default { max_history: Number(this.conversationMaxMessages), }, - gatekeeper: { + gatekeeper_settings: { use_system_setting: this.gatekeeperEnabled, options: [ ...(this.selectedGatekeeperContentSafety || []).map((option: any) => option.code), @@ -1234,6 +1205,7 @@ export default { prompt_object_id: promptObjectId, orchestration_settings: this.orchestration_settings, + ai_model_object_id: this.selectedAIModel.object_id, }; if (this.editAgent) {