From 51395c082bf59acb644bf6a3c2685d883151138e Mon Sep 17 00:00:00 2001 From: HarshKatoreAnsys Date: Tue, 23 Sep 2025 13:26:33 +0530 Subject: [PATCH 1/8] feat: add similarity search and tag processing functions to external functions --- pkg/externalfunctions/ansysmeshpilot.go | 271 +++++++++++++++++++++ pkg/externalfunctions/externalfunctions.go | 9 +- pkg/meshpilot/ampgraphdb/graphdb.go | 51 ++++ 3 files changed, 330 insertions(+), 1 deletion(-) diff --git a/pkg/externalfunctions/ansysmeshpilot.go b/pkg/externalfunctions/ansysmeshpilot.go index bb3e24ae..6d891a65 100644 --- a/pkg/externalfunctions/ansysmeshpilot.go +++ b/pkg/externalfunctions/ansysmeshpilot.go @@ -2290,3 +2290,274 @@ func SelectedSolution(selectedSolution string) (solution string) { solution = selectedSolution return solution } + +// PerformSimilaritySearchForSubqueries performs similarity search for each sub-query and returns Q&A pairs +// +// Tags: +// - @displayName: PerformSimilaritySearchForSubqueries +// +// Parameters: +// - subQueries: the list of expanded sub-queries +// - collection: the vector database collection name +// - similaritySearchResults: the number of similarity search results +// - similaritySearchMinScore: the minimum similarity score threshold +// +// Returns: +// - uniqueQAPairs: the unique Q&A pairs from similarity search results +func PerformSimilaritySearchForSubqueries(subQueries []string, collection string, similaritySearchResults int, similaritySearchMinScore float64) (uniqueQAPairs []map[string]interface{}) { + ctx := &logging.ContextMap{} + uniqueQAPairs = []map[string]interface{}{} + uniqueQuestions := make(map[string]bool) + + client, err := qdrant_utils.QdrantClient() + if err != nil { + logging.Log.Error(ctx, fmt.Sprintf("unable to create qdrant client: %v", err)) + return + } + + for _, subQuery := range subQueries { + logging.Log.Debugf(ctx, "Processing sub-query: %s", subQuery) + embeddedVector, _ := PerformVectorEmbeddingRequest(subQuery, false) + if len(embeddedVector) == 0 { + logging.Log.Warnf(ctx, "Failed to get embedding for sub-query: %s", subQuery) + continue + } + + limit := uint64(similaritySearchResults) + scoreThreshold := float32(similaritySearchMinScore) + query := qdrant.QueryPoints{ + CollectionName: collection, + Query: qdrant.NewQueryDense(embeddedVector), + Limit: &limit, + ScoreThreshold: &scoreThreshold, + WithVectors: qdrant.NewWithVectorsEnable(false), + WithPayload: qdrant.NewWithPayloadEnable(true), + } + + scoredPoints, err := client.Query(context.TODO(), &query) + if err != nil { + logging.Log.Warnf(ctx, "Qdrant query failed: %v", err) + continue + } + + for _, scoredPoint := range scoredPoints { + payload, err := qdrant_utils.QdrantPayloadToType[map[string]interface{}](scoredPoint.GetPayload()) + if err != nil { + logging.Log.Warnf(ctx, "Failed to parse payload: %v", err) + continue + } + question, _ := payload["question"].(string) + answer, _ := payload["answer"].(string) + if question == "" { + continue + } + if !uniqueQuestions[question] { + qaPair := map[string]interface{}{ + "question": question, + "answer": answer, + } + uniqueQAPairs = append(uniqueQAPairs, qaPair) + uniqueQuestions[question] = true + } + } + } + for i, qa := range uniqueQAPairs { + logging.Log.Debugf(ctx, "Unique QA Pair #%d: Question: %s, Answer: %s", i+1, qa["question"], qa["answer"]) + } + logging.Log.Infof(ctx, "Simple similarity search complete. Found %d unique Q&A pairs from %d sub-queries", len(uniqueQAPairs), len(subQueries)) + return uniqueQAPairs +} + +// ProcessGetTagsOutput parses the response and returns the tags slice. +// +// Tags: +// - @displayName: ProcessGetTagsOutput +// +// Parameters: +// - response: the JSON response string +// +// Returns: +// - tags: the list of tags +func ProcessGetTagsOutput(response string) (tags []string) { + ctx := &logging.ContextMap{} + + err := json.Unmarshal([]byte(response), &tags) + if err != nil { + logging.Log.Errorf(ctx, "Error decoding JSON response: %v", err) + return []string{} + } + logging.Log.Debugf(ctx, "Generated Tags: %s", strings.Join(tags, ", ")) + if len(tags) == 0 { + logging.Log.Error(ctx, "No tags generated.") + return nil + } + return tags +} + +// GenerateMKSummariesforTags retrieves unique MK summaries for the provided tags from the graph database. +// +// Tags: +// - @displayName: GenerateMKSummariesforTags +// +// Parameters: +// - query: the user query +// - dbName: the name of the database +// - tags: the list of tags +// +// Returns: +// - allTagsSummaries: the list of unique MK summaries + +func GenerateMKSummariesforTags(dbName string, tags []string,GetTagIdByNameQuery string, GetMKSummaryFromDBQuery string) (allTagsSummaries []string) { + ctx := &logging.ContextMap{} + + err := ampgraphdb.EstablishConnection(config.GlobalConfig.GRAPHDB_ADDRESS, dbName) + if err != nil { + errMsg := fmt.Sprintf("error initializing graphdb: %v", err) + logging.Log.Error(ctx, errMsg) + panic(errMsg) + } + + uniqueSummaries := make(map[string]bool) + for _, tag := range tags { + // Inline GetTagIdByName + id, err := ampgraphdb.GraphDbDriver.GetTagIdByName(tag,GetTagIdByNameQuery) + if err != nil { + logging.Log.Warnf(ctx, "No tag_id found for tag %s (error: %v)", tag, err) + continue + } + if id != "" { + logging.Log.Infof(ctx, "Found tag_id %s for tag %s", id, tag) + // Inline GetMKSummaryFromDB + sum, err := ampgraphdb.GraphDbDriver.GetMKSummaryFromDB(id, GetMKSummaryFromDBQuery) + if err != nil { + logging.Log.Warnf(ctx, "Error getting MK summary for tag_id %s: %v", id, err) + continue + } + if sum != "" { + uniqueSummaries[sum] = true + } + } else { + logging.Log.Warnf(ctx, "No tag_id found for tag %s", tag) + } + } + + allTagsSummaries = make([]string, 0, len(uniqueSummaries)) + for summary := range uniqueSummaries { + allTagsSummaries = append(allTagsSummaries, summary) + } + + logging.Log.Infof(ctx, "Metatag extraction complete. Tags: %v, Summaries found: %d", tags, len(allTagsSummaries)) + return allTagsSummaries +} + +// GenerateExpandQueryUserPrompt generates a user prompt for query expansion using the provided template. +// +// Tags: +// - @displayName: GenerateExpandQueryUserPrompt +// +// Parameters: +// - userPromptTemplate: the template string with placeholders for MK Summary and User Query +// - summaries: the MK Summary string +// - query: the user query string +// +// Returns: +// - userPrompt: the formatted user prompt +func GenerateExpandQueryUserPrompt(userPromptTemplate string, summaries []string, query string) (userPrompt string) { + ctx := &logging.ContextMap{} + + allSummariesStr := strings.Join(summaries, "\n") + userPrompt = fmt.Sprintf(userPromptTemplate, allSummariesStr, query) + + logging.Log.Debugf(ctx, "Generated Expand Query User Prompt: %s", userPrompt) + + return +} + +// ProcessExpandQueryllmOutput parses the LLM response and returns the sub-queries slice. +// +// Tags: +// - @displayName: ProcessExpandQueryllmOutput +// +// Parameters: +// - response: the JSON response stringGenerateExpandQueryUserPrompt +// +// Returns: +// - subQueries: the list of sub-queries +func ProcessExpandQueryllmOutput(response string) (subQueries []string) { + ctx := &logging.ContextMap{} + + err := json.Unmarshal([]byte(response), &subQueries) + if err != nil { + logging.Log.Errorf(ctx, "Error decoding JSON response: %v", err) + return []string{} + } + + if len(subQueries) == 0 { + logging.Log.Warn(ctx, "No sub-queries generated from the userquery and summaries.") + return []string{} + } + + logging.Log.Debugf(ctx, "Generated %d sub-queries", len(subQueries)) + logging.Log.Debugf(ctx, "Expanded Sub-Queries:") + for _, subQuery := range subQueries { + logging.Log.Debugf(ctx, "- %s", subQuery) + } + + return subQueries +} + +// GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt generates a user prompt for synthesizing an answer from meta knowledge. +// +// Tags: +// - @displayName: GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt +// +// Parameters: +// - SynthesizeAnswerUserPromptTemplate: the template string with placeholders for original query, expanded sub-queries, and retrieved Q&A pairs +// - originalQuery: the user's original query +// - expandedQueries: the expanded sub-queries +// - retrievedQAPairs: the retrieved Q&A pairs +// +// Returns: +// - userPrompt: the formatted user prompt +func GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt( + SynthesizeAnswerUserPromptTemplate string, + originalQuery string, + expandedQueries []string, + retrievedQAPairs []map[string]interface{}, +) (userPrompt string) { + ctx := &logging.ContextMap{} + + expandedQueriesStr := fmt.Sprintf("[%s]", strings.Join(expandedQueries, ", ")) + qaPairsBytes, _ := json.MarshalIndent(retrievedQAPairs, "", " ") + qaPairsStr := string(qaPairsBytes) + + userPrompt = fmt.Sprintf(SynthesizeAnswerUserPromptTemplate, originalQuery, expandedQueriesStr, qaPairsStr) + + logging.Log.Debugf(ctx, "Generated Synthesize Answer User Prompt: %s", userPrompt) + return +} + +// ProcessSynthesizeAnswerFromMetaKnowledge calls the LLM to synthesize an answer from meta knowledge. +// +// Tags: +// - @displayName: ProcessSynthesizeAnswerFromMetaKnowledge +// +// Parameters: +// - userPrompt: the formatted user prompt +// - systemPrompt: the system prompt +// +// Returns: +// - answer: the synthesized answer string +func ProcessSynthesizeAnswerFromMetaKnowledgellmOutput(response string) (answer string) { + ctx := &logging.ContextMap{} + + if response == "" { + logging.Log.Warn(ctx, "Generated summary is empty. Returning default message.") + return "No relevant information found. Please try a different query." + } + trimmedResponse := strings.TrimSpace(response) + logging.Log.Debugf(ctx, "Trimmed synthesized answer: %s", trimmedResponse) + + logging.Log.Infof(ctx, "Successfully synthesized answer") + return trimmedResponse +} \ No newline at end of file diff --git a/pkg/externalfunctions/externalfunctions.go b/pkg/externalfunctions/externalfunctions.go index 9cb50397..c5b29e41 100644 --- a/pkg/externalfunctions/externalfunctions.go +++ b/pkg/externalfunctions/externalfunctions.go @@ -155,7 +155,14 @@ var ExternalFunctionsMap = map[string]interface{}{ "SelectedSolution": SelectedSolution, "ProcessMainAgentOutput": ProcessMainAgentOutput, "GenerateHelperSubWorkflowPrompt": GenerateHelperSubWorkflowPrompt, - + "PerformSimilaritySearchForSubqueries": PerformSimilaritySearchForSubqueries, + "ProcessGetTagsOutput": ProcessGetTagsOutput, + "GenerateMKSummariesforTags": GenerateMKSummariesforTags, + "GenerateExpandQueryUserPrompt": GenerateExpandQueryUserPrompt, + "ProcessExpandQueryllmOutput": ProcessExpandQueryllmOutput, + "GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt": GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt, + "ProcessSynthesizeAnswerFromMetaKnowledgellmOutput": ProcessSynthesizeAnswerFromMetaKnowledgellmOutput, + // qdrant "QdrantCreateCollection": QdrantCreateCollection, "QdrantInsertData": QdrantInsertData, diff --git a/pkg/meshpilot/ampgraphdb/graphdb.go b/pkg/meshpilot/ampgraphdb/graphdb.go index 2d8878b6..0495d3ec 100644 --- a/pkg/meshpilot/ampgraphdb/graphdb.go +++ b/pkg/meshpilot/ampgraphdb/graphdb.go @@ -308,3 +308,54 @@ func (graphdb_context *graphDbContext) GetSolutions(fmFailureCode, primeMeshFail return solutions, nil } + +func (graphdb_context *graphDbContext) GetTagIdByName(tagName string, query string) (tagId string, funcError error) { + ctx := &logging.ContextMap{} + logging.Log.Debugf(ctx, "Searching for tag: %s", tagName) + + params := aali_graphdb.ParameterMap{ + "name": aali_graphdb.StringValue(tagName), + } + + result, err := aali_graphdb.CypherQueryReadGeneric[map[string]interface{}](graphdb_context.client, graphdb_context.dbname, query, params) + if err != nil { + logging.Log.Errorf(ctx, "Error executing query: %v", err) + return "", err + } + + if len(result) > 0 { + if id, ok := result[0]["id"]; ok { + tagId = fmt.Sprintf("%v", id) + logging.Log.Debugf(ctx, "Found tag ID %s for tag %s", tagId, tagName) + } + } else { + logging.Log.Warnf(ctx, "No tag_id found for tag %s", tagName) + } + + return tagId, nil +} + +func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query string) (summary string, funcError error) { + ctx := &logging.ContextMap{} + logging.Log.Debugf(ctx, "Getting MK summary for tag ID: %s", tagId) + + params := aali_graphdb.ParameterMap{ + "tag_id": aali_graphdb.StringValue(tagId), + } + + result, err := aali_graphdb.CypherQueryReadGeneric[map[string]interface{}](graphdb_context.client, graphdb_context.dbname, query, params) + if err != nil { + logging.Log.Errorf(ctx, "Error executing query: %v", err) + return "", err + } + + if len(result) > 0 { + if content, ok := result[0]["content"]; ok { + summary = fmt.Sprintf("%v", content) + } + } else { + logging.Log.Warnf(ctx, "No MK summary found for tag ID %s", tagId) + } + + return summary, nil +} \ No newline at end of file From add478622c082a2cee04dde8268d323b63617ce9 Mon Sep 17 00:00:00 2001 From: HarshKatoreAnsys Date: Tue, 23 Sep 2025 19:07:27 +0530 Subject: [PATCH 2/8] Remove formatting mistake --- pkg/externalfunctions/externalfunctions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/externalfunctions/externalfunctions.go b/pkg/externalfunctions/externalfunctions.go index c5b29e41..fb3dbb57 100644 --- a/pkg/externalfunctions/externalfunctions.go +++ b/pkg/externalfunctions/externalfunctions.go @@ -207,4 +207,4 @@ var ExternalFunctionsMap = map[string]interface{}{ // fluent "FluentCodeGen": FluentCodeGen, -} +} \ No newline at end of file From d53544605f7431ada60e0a5a7881878d1a32014b Mon Sep 17 00:00:00 2001 From: HarshKatoreAnsys Date: Wed, 24 Sep 2025 11:06:07 +0530 Subject: [PATCH 3/8] Refactor: some custom functions --- pkg/externalfunctions/ansysmeshpilot.go | 98 ++-------------------- pkg/externalfunctions/externalfunctions.go | 6 +- 2 files changed, 10 insertions(+), 94 deletions(-) diff --git a/pkg/externalfunctions/ansysmeshpilot.go b/pkg/externalfunctions/ansysmeshpilot.go index 6d891a65..10b71702 100644 --- a/pkg/externalfunctions/ansysmeshpilot.go +++ b/pkg/externalfunctions/ansysmeshpilot.go @@ -2368,30 +2368,30 @@ func PerformSimilaritySearchForSubqueries(subQueries []string, collection string return uniqueQAPairs } -// ProcessGetTagsOutput parses the response and returns the tags slice. +// ProcessJSONListOutput parses the response and returns the tags slice. // // Tags: -// - @displayName: ProcessGetTagsOutput +// - @displayName: ProcessJSONListOutput // // Parameters: // - response: the JSON response string // // Returns: -// - tags: the list of tags -func ProcessGetTagsOutput(response string) (tags []string) { +// - tags: the list of items extracted from the response +func ProcessJSONListOutput(response string) (generatedList []string) { ctx := &logging.ContextMap{} - err := json.Unmarshal([]byte(response), &tags) + err := json.Unmarshal([]byte(response), &generatedList) if err != nil { logging.Log.Errorf(ctx, "Error decoding JSON response: %v", err) return []string{} } - logging.Log.Debugf(ctx, "Generated Tags: %s", strings.Join(tags, ", ")) - if len(tags) == 0 { - logging.Log.Error(ctx, "No tags generated.") + logging.Log.Debugf(ctx, "Generated List: %s", strings.Join(generatedList, ", ")) + if len(generatedList) == 0 { + logging.Log.Error(ctx, "No items generated.") return nil } - return tags + return generatedList } // GenerateMKSummariesforTags retrieves unique MK summaries for the provided tags from the graph database. @@ -2450,61 +2450,6 @@ func GenerateMKSummariesforTags(dbName string, tags []string,GetTagIdByNameQuery return allTagsSummaries } -// GenerateExpandQueryUserPrompt generates a user prompt for query expansion using the provided template. -// -// Tags: -// - @displayName: GenerateExpandQueryUserPrompt -// -// Parameters: -// - userPromptTemplate: the template string with placeholders for MK Summary and User Query -// - summaries: the MK Summary string -// - query: the user query string -// -// Returns: -// - userPrompt: the formatted user prompt -func GenerateExpandQueryUserPrompt(userPromptTemplate string, summaries []string, query string) (userPrompt string) { - ctx := &logging.ContextMap{} - - allSummariesStr := strings.Join(summaries, "\n") - userPrompt = fmt.Sprintf(userPromptTemplate, allSummariesStr, query) - - logging.Log.Debugf(ctx, "Generated Expand Query User Prompt: %s", userPrompt) - - return -} - -// ProcessExpandQueryllmOutput parses the LLM response and returns the sub-queries slice. -// -// Tags: -// - @displayName: ProcessExpandQueryllmOutput -// -// Parameters: -// - response: the JSON response stringGenerateExpandQueryUserPrompt -// -// Returns: -// - subQueries: the list of sub-queries -func ProcessExpandQueryllmOutput(response string) (subQueries []string) { - ctx := &logging.ContextMap{} - - err := json.Unmarshal([]byte(response), &subQueries) - if err != nil { - logging.Log.Errorf(ctx, "Error decoding JSON response: %v", err) - return []string{} - } - - if len(subQueries) == 0 { - logging.Log.Warn(ctx, "No sub-queries generated from the userquery and summaries.") - return []string{} - } - - logging.Log.Debugf(ctx, "Generated %d sub-queries", len(subQueries)) - logging.Log.Debugf(ctx, "Expanded Sub-Queries:") - for _, subQuery := range subQueries { - logging.Log.Debugf(ctx, "- %s", subQuery) - } - - return subQueries -} // GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt generates a user prompt for synthesizing an answer from meta knowledge. // @@ -2536,28 +2481,3 @@ func GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt( logging.Log.Debugf(ctx, "Generated Synthesize Answer User Prompt: %s", userPrompt) return } - -// ProcessSynthesizeAnswerFromMetaKnowledge calls the LLM to synthesize an answer from meta knowledge. -// -// Tags: -// - @displayName: ProcessSynthesizeAnswerFromMetaKnowledge -// -// Parameters: -// - userPrompt: the formatted user prompt -// - systemPrompt: the system prompt -// -// Returns: -// - answer: the synthesized answer string -func ProcessSynthesizeAnswerFromMetaKnowledgellmOutput(response string) (answer string) { - ctx := &logging.ContextMap{} - - if response == "" { - logging.Log.Warn(ctx, "Generated summary is empty. Returning default message.") - return "No relevant information found. Please try a different query." - } - trimmedResponse := strings.TrimSpace(response) - logging.Log.Debugf(ctx, "Trimmed synthesized answer: %s", trimmedResponse) - - logging.Log.Infof(ctx, "Successfully synthesized answer") - return trimmedResponse -} \ No newline at end of file diff --git a/pkg/externalfunctions/externalfunctions.go b/pkg/externalfunctions/externalfunctions.go index fb3dbb57..f5ddeb04 100644 --- a/pkg/externalfunctions/externalfunctions.go +++ b/pkg/externalfunctions/externalfunctions.go @@ -156,13 +156,9 @@ var ExternalFunctionsMap = map[string]interface{}{ "ProcessMainAgentOutput": ProcessMainAgentOutput, "GenerateHelperSubWorkflowPrompt": GenerateHelperSubWorkflowPrompt, "PerformSimilaritySearchForSubqueries": PerformSimilaritySearchForSubqueries, - "ProcessGetTagsOutput": ProcessGetTagsOutput, + "ProcessJSONListOutput": ProcessJSONListOutput, "GenerateMKSummariesforTags": GenerateMKSummariesforTags, - "GenerateExpandQueryUserPrompt": GenerateExpandQueryUserPrompt, - "ProcessExpandQueryllmOutput": ProcessExpandQueryllmOutput, "GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt": GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt, - "ProcessSynthesizeAnswerFromMetaKnowledgellmOutput": ProcessSynthesizeAnswerFromMetaKnowledgellmOutput, - // qdrant "QdrantCreateCollection": QdrantCreateCollection, "QdrantInsertData": QdrantInsertData, From 5626c9a46cb2508ebff21e0c3714fc560e6cb21c Mon Sep 17 00:00:00 2001 From: HarshKatoreAnsys Date: Wed, 24 Sep 2025 18:14:00 +0530 Subject: [PATCH 4/8] Remove newlines causing checks fail --- pkg/externalfunctions/ansysmeshpilot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/externalfunctions/ansysmeshpilot.go b/pkg/externalfunctions/ansysmeshpilot.go index 10b71702..263b3ae8 100644 --- a/pkg/externalfunctions/ansysmeshpilot.go +++ b/pkg/externalfunctions/ansysmeshpilot.go @@ -2480,4 +2480,4 @@ func GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt( logging.Log.Debugf(ctx, "Generated Synthesize Answer User Prompt: %s", userPrompt) return -} +} \ No newline at end of file From 6162d29ac3c388607c09e19af277f1a25cdd3853 Mon Sep 17 00:00:00 2001 From: HarshKatoreAnsys Date: Wed, 24 Sep 2025 18:23:51 +0530 Subject: [PATCH 5/8] Remove newlines. --- pkg/externalfunctions/ansysmeshpilot.go | 1 - pkg/meshpilot/ampgraphdb/graphdb.go | 1 - 2 files changed, 2 deletions(-) diff --git a/pkg/externalfunctions/ansysmeshpilot.go b/pkg/externalfunctions/ansysmeshpilot.go index 263b3ae8..84d1a70d 100644 --- a/pkg/externalfunctions/ansysmeshpilot.go +++ b/pkg/externalfunctions/ansysmeshpilot.go @@ -2477,7 +2477,6 @@ func GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt( qaPairsStr := string(qaPairsBytes) userPrompt = fmt.Sprintf(SynthesizeAnswerUserPromptTemplate, originalQuery, expandedQueriesStr, qaPairsStr) - logging.Log.Debugf(ctx, "Generated Synthesize Answer User Prompt: %s", userPrompt) return } \ No newline at end of file diff --git a/pkg/meshpilot/ampgraphdb/graphdb.go b/pkg/meshpilot/ampgraphdb/graphdb.go index 0495d3ec..ab75da44 100644 --- a/pkg/meshpilot/ampgraphdb/graphdb.go +++ b/pkg/meshpilot/ampgraphdb/graphdb.go @@ -356,6 +356,5 @@ func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query st } else { logging.Log.Warnf(ctx, "No MK summary found for tag ID %s", tagId) } - return summary, nil } \ No newline at end of file From 69a0001c2b9ab5e1a9c100723400d2a17e059c99 Mon Sep 17 00:00:00 2001 From: HarshKatoreAnsys Date: Wed, 24 Sep 2025 19:36:58 +0530 Subject: [PATCH 6/8] resolve style check fail --- pkg/externalfunctions/externalfunctions.go | 1 + pkg/meshpilot/ampgraphdb/graphdb.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/externalfunctions/externalfunctions.go b/pkg/externalfunctions/externalfunctions.go index f5ddeb04..bfb8ff16 100644 --- a/pkg/externalfunctions/externalfunctions.go +++ b/pkg/externalfunctions/externalfunctions.go @@ -159,6 +159,7 @@ var ExternalFunctionsMap = map[string]interface{}{ "ProcessJSONListOutput": ProcessJSONListOutput, "GenerateMKSummariesforTags": GenerateMKSummariesforTags, "GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt": GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt, + // qdrant "QdrantCreateCollection": QdrantCreateCollection, "QdrantInsertData": QdrantInsertData, diff --git a/pkg/meshpilot/ampgraphdb/graphdb.go b/pkg/meshpilot/ampgraphdb/graphdb.go index ab75da44..34cd9645 100644 --- a/pkg/meshpilot/ampgraphdb/graphdb.go +++ b/pkg/meshpilot/ampgraphdb/graphdb.go @@ -310,7 +310,9 @@ func (graphdb_context *graphDbContext) GetSolutions(fmFailureCode, primeMeshFail } func (graphdb_context *graphDbContext) GetTagIdByName(tagName string, query string) (tagId string, funcError error) { + ctx := &logging.ContextMap{} + logging.Log.Debugf(ctx, "Searching for tag: %s", tagName) params := aali_graphdb.ParameterMap{ @@ -318,6 +320,7 @@ func (graphdb_context *graphDbContext) GetTagIdByName(tagName string, query stri } result, err := aali_graphdb.CypherQueryReadGeneric[map[string]interface{}](graphdb_context.client, graphdb_context.dbname, query, params) + if err != nil { logging.Log.Errorf(ctx, "Error executing query: %v", err) return "", err @@ -336,7 +339,9 @@ func (graphdb_context *graphDbContext) GetTagIdByName(tagName string, query stri } func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query string) (summary string, funcError error) { + ctx := &logging.ContextMap{} + logging.Log.Debugf(ctx, "Getting MK summary for tag ID: %s", tagId) params := aali_graphdb.ParameterMap{ @@ -344,6 +349,7 @@ func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query st } result, err := aali_graphdb.CypherQueryReadGeneric[map[string]interface{}](graphdb_context.client, graphdb_context.dbname, query, params) + if err != nil { logging.Log.Errorf(ctx, "Error executing query: %v", err) return "", err @@ -356,5 +362,6 @@ func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query st } else { logging.Log.Warnf(ctx, "No MK summary found for tag ID %s", tagId) } + return summary, nil } \ No newline at end of file From 5bec0c8eefe5b85bd03ac4a965075e3d252a320b Mon Sep 17 00:00:00 2001 From: HarshKatoreAnsys Date: Wed, 24 Sep 2025 19:49:41 +0530 Subject: [PATCH 7/8] changes for Style check --- pkg/externalfunctions/ansysmeshpilot.go | 2 +- pkg/externalfunctions/externalfunctions.go | 4 ++-- pkg/meshpilot/ampgraphdb/graphdb.go | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/externalfunctions/ansysmeshpilot.go b/pkg/externalfunctions/ansysmeshpilot.go index 84d1a70d..d033db54 100644 --- a/pkg/externalfunctions/ansysmeshpilot.go +++ b/pkg/externalfunctions/ansysmeshpilot.go @@ -2479,4 +2479,4 @@ func GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt( userPrompt = fmt.Sprintf(SynthesizeAnswerUserPromptTemplate, originalQuery, expandedQueriesStr, qaPairsStr) logging.Log.Debugf(ctx, "Generated Synthesize Answer User Prompt: %s", userPrompt) return -} \ No newline at end of file +} diff --git a/pkg/externalfunctions/externalfunctions.go b/pkg/externalfunctions/externalfunctions.go index bfb8ff16..8c251020 100644 --- a/pkg/externalfunctions/externalfunctions.go +++ b/pkg/externalfunctions/externalfunctions.go @@ -159,7 +159,7 @@ var ExternalFunctionsMap = map[string]interface{}{ "ProcessJSONListOutput": ProcessJSONListOutput, "GenerateMKSummariesforTags": GenerateMKSummariesforTags, "GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt": GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt, - + // qdrant "QdrantCreateCollection": QdrantCreateCollection, "QdrantInsertData": QdrantInsertData, @@ -204,4 +204,4 @@ var ExternalFunctionsMap = map[string]interface{}{ // fluent "FluentCodeGen": FluentCodeGen, -} \ No newline at end of file +} diff --git a/pkg/meshpilot/ampgraphdb/graphdb.go b/pkg/meshpilot/ampgraphdb/graphdb.go index 34cd9645..180400c8 100644 --- a/pkg/meshpilot/ampgraphdb/graphdb.go +++ b/pkg/meshpilot/ampgraphdb/graphdb.go @@ -310,9 +310,9 @@ func (graphdb_context *graphDbContext) GetSolutions(fmFailureCode, primeMeshFail } func (graphdb_context *graphDbContext) GetTagIdByName(tagName string, query string) (tagId string, funcError error) { - + ctx := &logging.ContextMap{} - + logging.Log.Debugf(ctx, "Searching for tag: %s", tagName) params := aali_graphdb.ParameterMap{ @@ -320,7 +320,7 @@ func (graphdb_context *graphDbContext) GetTagIdByName(tagName string, query stri } result, err := aali_graphdb.CypherQueryReadGeneric[map[string]interface{}](graphdb_context.client, graphdb_context.dbname, query, params) - + if err != nil { logging.Log.Errorf(ctx, "Error executing query: %v", err) return "", err @@ -339,9 +339,9 @@ func (graphdb_context *graphDbContext) GetTagIdByName(tagName string, query stri } func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query string) (summary string, funcError error) { - + ctx := &logging.ContextMap{} - + logging.Log.Debugf(ctx, "Getting MK summary for tag ID: %s", tagId) params := aali_graphdb.ParameterMap{ @@ -349,7 +349,7 @@ func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query st } result, err := aali_graphdb.CypherQueryReadGeneric[map[string]interface{}](graphdb_context.client, graphdb_context.dbname, query, params) - + if err != nil { logging.Log.Errorf(ctx, "Error executing query: %v", err) return "", err @@ -364,4 +364,4 @@ func (graphdb_context *graphDbContext) GetMKSummaryFromDB(tagId string, query st } return summary, nil -} \ No newline at end of file +} From 475e47322bdb654f8985c3095b964d00616c1aae Mon Sep 17 00:00:00 2001 From: FelixKuhnAnsys Date: Wed, 24 Sep 2025 16:44:44 +0200 Subject: [PATCH 8/8] fix style check --- pkg/externalfunctions/ansysmeshpilot.go | 239 ++++++++++----------- pkg/externalfunctions/externalfunctions.go | 72 +++---- 2 files changed, 155 insertions(+), 156 deletions(-) diff --git a/pkg/externalfunctions/ansysmeshpilot.go b/pkg/externalfunctions/ansysmeshpilot.go index d033db54..1e3e7a0f 100644 --- a/pkg/externalfunctions/ansysmeshpilot.go +++ b/pkg/externalfunctions/ansysmeshpilot.go @@ -2305,67 +2305,67 @@ func SelectedSolution(selectedSolution string) (solution string) { // Returns: // - uniqueQAPairs: the unique Q&A pairs from similarity search results func PerformSimilaritySearchForSubqueries(subQueries []string, collection string, similaritySearchResults int, similaritySearchMinScore float64) (uniqueQAPairs []map[string]interface{}) { - ctx := &logging.ContextMap{} - uniqueQAPairs = []map[string]interface{}{} - uniqueQuestions := make(map[string]bool) - - client, err := qdrant_utils.QdrantClient() - if err != nil { - logging.Log.Error(ctx, fmt.Sprintf("unable to create qdrant client: %v", err)) - return - } - - for _, subQuery := range subQueries { - logging.Log.Debugf(ctx, "Processing sub-query: %s", subQuery) - embeddedVector, _ := PerformVectorEmbeddingRequest(subQuery, false) - if len(embeddedVector) == 0 { - logging.Log.Warnf(ctx, "Failed to get embedding for sub-query: %s", subQuery) - continue - } - - limit := uint64(similaritySearchResults) - scoreThreshold := float32(similaritySearchMinScore) - query := qdrant.QueryPoints{ - CollectionName: collection, - Query: qdrant.NewQueryDense(embeddedVector), - Limit: &limit, - ScoreThreshold: &scoreThreshold, - WithVectors: qdrant.NewWithVectorsEnable(false), - WithPayload: qdrant.NewWithPayloadEnable(true), - } - - scoredPoints, err := client.Query(context.TODO(), &query) - if err != nil { - logging.Log.Warnf(ctx, "Qdrant query failed: %v", err) - continue - } - - for _, scoredPoint := range scoredPoints { - payload, err := qdrant_utils.QdrantPayloadToType[map[string]interface{}](scoredPoint.GetPayload()) - if err != nil { - logging.Log.Warnf(ctx, "Failed to parse payload: %v", err) - continue - } - question, _ := payload["question"].(string) - answer, _ := payload["answer"].(string) - if question == "" { - continue - } - if !uniqueQuestions[question] { - qaPair := map[string]interface{}{ - "question": question, - "answer": answer, - } - uniqueQAPairs = append(uniqueQAPairs, qaPair) - uniqueQuestions[question] = true - } - } - } + ctx := &logging.ContextMap{} + uniqueQAPairs = []map[string]interface{}{} + uniqueQuestions := make(map[string]bool) + + client, err := qdrant_utils.QdrantClient() + if err != nil { + logging.Log.Error(ctx, fmt.Sprintf("unable to create qdrant client: %v", err)) + return + } + + for _, subQuery := range subQueries { + logging.Log.Debugf(ctx, "Processing sub-query: %s", subQuery) + embeddedVector, _ := PerformVectorEmbeddingRequest(subQuery, false) + if len(embeddedVector) == 0 { + logging.Log.Warnf(ctx, "Failed to get embedding for sub-query: %s", subQuery) + continue + } + + limit := uint64(similaritySearchResults) + scoreThreshold := float32(similaritySearchMinScore) + query := qdrant.QueryPoints{ + CollectionName: collection, + Query: qdrant.NewQueryDense(embeddedVector), + Limit: &limit, + ScoreThreshold: &scoreThreshold, + WithVectors: qdrant.NewWithVectorsEnable(false), + WithPayload: qdrant.NewWithPayloadEnable(true), + } + + scoredPoints, err := client.Query(context.TODO(), &query) + if err != nil { + logging.Log.Warnf(ctx, "Qdrant query failed: %v", err) + continue + } + + for _, scoredPoint := range scoredPoints { + payload, err := qdrant_utils.QdrantPayloadToType[map[string]interface{}](scoredPoint.GetPayload()) + if err != nil { + logging.Log.Warnf(ctx, "Failed to parse payload: %v", err) + continue + } + question, _ := payload["question"].(string) + answer, _ := payload["answer"].(string) + if question == "" { + continue + } + if !uniqueQuestions[question] { + qaPair := map[string]interface{}{ + "question": question, + "answer": answer, + } + uniqueQAPairs = append(uniqueQAPairs, qaPair) + uniqueQuestions[question] = true + } + } + } for i, qa := range uniqueQAPairs { logging.Log.Debugf(ctx, "Unique QA Pair #%d: Question: %s, Answer: %s", i+1, qa["question"], qa["answer"]) } - logging.Log.Infof(ctx, "Simple similarity search complete. Found %d unique Q&A pairs from %d sub-queries", len(uniqueQAPairs), len(subQueries)) - return uniqueQAPairs + logging.Log.Infof(ctx, "Simple similarity search complete. Found %d unique Q&A pairs from %d sub-queries", len(uniqueQAPairs), len(subQueries)) + return uniqueQAPairs } // ProcessJSONListOutput parses the response and returns the tags slice. @@ -2379,19 +2379,19 @@ func PerformSimilaritySearchForSubqueries(subQueries []string, collection string // Returns: // - tags: the list of items extracted from the response func ProcessJSONListOutput(response string) (generatedList []string) { - ctx := &logging.ContextMap{} - - err := json.Unmarshal([]byte(response), &generatedList) - if err != nil { - logging.Log.Errorf(ctx, "Error decoding JSON response: %v", err) - return []string{} - } - logging.Log.Debugf(ctx, "Generated List: %s", strings.Join(generatedList, ", ")) + ctx := &logging.ContextMap{} + + err := json.Unmarshal([]byte(response), &generatedList) + if err != nil { + logging.Log.Errorf(ctx, "Error decoding JSON response: %v", err) + return []string{} + } + logging.Log.Debugf(ctx, "Generated List: %s", strings.Join(generatedList, ", ")) if len(generatedList) == 0 { logging.Log.Error(ctx, "No items generated.") return nil } - return generatedList + return generatedList } // GenerateMKSummariesforTags retrieves unique MK summaries for the provided tags from the graph database. @@ -2407,49 +2407,48 @@ func ProcessJSONListOutput(response string) (generatedList []string) { // Returns: // - allTagsSummaries: the list of unique MK summaries -func GenerateMKSummariesforTags(dbName string, tags []string,GetTagIdByNameQuery string, GetMKSummaryFromDBQuery string) (allTagsSummaries []string) { - ctx := &logging.ContextMap{} - - err := ampgraphdb.EstablishConnection(config.GlobalConfig.GRAPHDB_ADDRESS, dbName) - if err != nil { - errMsg := fmt.Sprintf("error initializing graphdb: %v", err) - logging.Log.Error(ctx, errMsg) - panic(errMsg) - } - - uniqueSummaries := make(map[string]bool) - for _, tag := range tags { - // Inline GetTagIdByName - id, err := ampgraphdb.GraphDbDriver.GetTagIdByName(tag,GetTagIdByNameQuery) - if err != nil { - logging.Log.Warnf(ctx, "No tag_id found for tag %s (error: %v)", tag, err) - continue - } - if id != "" { - logging.Log.Infof(ctx, "Found tag_id %s for tag %s", id, tag) - // Inline GetMKSummaryFromDB - sum, err := ampgraphdb.GraphDbDriver.GetMKSummaryFromDB(id, GetMKSummaryFromDBQuery) - if err != nil { - logging.Log.Warnf(ctx, "Error getting MK summary for tag_id %s: %v", id, err) - continue - } - if sum != "" { - uniqueSummaries[sum] = true - } - } else { - logging.Log.Warnf(ctx, "No tag_id found for tag %s", tag) - } - } - - allTagsSummaries = make([]string, 0, len(uniqueSummaries)) - for summary := range uniqueSummaries { - allTagsSummaries = append(allTagsSummaries, summary) - } - - logging.Log.Infof(ctx, "Metatag extraction complete. Tags: %v, Summaries found: %d", tags, len(allTagsSummaries)) - return allTagsSummaries -} +func GenerateMKSummariesforTags(dbName string, tags []string, GetTagIdByNameQuery string, GetMKSummaryFromDBQuery string) (allTagsSummaries []string) { + ctx := &logging.ContextMap{} + + err := ampgraphdb.EstablishConnection(config.GlobalConfig.GRAPHDB_ADDRESS, dbName) + if err != nil { + errMsg := fmt.Sprintf("error initializing graphdb: %v", err) + logging.Log.Error(ctx, errMsg) + panic(errMsg) + } + + uniqueSummaries := make(map[string]bool) + for _, tag := range tags { + // Inline GetTagIdByName + id, err := ampgraphdb.GraphDbDriver.GetTagIdByName(tag, GetTagIdByNameQuery) + if err != nil { + logging.Log.Warnf(ctx, "No tag_id found for tag %s (error: %v)", tag, err) + continue + } + if id != "" { + logging.Log.Infof(ctx, "Found tag_id %s for tag %s", id, tag) + // Inline GetMKSummaryFromDB + sum, err := ampgraphdb.GraphDbDriver.GetMKSummaryFromDB(id, GetMKSummaryFromDBQuery) + if err != nil { + logging.Log.Warnf(ctx, "Error getting MK summary for tag_id %s: %v", id, err) + continue + } + if sum != "" { + uniqueSummaries[sum] = true + } + } else { + logging.Log.Warnf(ctx, "No tag_id found for tag %s", tag) + } + } + + allTagsSummaries = make([]string, 0, len(uniqueSummaries)) + for summary := range uniqueSummaries { + allTagsSummaries = append(allTagsSummaries, summary) + } + logging.Log.Infof(ctx, "Metatag extraction complete. Tags: %v, Summaries found: %d", tags, len(allTagsSummaries)) + return allTagsSummaries +} // GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt generates a user prompt for synthesizing an answer from meta knowledge. // @@ -2465,18 +2464,18 @@ func GenerateMKSummariesforTags(dbName string, tags []string,GetTagIdByNameQuery // Returns: // - userPrompt: the formatted user prompt func GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt( - SynthesizeAnswerUserPromptTemplate string, - originalQuery string, - expandedQueries []string, - retrievedQAPairs []map[string]interface{}, + SynthesizeAnswerUserPromptTemplate string, + originalQuery string, + expandedQueries []string, + retrievedQAPairs []map[string]interface{}, ) (userPrompt string) { - ctx := &logging.ContextMap{} + ctx := &logging.ContextMap{} - expandedQueriesStr := fmt.Sprintf("[%s]", strings.Join(expandedQueries, ", ")) - qaPairsBytes, _ := json.MarshalIndent(retrievedQAPairs, "", " ") - qaPairsStr := string(qaPairsBytes) + expandedQueriesStr := fmt.Sprintf("[%s]", strings.Join(expandedQueries, ", ")) + qaPairsBytes, _ := json.MarshalIndent(retrievedQAPairs, "", " ") + qaPairsStr := string(qaPairsBytes) - userPrompt = fmt.Sprintf(SynthesizeAnswerUserPromptTemplate, originalQuery, expandedQueriesStr, qaPairsStr) - logging.Log.Debugf(ctx, "Generated Synthesize Answer User Prompt: %s", userPrompt) - return + userPrompt = fmt.Sprintf(SynthesizeAnswerUserPromptTemplate, originalQuery, expandedQueriesStr, qaPairsStr) + logging.Log.Debugf(ctx, "Generated Synthesize Answer User Prompt: %s", userPrompt) + return } diff --git a/pkg/externalfunctions/externalfunctions.go b/pkg/externalfunctions/externalfunctions.go index 8c251020..3d0a5443 100644 --- a/pkg/externalfunctions/externalfunctions.go +++ b/pkg/externalfunctions/externalfunctions.go @@ -122,42 +122,42 @@ var ExternalFunctionsMap = map[string]interface{}{ "StoreUserGuideSectionsInGraphDatabase": StoreUserGuideSectionsInGraphDatabase, // ansys mesh pilot - "SimilartitySearchOnPathDescriptions": SimilartitySearchOnPathDescriptions, - "FindRelevantPathDescription": FindRelevantPathDescription, - "FetchPropertiesFromPathDescription": FetchPropertiesFromPathDescription, - "FetchNodeDescriptionsFromPathDescription": FetchNodeDescriptionsFromPathDescription, - "FetchActionsPathFromPathDescription": FetchActionsPathFromPathDescription, - "SynthesizeActions": SynthesizeActions, - "FinalizeResult": FinalizeResult, - "GetSolutionsToFixProblem": GetSolutionsToFixProblem, - "GetSelectedSolution": GetSelectedSolution, - "AppendToolHistory": AppendToolHistory, - "AppendMeshPilotHistory": AppendMeshPilotHistory, - "GetActionsFromConfig": GetActionsFromConfig, - "ParseHistory": ParseHistory, - "SynthesizeActionsTool2": SynthesizeActionsTool2, - "SynthesizeActionsTool3": SynthesizeActionsTool3, - "SynthesizeActionsTool11": SynthesizeActionsTool11, - "SynthesizeActionsTool12": SynthesizeActionsTool12, - "SynthesizeActionsTool17": SynthesizeActionsTool17, - "SimilartitySearchOnPathDescriptionsQdrant": SimilartitySearchOnPathDescriptionsQdrant, - "GenerateActionsSubWorkflowPrompt": GenerateActionsSubWorkflowPrompt, - "ProcessSubworkflowIdentificationOutput": ProcessSubworkflowIdentificationOutput, - "MarkdownToHTML": MarkdownToHTML, - "ParseHistoryToHistoricMessages": ParseHistoryToHistoricMessages, - "ParseSlashCommand": ParseSlashCommand, - "SynthesizeSlashCommand": SynthesizeSlashCommand, - "ProcessMWWorkflowInfo": ProcessMWWorkflowInfo, - "FinalizeMessage": FinalizeMessage, - "GenerateUserPrompt": GenerateUserPrompt, - "GenerateUserPromptWithList": GenerateUserPromptWithList, - "GenerateUserPromptWithContext": GenerateUserPromptWithContext, - "SelectedSolution": SelectedSolution, - "ProcessMainAgentOutput": ProcessMainAgentOutput, - "GenerateHelperSubWorkflowPrompt": GenerateHelperSubWorkflowPrompt, - "PerformSimilaritySearchForSubqueries": PerformSimilaritySearchForSubqueries, - "ProcessJSONListOutput": ProcessJSONListOutput, - "GenerateMKSummariesforTags": GenerateMKSummariesforTags, + "SimilartitySearchOnPathDescriptions": SimilartitySearchOnPathDescriptions, + "FindRelevantPathDescription": FindRelevantPathDescription, + "FetchPropertiesFromPathDescription": FetchPropertiesFromPathDescription, + "FetchNodeDescriptionsFromPathDescription": FetchNodeDescriptionsFromPathDescription, + "FetchActionsPathFromPathDescription": FetchActionsPathFromPathDescription, + "SynthesizeActions": SynthesizeActions, + "FinalizeResult": FinalizeResult, + "GetSolutionsToFixProblem": GetSolutionsToFixProblem, + "GetSelectedSolution": GetSelectedSolution, + "AppendToolHistory": AppendToolHistory, + "AppendMeshPilotHistory": AppendMeshPilotHistory, + "GetActionsFromConfig": GetActionsFromConfig, + "ParseHistory": ParseHistory, + "SynthesizeActionsTool2": SynthesizeActionsTool2, + "SynthesizeActionsTool3": SynthesizeActionsTool3, + "SynthesizeActionsTool11": SynthesizeActionsTool11, + "SynthesizeActionsTool12": SynthesizeActionsTool12, + "SynthesizeActionsTool17": SynthesizeActionsTool17, + "SimilartitySearchOnPathDescriptionsQdrant": SimilartitySearchOnPathDescriptionsQdrant, + "GenerateActionsSubWorkflowPrompt": GenerateActionsSubWorkflowPrompt, + "ProcessSubworkflowIdentificationOutput": ProcessSubworkflowIdentificationOutput, + "MarkdownToHTML": MarkdownToHTML, + "ParseHistoryToHistoricMessages": ParseHistoryToHistoricMessages, + "ParseSlashCommand": ParseSlashCommand, + "SynthesizeSlashCommand": SynthesizeSlashCommand, + "ProcessMWWorkflowInfo": ProcessMWWorkflowInfo, + "FinalizeMessage": FinalizeMessage, + "GenerateUserPrompt": GenerateUserPrompt, + "GenerateUserPromptWithList": GenerateUserPromptWithList, + "GenerateUserPromptWithContext": GenerateUserPromptWithContext, + "SelectedSolution": SelectedSolution, + "ProcessMainAgentOutput": ProcessMainAgentOutput, + "GenerateHelperSubWorkflowPrompt": GenerateHelperSubWorkflowPrompt, + "PerformSimilaritySearchForSubqueries": PerformSimilaritySearchForSubqueries, + "ProcessJSONListOutput": ProcessJSONListOutput, + "GenerateMKSummariesforTags": GenerateMKSummariesforTags, "GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt": GenerateSynthesizeAnswerfromMetaKnowlwdgeUserPrompt, // qdrant