From 72bbe3ac44319bb75d7a05ca0e7fe97b91ee5eb3 Mon Sep 17 00:00:00 2001 From: Carey Payette Date: Thu, 13 Feb 2025 17:34:48 -0500 Subject: [PATCH] Fixes from testing vectorization pipeline at agent creation --- .../AgentResourceProviderService.cs | 8 +++++--- .../Controllers/ResourceController.cs | 2 +- .../Handlers/IndexingHandler.cs | 2 +- src/ui/ManagementPortal/js/types.ts | 16 ++++++++-------- src/ui/ManagementPortal/pages/agents/create.vue | 8 ++++---- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/dotnet/Agent/ResourceProviders/AgentResourceProviderService.cs b/src/dotnet/Agent/ResourceProviders/AgentResourceProviderService.cs index 8c3a5c91af..53144bfd09 100644 --- a/src/dotnet/Agent/ResourceProviders/AgentResourceProviderService.cs +++ b/src/dotnet/Agent/ResourceProviders/AgentResourceProviderService.cs @@ -205,16 +205,18 @@ private async Task UpdateAgent(ResourcePath resour }; agent.ObjectId = resourcePath.GetObjectId(_instanceSettings.Id, _name); - - if ((agent is KnowledgeManagementAgent { Vectorization.DedicatedPipeline: true, InlineContext: false } kmAgent)) + + if (agent is KnowledgeManagementAgent { Vectorization.DedicatedPipeline: true, InlineContext: false } kmAgent) { + // If the agent is new, create the associated vectorization pipeline in an active state so the initial population is done. + bool isPipelineActive = existingAgentReference is null; var result = await GetResourceProviderServiceByName(ResourceProviderNames.FoundationaLLM_Vectorization) .HandlePostAsync( $"/instances/{_instanceSettings.Id}/providers/{ResourceProviderNames.FoundationaLLM_Vectorization}/{VectorizationResourceTypeNames.VectorizationPipelines}/{kmAgent.Name}", JsonSerializer.Serialize(new VectorizationPipeline { Name = kmAgent.Name, - Active = true, + Active = isPipelineActive, Description = $"Vectorization data pipeline dedicated to the {kmAgent.Name} agent.", DataSourceObjectId = kmAgent.Vectorization.DataSourceObjectId!, TextPartitioningProfileObjectId = kmAgent.Vectorization.TextPartitioningProfileObjectId!, diff --git a/src/dotnet/ManagementAPI/Controllers/ResourceController.cs b/src/dotnet/ManagementAPI/Controllers/ResourceController.cs index 7507b2e87b..5971761b0d 100644 --- a/src/dotnet/ManagementAPI/Controllers/ResourceController.cs +++ b/src/dotnet/ManagementAPI/Controllers/ResourceController.cs @@ -119,7 +119,7 @@ await HandleRequest( async (resourceProviderService) => { await resourceProviderService.HandleDeleteAsync($"instances/{instanceId}/providers/{resourceProvider}/{resourcePath}", _callContext.CurrentUserIdentity); - return new OkResult(); + return new OkObjectResult(new ResourceProviderActionResult(true)); }); private async Task HandleRequest(string resourceProvider, string resourcePath, Func> handler) diff --git a/src/dotnet/VectorizationEngine/Handlers/IndexingHandler.cs b/src/dotnet/VectorizationEngine/Handlers/IndexingHandler.cs index ccd73bb869..62b4680f63 100644 --- a/src/dotnet/VectorizationEngine/Handlers/IndexingHandler.cs +++ b/src/dotnet/VectorizationEngine/Handlers/IndexingHandler.cs @@ -92,7 +92,7 @@ protected override async Task ProcessRequest( var indexingResult = await Service.IndexEmbeddingsAsync( embeddedContent, - ((IndexingProfile)VectorizationProfile).Settings!["IndexName"]); + ((IndexingProfile)VectorizationProfile).Settings!["index_name"]); state.AddOrReplaceIndexReferences(indexingResult); diff --git a/src/ui/ManagementPortal/js/types.ts b/src/ui/ManagementPortal/js/types.ts index 508a164350..844eed236c 100644 --- a/src/ui/ManagementPortal/js/types.ts +++ b/src/ui/ManagementPortal/js/types.ts @@ -298,10 +298,10 @@ export type AgentIndex = ResourceBase & { export type TextPartitioningProfile = ResourceBase & { text_splitter: string; settings: { - Tokenizer: string; - TokenizerEncoder: string; - ChunkSizeTokens: string; - OverlapSizeTokens: string; + tokenizer: string; + tokenizer_encoder: string; + chunk_size_tokens: string; + overlap_size_tokens: string; }; }; @@ -451,10 +451,10 @@ export type CreatePromptRequest = ResourceBase & { export type CreateTextPartitioningProfileRequest = ResourceBase & { text_splitter: string; settings: { - Tokenizer: string; - TokenizerEncoder: string; - ChunkSizeTokens: string; - OverlapSizeTokens: string; + tokenizer: string; + tokenizer_encoder: string; + chunk_size_tokens: string; + overlap_size_tokens: string; }; }; diff --git a/src/ui/ManagementPortal/pages/agents/create.vue b/src/ui/ManagementPortal/pages/agents/create.vue index 4de2bad0a5..239150016a 100644 --- a/src/ui/ManagementPortal/pages/agents/create.vue +++ b/src/ui/ManagementPortal/pages/agents/create.vue @@ -1842,10 +1842,10 @@ export default { text_splitter: 'TokenTextSplitter', name: this.agentName, settings: { - Tokenizer: 'MicrosoftBPETokenizer', - TokenizerEncoder: 'cl100k_base', - ChunkSizeTokens: this.chunkSize.toString(), - OverlapSizeTokens: this.overlapSize.toString(), + tokenizer: 'MicrosoftBPETokenizer', + tokenizer_encoder: 'cl100k_base', + chunk_size_tokens: this.chunkSize.toString(), + overlap_size_tokens: this.overlapSize.toString(), }, };