Milvus.tsx 2.6 KB

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