Quantcast
Channel: Weaviate Community Forum - Latest posts
Viewing all articles
Browse latest Browse all 3601

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

$
0
0

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!


Viewing all articles
Browse latest Browse all 3601

Trending Articles