TS errors following the quickstart tutorial

Hi,

I get typescript errors following the quickstart tutorial - An argument for 'name' was not provided. for text2VecOpenAI():

const schema = { name: collectionName, vectorizer: weaviate.configure.vectorizer.text2VecOpenAI(), generative: weaviate.configure.generative.openAI(), }

I also tried the provider-specific instruction:

vectorizer: [ weaviate.configure.namedVectorizer( 'title_vector', { properties: ['title'], vectorizerConfig: weaviate.configure.vectorizer.text2VecOpenAI(), }, ), ],

More errors:

Property 'namedVectorizer' does not exist on type...

Adding options to the vectorizerConfig also throws ts errors:

Argument of type '{ model: string; dimensions: number; }' is not assignable to parameter of type 'string'.

Collection creation using the above code also throws this ts error:

Argument of type '{ name: string; vectorizer: any[]; generative: ModuleConfig<"generative-openai", GenerativeOpenAIConfig | undefined>; }' is not assignable to parameter of type 'CollectionConfigCreate<undefined, string>'.

Server Setup Information

  • Weaviate Server Version: 1.24.12
  • Deployment Method: Weaviate Cloud
  • Client Language and Version: Typescript v3 (3.0.0-rc.1)

Any help would be appreciated.

1 Like

hi @Seungchan_Lee !

Welcome to our community! :hugs:

I have spotted this issue last week, and already have written a PR for it:

We hope to have it reviewed soon.

this is the expected syntax:

await client.collections.create({
  name: collectionName,
  vectorizers: weaviate.configure.vectorizer.text2VecOpenAI("default"),
})

Thanks for pointing it out and sorry for that :grimacing:

Thanks for the response - are there any workarounds at this time? If not, when is the expected release for this?

Actually it looks like that’s just documentation fix? Got it - thanks.

One more question - how do I pick a different model and vector dimensions?

Hi @Seungchan_Lee,

You can provide the model by adding additional properties to text2Vec, like this (see docs):

await client.collections.create({
  name: collectionName,
  vectorizers: weaviate.configure.vectorizer.text2VecOpenAI(
    "default",
    {
      model: 'text-embedding-3-large',
      dimensions: 1024,       //Parameter only applicable for `v3` model family and newer
    }
),
})

You can find more info in the provider-dedicated docs, here is the page for the OpenAI integration

Btw. if you use models that have only one option for number of dimensions, i.e. ada-002, then you don’t need to specify the dimensions.

This works - thank you for your help

1 Like