Why weaviate client (typescript) is not using configured text2VecAzureOpenAI vectorizer?

Description

I’m trying to insert documents with inverted indexes into weaviate (local instance) but embeddings aren’t being created. As embedding model I’m using Azure OpenAI model “text-embedding-3-small”. When collection is being inserted I’m getting the next error for each document:

{
      message: 'API Key: no api key found neither in request header: X-Openai-Api-Key nor in environment variable under OPENAI_APIKEY',
      object: [Object],
      originalUuid: undefined
    }

Question: why the client is trying to use X-Openai-Api-Key key instead of X-Azure-Api-Key for text2VecAzureOpenAI vectorizer? I also tried to replace text2vec-openai module in docker with text2vec-azure-openai one but got the error that such module doesn’t exists. When I replaced X-Azure-Api-Key with X-Openai-Api-Key the client tried to connect to OpenAI API and not Azure.

Is it possible to use remote (azure) embedding model for local weaviate instance running in docker?

Here is my config:

Connection to local instance (working):

const client = await weaviate.connectToLocal({
      host: "172.16.41.55",
      port: 8080,
      grpcPort: 50051, 
      headers: {
        'X-Azure-Api-Key': this.embeddings.azureOpenAIApiKey || '',
      }
    });
await client.isReady()

Create collection function call:

client.collections.create({
      name: `${collection}_${this.context.id}`,
      properties: [
        {
          name: 'document',
          dataType: dataType.TEXT,
          description: 'Splitted document' as const,
          vectorizePropertyName: true,
        },
      ],
      invertedIndex: configure.invertedIndex({
        indexNullState: true,
        indexPropertyLength: true,
        indexTimestamps: true,
      }),
      vectorizers: [
        weaviate.configure.vectorizer.text2VecAzureOpenAI(
          {
            name: 'title_vector',
            sourceProperties: ['title'],
            resourceName: this.embeddings.azureOpenAIApiInstanceName || '',
            deploymentId: this.embeddings.azureOpenAIApiDeploymentName || '',
          },
        ),
      ],
});

Server Setup Information

  • Weaviate Server Version: 1.27.1
  • Deployment Method: docker
  • Multi Node? Number of Running Nodes: 1
  • Client Language and Version: TS (3.2.2)
  • Multitenancy?:

Any additional Information

Weaviate service in docker-compose file:

weaviate:
    command: --host 0.0.0.0 --port '8080' --scheme http
    container_name: dowow-weaviate
    image: cr.weaviate.io/semitechnologies/weaviate:1.27.1
    restart: always
    volumes:
      - weaviate_data:/var/lib/weaviate
    networks:
      dowow:
        ipv4_address: 172.16.41.55
    ports:
    - 8086:8080
    - 50051:50051
    - 2112:2112
    environment:
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      DEFAULT_VECTORIZER_MODULE: 'text2vec-openai'
      ENABLE_MODULES: 'text2vec-openai'
      CLUSTER_HOSTNAME: 'node1'

volumes:
  weaviate_data:
    driver: local

Response from /v1/meta endpoint:

{
    "grpcMaxMessageSize": 10485760,
    "hostname": "http://[::]:8080",
    "modules": {
        "text2vec-openai": {
            "documentationHref": "https://platform.openai.com/docs/guides/embeddings/what-are-embeddings",
            "name": "OpenAI Module"
        }
    },
    "version": "1.27.1"
}

Hi!

Sorry for the delay here :frowning:

I was not able to reproduce this.

Here is the code I used:

import weaviate, { Collection, WeaviateClient } from 'weaviate-client';

async function runFullExample() {
    const client = await weaviate.connectToLocal({
        host: process.env.WEAVIATE_HOST || 'localhost',
        port: parseInt(process.env.WEAVIATE_PORT || '8080'),
        grpcPort: parseInt(process.env.WEAVIATE_GRPC_PORT || '50051'),
        headers: {
            'X-Azure-Api-Key': "my api key here",
        }
    });
    console.log(`Server Version: ${(await client.getMeta()).version}`)
    // delete test collection
    await client.collections.delete("JeopardyQuestions");
    // create test collection
    const collection = await client.collections.create({
        name: 'JeopardyQuestions',
        properties: [
            {
                name: 'category',
                dataType: 'text',
            },
            {
                name: 'question',
                dataType: 'text',
            },
            {
                name: 'answer',
                dataType: 'text',
            },
        ],

        vectorizers: [
            weaviate.configure.vectorizer.text2VecAzureOpenAI({
                name: 'my_vector',
                sourceProperties: ['category', 'answer', 'question'],
                resourceName: 'duda-instance',
                deploymentId: 'duda-deployment-id'
              },
            ),
        ],
    });
    // add some data
    await collection.data.insert({
        "category": "example",
        "question": "is this an example?",
        "answer": "yes! this is an example."
    })
    // show data
    const query =  await collection.query.fetchObjects({
        includeVector: true
    })
    await query.objects.map(object=>{
        console.log(object.vectors)
    })
}
runFullExample();

Let me know if this helps!