Compare commits

...

3 Commits

Author SHA1 Message Date
Asier Isayas
8ba75c0594 vector search float16 2025-11-05 08:02:13 -08:00
Asier Isayas
c142e4ad8a Merge branch 'master' of https://github.com/Azure/cosmos-explorer 2025-10-17 11:39:32 -07:00
Asier Isayas
fb95b44242 Add multiple languages for Full Text Search Policy 2025-10-17 11:39:25 -07:00
4 changed files with 24 additions and 6 deletions

View File

@@ -389,7 +389,7 @@ export interface VectorEmbeddingPolicy {
} }
export interface VectorEmbedding { export interface VectorEmbedding {
dataType: "float32" | "uint8" | "int8"; dataType: "float32" | "float16" | "uint8" | "int8";
dimensions: number; dimensions: number;
distanceFunction: "euclidean" | "cosine" | "dotproduct"; distanceFunction: "euclidean" | "cosine" | "dotproduct";
path: string; path: string;

View File

@@ -22,6 +22,7 @@ export interface FullTextPoliciesComponentProps {
) => void; ) => void;
discardChanges?: boolean; discardChanges?: boolean;
onChangesDiscarded?: () => void; onChangesDiscarded?: () => void;
englishOnly?: boolean;
} }
export interface FullTextPolicyData { export interface FullTextPolicyData {
@@ -66,6 +67,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent<FullTextPolicies
onFullTextPathChange, onFullTextPathChange,
discardChanges, discardChanges,
onChangesDiscarded, onChangesDiscarded,
englishOnly,
}): JSX.Element => { }): JSX.Element => {
const getFullTextPathError = (path: string, index?: number): string => { const getFullTextPathError = (path: string, index?: number): string => {
let error = ""; let error = "";
@@ -87,6 +89,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent<FullTextPolicies
if (!fullTextPolicy) { if (!fullTextPolicy) {
fullTextPolicy = { defaultLanguage: getFullTextLanguageOptions()[0].key as never, fullTextPaths: [] }; fullTextPolicy = { defaultLanguage: getFullTextLanguageOptions()[0].key as never, fullTextPaths: [] };
} }
return fullTextPolicy.fullTextPaths.map((fullTextPath: FullTextPath) => ({ return fullTextPolicy.fullTextPaths.map((fullTextPath: FullTextPath) => ({
...fullTextPath, ...fullTextPath,
pathError: getFullTextPathError(fullTextPath.path), pathError: getFullTextPathError(fullTextPath.path),
@@ -166,7 +169,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent<FullTextPolicies
<Dropdown <Dropdown
required={true} required={true}
styles={dropdownStyles} styles={dropdownStyles}
options={getFullTextLanguageOptions()} options={getFullTextLanguageOptions(englishOnly)}
selectedKey={defaultLanguage} selectedKey={defaultLanguage}
onChange={(_event: React.FormEvent<HTMLDivElement>, option: IDropdownOption) => onChange={(_event: React.FormEvent<HTMLDivElement>, option: IDropdownOption) =>
setDefaultLanguage(option.key as never) setDefaultLanguage(option.key as never)
@@ -211,7 +214,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent<FullTextPolicies
<Dropdown <Dropdown
required={true} required={true}
styles={dropdownStyles} styles={dropdownStyles}
options={getFullTextLanguageOptions()} options={getFullTextLanguageOptions(englishOnly)}
selectedKey={fullTextPolicy.language} selectedKey={fullTextPolicy.language}
onChange={(_event: React.FormEvent<HTMLDivElement>, option: IDropdownOption) => onChange={(_event: React.FormEvent<HTMLDivElement>, option: IDropdownOption) =>
onFullTextPathPolicyChange(index, option) onFullTextPathPolicyChange(index, option)
@@ -229,11 +232,25 @@ export const FullTextPoliciesComponent: React.FunctionComponent<FullTextPolicies
); );
}; };
export const getFullTextLanguageOptions = (): IDropdownOption[] => { export const getFullTextLanguageOptions = (englishOnly?: boolean): IDropdownOption[] => {
return [ const fullTextLanguageOptions: IDropdownOption[] = [
{ {
key: "en-US", key: "en-US",
text: "English (US)", text: "English (US)",
}, },
{
key: "fr-FR",
text: "French",
},
{
key: "de-DE",
text: "German",
},
{
key: "es-ES",
text: "Spanish",
},
]; ];
return englishOnly ? [fullTextLanguageOptions[0]] : fullTextLanguageOptions;
}; };

View File

@@ -1,6 +1,6 @@
import { IDropdownOption } from "@fluentui/react"; import { IDropdownOption } from "@fluentui/react";
const dataTypes = ["float32", "uint8", "int8"]; const dataTypes = ["float32", "float16", "uint8", "int8"];
const distanceFunctions = ["euclidean", "cosine", "dotproduct"]; const distanceFunctions = ["euclidean", "cosine", "dotproduct"];
const indexTypes = ["none", "flat", "diskANN", "quantizedFlat"]; const indexTypes = ["none", "flat", "diskANN", "quantizedFlat"];

View File

@@ -893,6 +893,7 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
) => { ) => {
this.setState({ fullTextPolicy, fullTextIndexes, fullTextPolicyValidated }); this.setState({ fullTextPolicy, fullTextIndexes, fullTextPolicyValidated });
}} }}
englishOnly={true}
/> />
</Stack> </Stack>
</Stack> </Stack>