UNPKG

@finos/legend-application-marketplace

Version:
119 lines 4.94 kB
/** * Copyright (c) 2026-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type GeneratorFn, ActionState } from '@finos/legend-shared'; import { type LegendAIMessage, type LegendAIConfig, type LegendAIProductMetadata, type LegendAIOrchestratorDataProductCoordinates, type TDSServiceSchema, type LegendAI_LegendApplicationPlugin_Extension, type MessageSetter, LegendAIResolvedEntities } from '@finos/legend-lego/legend-ai'; import { QueryExplicitExecutionContextInfo } from '@finos/legend-graph'; import type { LegendMarketplaceBaseStore } from '../LegendMarketplaceBaseStore.js'; import { type AutosuggestResult, DataProductSearchResult } from '@finos/legend-server-marketplace'; export declare enum MarketplaceAIChatStage { IDLE = "idle", SEARCHING = "searching", PRODUCT_SELECTION = "product-selection", QUERYING = "querying", RESULTS = "results" } export interface ScoredProductCandidate { product: DataProductSearchResult; productSimilarity: number; fieldCoverage: number; fieldIntersection: number; matchedFields: string[]; missingFields: string[]; compositeScore: number; } export declare function unwrapProductDetails(product: DataProductSearchResult): { groupId: string; artifactId: string; versionId: string; path: string; }; export declare class LegendMarketplaceAIChatStore { readonly baseStore: LegendMarketplaceBaseStore; stage: MarketplaceAIChatStage; questionText: string; messages: LegendAIMessage[]; isSending: boolean; suggestedProducts: DataProductSearchResult[]; scoredCandidates: ScoredProductCandidate[]; scopeProducts: { name: string; coordinates: LegendAIOrchestratorDataProductCoordinates; }[]; selectedProduct: DataProductSearchResult | undefined; selectedProductCoordinates: LegendAIOrchestratorDataProductCoordinates | undefined; selectedProductMetadata: LegendAIProductMetadata | undefined; pureExecutionContext: QueryExplicitExecutionContextInfo | undefined; pendingFallbackQuestion: string | undefined; resolvedProductServices: TDSServiceSchema[]; lastResolvedEntities: LegendAIResolvedEntities | undefined; lastEntityCandidates: { datasetName: string; modelPath: string; description?: string; }[]; selectedDataProductId: string | undefined; readonly searchState: ActionState; constructor(baseStore: LegendMarketplaceBaseStore); get config(): LegendAIConfig; get plugin(): LegendAI_LegendApplicationPlugin_Extension | undefined; get isEnabled(): boolean; get lastUserMessageText(): string; get welcomeSuggestedQueries(): string[]; setQuestionText(text: string): void; setStage(stage: MarketplaceAIChatStage): void; clearChat(): void; private createMessageSetter; private buildContextPromise; private buildConversationHistory; private extractMetadata; private buildTitleFromPath; private multiSignalSearch; private deriveProductsFromFieldResults; private buildDerivedProduct; private computeScoredCandidates; private mergeInterleaved; private llmRerankProducts; private buildRankedList; submitQuery(text: string): GeneratorFn<void>; selectDataProduct(result: DataProductSearchResult): void; selectAutosuggestProduct(result: AutosuggestResult): void; deselectProduct(): void; addScopeProduct(result: AutosuggestResult): void; removeScopeProduct(index: number): void; resolveExecutionContext(setMessages: MessageSetter): Promise<void>; askFollowUp(text: string): GeneratorFn<void>; private enrichWithEntitySearch; private resolveEntityCandidates; private mergeDiversityResults; private buildServicesFromEntitySearch; private getServicesForQuery; private handleNoServices; private handleZeroRows; private dispatchWithSql2; private handleLlmJudgeFallback; private handleAmbiguousIntent; /** * Core SQL generation → execution → analysis pipeline. * Extracted so both the direct DATA_QUERY path and the ambiguous-intent * path can reuse it. */ private runSqlPath; private safeAnalyzeResults; private attemptZeroRowCorrection; private offerOrchestratorFallback; runOrchestratorFallback(messageId: string): GeneratorFn<void>; } //# sourceMappingURL=LegendMarketplaceAIChatStore.d.ts.map