mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-30 18:50:26 +01:00
Added quantizerType support in vector embedding (#2471)
* Added quantizerType support in vector embedding * Fix build issues * Address PR Comments * address pr comments
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
} from "Explorer/Controls/Settings/SettingsSubComponents/ThroughputInputComponents/ThroughputBucketsComponent";
|
||||
import { useIndexingPolicyStore } from "Explorer/Tabs/QueryTab/ResultsView";
|
||||
import { useDatabases } from "Explorer/useDatabases";
|
||||
import { Keys, t } from "Localization";
|
||||
import { isFabricNative } from "Platform/Fabric/FabricUtil";
|
||||
import { isVectorSearchEnabled } from "Utils/CapabilityUtils";
|
||||
import { isRunningOnPublicCloud } from "Utils/CloudUtils";
|
||||
@@ -44,7 +45,6 @@ import { useCommandBar } from "../../Menus/CommandBar/CommandBarComponentAdapter
|
||||
import { SettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
||||
import "./SettingsComponent.less";
|
||||
import { mongoIndexingPolicyAADError } from "./SettingsRenderUtils";
|
||||
import { Keys, t } from "Localization";
|
||||
import {
|
||||
ConflictResolutionComponent,
|
||||
ConflictResolutionComponentProps,
|
||||
@@ -555,6 +555,19 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||
private onVectorEmbeddingPolicyChange = (newVectorEmbeddingPolicy: DataModels.VectorEmbeddingPolicy): void =>
|
||||
this.setState({ vectorEmbeddingPolicy: newVectorEmbeddingPolicy });
|
||||
|
||||
private onVectorIndexesChange = (newVectorIndexes: DataModels.VectorIndex[]): void => {
|
||||
const currentIndexingPolicy: DataModels.IndexingPolicy =
|
||||
this.state.indexingPolicyContent || ({} as DataModels.IndexingPolicy);
|
||||
const newIndexingPolicy: DataModels.IndexingPolicy = {
|
||||
...currentIndexingPolicy,
|
||||
vectorIndexes: newVectorIndexes,
|
||||
};
|
||||
this.setState({
|
||||
indexingPolicyContent: newIndexingPolicy,
|
||||
isIndexingPolicyDirty: true,
|
||||
});
|
||||
};
|
||||
|
||||
private onFullTextPolicyChange = (newFullTextPolicy: DataModels.FullTextPolicy): void =>
|
||||
this.setState({ fullTextPolicy: newFullTextPolicy });
|
||||
|
||||
@@ -1332,6 +1345,9 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||
onVectorEmbeddingPolicyChange: this.onVectorEmbeddingPolicyChange,
|
||||
onVectorEmbeddingPolicyDirtyChange: this.onVectorEmbeddingPolicyDirtyChange,
|
||||
onVectorEmbeddingPolicyValidationChange: this.onVectorEmbeddingPolicyValidationChange,
|
||||
vectorIndexes: this.state.indexingPolicyContent?.vectorIndexes ?? [],
|
||||
vectorIndexesBaseline: this.state.indexingPolicyContentBaseline?.vectorIndexes ?? [],
|
||||
onVectorIndexesChange: this.onVectorIndexesChange,
|
||||
isVectorSearchEnabled: this.isVectorSearchEnabled,
|
||||
fullTextPolicy: this.state.fullTextPolicy,
|
||||
fullTextPolicyBaseline: this.state.fullTextPolicyBaseline,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DefaultButton, Pivot, PivotItem, Stack } from "@fluentui/react";
|
||||
import { FullTextPolicy, VectorEmbedding, VectorEmbeddingPolicy } from "Contracts/DataModels";
|
||||
import { FullTextPolicy, VectorEmbedding, VectorEmbeddingPolicy, VectorIndex } from "Contracts/DataModels";
|
||||
import {
|
||||
FullTextPoliciesComponent,
|
||||
getFullTextLanguageOptions,
|
||||
@@ -16,6 +16,9 @@ export interface ContainerPolicyComponentProps {
|
||||
onVectorEmbeddingPolicyChange: (newVectorEmbeddingPolicy: VectorEmbeddingPolicy) => void;
|
||||
onVectorEmbeddingPolicyDirtyChange: (isVectorEmbeddingPolicyDirty: boolean) => void;
|
||||
onVectorEmbeddingPolicyValidationChange: (isValid: boolean) => void;
|
||||
vectorIndexes: VectorIndex[];
|
||||
vectorIndexesBaseline: VectorIndex[];
|
||||
onVectorIndexesChange: (newVectorIndexes: VectorIndex[]) => void;
|
||||
isVectorSearchEnabled: boolean;
|
||||
fullTextPolicy: FullTextPolicy;
|
||||
fullTextPolicyBaseline: FullTextPolicy;
|
||||
@@ -33,6 +36,9 @@ export const ContainerPolicyComponent: React.FC<ContainerPolicyComponentProps> =
|
||||
onVectorEmbeddingPolicyChange,
|
||||
onVectorEmbeddingPolicyDirtyChange,
|
||||
onVectorEmbeddingPolicyValidationChange,
|
||||
vectorIndexes,
|
||||
vectorIndexesBaseline,
|
||||
onVectorIndexesChange,
|
||||
isVectorSearchEnabled,
|
||||
fullTextPolicy,
|
||||
fullTextPolicyBaseline,
|
||||
@@ -78,6 +84,7 @@ export const ContainerPolicyComponent: React.FC<ContainerPolicyComponentProps> =
|
||||
|
||||
const checkAndSendVectorEmbeddingPoliciesToSettings = (
|
||||
newVectorEmbeddings: VectorEmbedding[],
|
||||
newVectorIndexes: VectorIndex[],
|
||||
validationPassed: boolean,
|
||||
): void => {
|
||||
onVectorEmbeddingPolicyValidationChange(validationPassed);
|
||||
@@ -86,6 +93,9 @@ export const ContainerPolicyComponent: React.FC<ContainerPolicyComponentProps> =
|
||||
if (isVectorDirty) {
|
||||
onVectorEmbeddingPolicyChange({ vectorEmbeddings: newVectorEmbeddings });
|
||||
}
|
||||
if (isDirty(newVectorIndexes ?? [], vectorIndexesBaseline ?? [])) {
|
||||
onVectorIndexesChange(newVectorIndexes);
|
||||
}
|
||||
};
|
||||
|
||||
const checkAndSendFullTextPolicyToSettings = (newFullTextPolicy: FullTextPolicy): void => {
|
||||
@@ -169,12 +179,14 @@ export const ContainerPolicyComponent: React.FC<ContainerPolicyComponentProps> =
|
||||
<VectorEmbeddingPoliciesComponent
|
||||
vectorEmbeddingsBaseline={vectorEmbeddingsBaseline}
|
||||
vectorEmbeddings={vectorEmbeddings}
|
||||
vectorIndexes={undefined}
|
||||
vectorIndexes={vectorIndexes ?? []}
|
||||
onVectorEmbeddingChange={(
|
||||
vectorEmbeddings: VectorEmbedding[],
|
||||
_vectorIndexingPolicies,
|
||||
newVectorEmbeddings: VectorEmbedding[],
|
||||
newVectorIndexes: VectorIndex[],
|
||||
validationPassed: boolean,
|
||||
) => checkAndSendVectorEmbeddingPoliciesToSettings(vectorEmbeddings, validationPassed)}
|
||||
) =>
|
||||
checkAndSendVectorEmbeddingPoliciesToSettings(newVectorEmbeddings, newVectorIndexes, validationPassed)
|
||||
}
|
||||
discardChanges={discardVectorChanges}
|
||||
onChangesDiscarded={onVectorChangesDiscarded}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Keys, t } from "Localization";
|
||||
import * as Constants from "../../../Common/Constants";
|
||||
import * as DataModels from "../../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||
import { Keys, t } from "Localization";
|
||||
import { isFabricNative } from "../../../Platform/Fabric/FabricUtil";
|
||||
import { userContext } from "../../../UserContext";
|
||||
import { isCapabilityEnabled } from "../../../Utils/CapabilityUtils";
|
||||
@@ -15,6 +15,7 @@ export type isDirtyTypes =
|
||||
| DataModels.IndexingPolicy
|
||||
| DataModels.ComputedProperties
|
||||
| DataModels.VectorEmbedding[]
|
||||
| DataModels.VectorIndex[]
|
||||
| DataModels.FullTextPolicy
|
||||
| DataModels.ThroughputBucket[]
|
||||
| DataModels.DataMaskingPolicy;
|
||||
|
||||
@@ -359,10 +359,13 @@ exports[`SettingsComponent renders 1`] = `
|
||||
onVectorEmbeddingPolicyChange={[Function]}
|
||||
onVectorEmbeddingPolicyDirtyChange={[Function]}
|
||||
onVectorEmbeddingPolicyValidationChange={[Function]}
|
||||
onVectorIndexesChange={[Function]}
|
||||
resetShouldDiscardContainerPolicyChange={[Function]}
|
||||
shouldDiscardContainerPolicies={false}
|
||||
vectorEmbeddingPolicy={{}}
|
||||
vectorEmbeddingPolicyBaseline={{}}
|
||||
vectorIndexes={[]}
|
||||
vectorIndexesBaseline={[]}
|
||||
/>
|
||||
</Stack>
|
||||
</PivotItem>
|
||||
|
||||
Reference in New Issue
Block a user