2
0

Milvus.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. export enum METRIC_TYPES_VALUES {
  2. L2 = 'L2',
  3. IP = 'IP',
  4. HAMMING = 'HAMMING',
  5. JACCARD = 'JACCARD',
  6. TANIMOTO = 'TANIMOTO',
  7. SUBSTRUCTURE = 'SUBSTRUCTURE',
  8. SUPERSTRUCTURE = 'SUPERSTRUCTURE',
  9. }
  10. export const METRIC_TYPES = [
  11. {
  12. value: METRIC_TYPES_VALUES.L2,
  13. label: 'L2',
  14. },
  15. {
  16. value: METRIC_TYPES_VALUES.IP,
  17. label: 'IP',
  18. },
  19. {
  20. value: METRIC_TYPES_VALUES.SUBSTRUCTURE,
  21. label: 'SUBSTRUCTURE',
  22. },
  23. {
  24. value: METRIC_TYPES_VALUES.SUPERSTRUCTURE,
  25. label: 'SUPERSTRUCTURE',
  26. },
  27. {
  28. value: METRIC_TYPES_VALUES.HAMMING,
  29. label: 'HAMMING',
  30. },
  31. {
  32. value: METRIC_TYPES_VALUES.JACCARD,
  33. label: 'JACCARD',
  34. },
  35. {
  36. value: METRIC_TYPES_VALUES.TANIMOTO,
  37. label: 'TANIMOTO',
  38. },
  39. ];
  40. export type MetricType =
  41. | 'L2'
  42. | 'IP'
  43. | 'HAMMING'
  44. | 'SUBSTRUCTURE'
  45. | 'SUPERSTRUCTURE'
  46. | 'JACCARD'
  47. | 'TANIMOTO';
  48. export type searchKeywordsType = 'nprobe' | 'ef' | 'search_k' | 'search_length';
  49. export type indexConfigType = {
  50. [x: string]: {
  51. create: string[];
  52. search: searchKeywordsType[];
  53. };
  54. }
  55. // index
  56. export const FLOAT_INDEX_CONFIG: indexConfigType = {
  57. IVF_FLAT: {
  58. create: ['nlist'],
  59. search: ['nprobe'],
  60. },
  61. IVF_PQ: {
  62. create: ['nlist', 'm'],
  63. search: ['nprobe'],
  64. },
  65. // IVF_SQ8: {
  66. // create: ['nlist'],
  67. // search: ['nprobe'],
  68. // },
  69. // IVF_SQ8_HYBRID: {
  70. // create: ['nlist'],
  71. // search: ['nprobe'],
  72. // },
  73. FLAT: {
  74. create: ['nlist'],
  75. search: ['nprobe'],
  76. },
  77. HNSW: {
  78. create: ['M', 'efConstruction'],
  79. search: ['ef'],
  80. },
  81. ANNOY: {
  82. create: ['n_trees'],
  83. search: ['search_k'],
  84. },
  85. // RNSG: {
  86. // create: ['out_degree', 'candidate_pool_size', 'search_length', 'knng'],
  87. // search: ['search_length'],
  88. // },}
  89. }
  90. export const BINARY_INDEX_CONFIG: indexConfigType = {
  91. BIN_FLAT: {
  92. create: ['nlist'],
  93. search: ['nprobe'],
  94. },
  95. BIN_IVF_FLAT: {
  96. create: ['nlist'],
  97. search: ['nprobe'],
  98. },
  99. };
  100. export const INDEX_CONFIG: indexConfigType = {
  101. ...FLOAT_INDEX_CONFIG,
  102. ...BINARY_INDEX_CONFIG,
  103. };
  104. export const COLLECTION_NAME_REGX = /^[0-9,a-z,A-Z$_]+$/;
  105. export const m_OPTIONS = [
  106. { label: '64', value: 64 },
  107. { label: '32', value: 32 },
  108. { label: '16', value: 16 },
  109. { label: '8', value: 8 },
  110. { label: '4', value: 4 },
  111. ];
  112. export const INDEX_OPTIONS_MAP = {
  113. FLOAT_INDEX: Object.keys(FLOAT_INDEX_CONFIG).map(v => ({ label: v, value: v })),
  114. BINARY_INDEX: Object.keys(BINARY_INDEX_CONFIG).map(v => ({ label: v, value: v })),
  115. };
  116. export const PRIMARY_KEY_FIELD = 'INT64 (Primary key)';
  117. export enum EmbeddingTypeEnum {
  118. float = 'FLOAT_INDEX',
  119. binary = 'BINARY_INDEX',
  120. }