You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had forgotten to include the OpenAI API key in the headers, and noticed that batch imports appeared to succeed, but no objects were committed to the database.
Turned out that the response to batcher.do() included a result field with the error buried inside. I expected the batcher to throw.
importassertfrom'assert';importweaviatefrom'weaviate-ts-client';importfsfrom'fs';importcsvfrom'csv-parser';constclient=weaviate.client({scheme: 'http',host: 'localhost:8080',// no OpenAI API key});constclassDefinition={class: 'JeopardyQuestion',description: 'A Jeopardy! question',vectorizer: 'text2vec-openai',};try{awaitclient.schema.classDeleter().withClassName('JeopardyQuestion').do();}catch{}finally{awaitclient.schema.classCreator().withClass(classDefinition).do();}constqs=[{question: 'What color?',answer: 'Blue'},{question: 'Where?',answer: 'In the sky'},]letbatcher=client.batch.objectsBatcher();for(constqofqs)batcher=batcher.withObject({class: 'JeopardyQuestion',properties: q,});constresponse=awaitbatcher.do();console.log(response.map(r=>r.result.errors.error));// <-- all objects OK, but nothing written to the DBbatcher=client.batch.objectsBatcher();constresult=awaitclient.graphql.aggregate().withClassName('JeopardyQuestion').withFields('meta { count }').do();assert.deepEqual(result.data['Aggregate']['JeopardyQuestion'],[{meta: {count: 2}}]);
The text was updated successfully, but these errors were encountered:
I had forgotten to include the OpenAI API key in the headers, and noticed that batch imports appeared to succeed, but no objects were committed to the database.
Turned out that the response to
batcher.do()
included aresult
field with the error buried inside. I expected the batcher to throw.The text was updated successfully, but these errors were encountered: