weaviate / typescript-client

Official Weaviate TypeScript Client
https://www.npmjs.com/package/weaviate-client
BSD 3-Clause "New" or "Revised" License
57 stars 21 forks source link

Typed class properties #66

Open evenfrost opened 1 year ago

evenfrost commented 1 year ago

It would be great if we could specify explicit class properties for different classes.

Example:

import type { WeaviateClass } from 'weaviate-ts-client';

interface CustomerMacroProperties {
  title: string;
  text: string;
  clientId: string;
}

const CustomerMacro: WeaviateClass<CustomerMacroProperties> = {
  class: 'CustomerMacro',
  description: 'A Customer macro',
  invertedIndexConfig: {
    indexPropertyLength: true,
    indexNullState: true,
    stopwords: {
      preset: 'none',
    },
  },
  properties: [{
    name: 'title',
    description: 'The title of the macro',
    dataType: ['text'],
  }, {
    name: 'text',
    description: 'The text of the macro',
    dataType: ['text'],
  }, {
    name: 'clientId',
    description: 'The ID of the customer the macro belongs to',
    dataType: ['string'],
    moduleConfig: {
      'text2vec-contextionary': {
        skip: true,
      },
    },
  }],
};