My Weaviate JavaScript client is not returning anything when I use the ".withAsk" function. What could be the issue?

I recently set up a Weaviate Cloud Cluster using the instructions from the quick start manual.

The data has been imported successfully, and the client connection is functioning.

For the ask function, I have implemented the following:

export async function question(collection: Collections, question: string) {
  await client.graphql
    .get()
    .withClassName(collection)
    .withAsk({ question })
    .withFields('memberName _additional { answer { hasAnswer property result startPosition endPosition } }')
    .withLimit(5)
    .do()
}

question(Collections.TeamMember, 'Who has painting as a hobby?')
  .then((result) => { console.log(result) });

Instead of returning Sarah Mitchell, it returns undefined. This was unexpected.


Additional information:

Schema

I manually created a schema in order to add `qna-openai` to the `moduleConfig` following the instructions provided here:

export async function addClassToSchema(classObject: object) {
  const res = await client.schema.classCreator().withClass(classObject).do();
}

The class object:

{
  "class": "TeamMember",
  "vectorizer": "text2vec-openai",
  "moduleConfig": {
    "text2vec-openai": {},
    "qna-openai": {
      "model": "text-davinci-002",
      "maxTokens": 16,
      "temperature": 0.0,
      "topP": 1,
      "frequencyPenalty": 0.0,
      "presencePenalty": 0.0
    }
  },
  "properties": [
    {
      "name": "teamName",
      "dataType": ["text"]
    },
    {
      "name": "memberName",
      "dataType": ["text"]
    },
    {
      "name": "jobDescription",
      "dataType": ["text"]
    },
    {
      "name": "responsibilities",
      "dataType": ["text"]
    },
    {
      "name": "education",
      "dataType": ["text"]
    },
    {
      "name": "hobbies",
      "dataType": ["text"]
    }
  ]
}

Retrieving provides the following response:

{ 
    // JSON Response Here
}

Objects

I then proceeded to import a list of members into the Weaviate instance.

export async function teamMembersImport() {
    // JavaScript code for importing team members
}

A GET request to will return an array of objects containing member details.

{
    // JSON Response Here
}

Answer №1

It appears that the question function is not returning any value. While you are making the call to Weaviate, you are neglecting to return anything back.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to upgrade Angular Header/Http/RequestOptions from deprecated in Angular 6.0 to Angular 8.0?

When working on http requests in Angular 6.0, I typically follow this block of code. I attempted to incorporate the newer features introduced in Angular 8.0 such as HttpClient, HttpResponse, and HttpHeaders. However, I found that the syntax did not align ...

Having problems with template refs staying null when using TypeScript in Nuxt3?

My Images.vue parent component contains 3 child components: ImagesGridArea1, ImagesGridArea2, and ImagesGridArea3. The children are tagged like this: <ImagesGridArea1 ref="ref1" :key="ref1key" ... />. In the parent script, I have: ...

Buffer Overflow - Security Audit - Node JS TypeScript Microservice Vulnerability Scan Report

Person Data Schema: import JoiBase from '@hapi/joi'; import JoiDate from '@hapi/joi-date'; const Joi = JoiBase.extend(JoiDate); const personDataSchema = Joi.object().keys({ person: Joi.object().keys({ personId: Joi.string().max( ...

Discovering the Java Map's value in Typescript

My application's backend is built using Spring Boot and the frontend is Angular 7. I need to send a map as a response, like this: Map<String, Object> additionalResponse = new HashMap<>() { { put("key1"," ...

Transforming a non-specific type into a container permits precarious assignments

I'm encountering an issue with the code snippet provided below. Despite having a specific type where Type<boolean> cannot be assigned to Type<true>, when wrapping it in an object type (BoxType as shown), suddenly BoxType<boolean> wro ...

What is the reason behind Typescript raising an error when attempting to compare two boolean variables with different values (true and false)?

In the screenshot below, you can see that we are encountering a peculiar error when attempting to compare a boolean variable with true. This condition will always return 'false' since the types 'false' and 'true' have no over ...

Transforming an array into an object using TypeScript

I am attempting to create a generic type for a function that transforms an array into an object, like so: type ObjectType = { id: number; name: string; status: string }; const xyz: ObjectType[] = [ { id: 1, name: "X", status: " ...

An error is triggered when an HttpClient post does not return any data

While sending a post request from my angular application to a web api, I am encountering an issue. The response from the api is supposed to be either a 200 status or a 404 status without any data being returned. An example of some headers for the 200 respo ...

The MaxDuration feature for a 5-minute time limit is malfunctioning on the Serverless Pro Plan, resulting in a 504 ERROR on

I am currently using Next.js@latest with App Directory My application is hosted on Vercel I'm experiencing a 504 error from Vercel and I'm on the pro plan. My serverless functions are set to run for up to 5 minutes, but usually, they only take ...

Different ways to invoke a general method with a deconstructed array as its argument

Calling a Generic Method with Deconstructed Array Parameters As of today, the only method to ensure typed safe inherited parameters is by using a deconstructed array and explicitly defining its type. This allows calling the parent method by utilizing the ...

The method to create a global generic class in TypeScript

Is there a way to globally expose the Hash class? Access Playground here export {} class Hash<K, V> { } declare global { // How can we achieve this? } window.Hash = Hash // Making it globally accessible ...

Angular class requires multiple class members and validators for MatSelection List to be bound with Formbuilder

Could you please guide me on how to connect the Google Angular Materials mat-selection-list with the FormBuilder? We have the following class and are attempting to utilize Reactive Form Builder for this purpose. While we are aware of how to link data class ...

What is the best way to iterate through an array and dynamically output the values?

I am facing an issue with a function that retrieves values from an array, and I wish to dynamically return these values. const AvailableUserRoles = [ { label: 'Administrator', value: 1 }, { label: 'Count', value: ...

The promise object is displayed instead of the actual data retrieved from the API call

I am currently working on fetching data from an API and showcasing the name of the returned data on the front end. This function successfully retrieves the data through an API call: async function retrieveData(url){ var _data; let response = await fetch( ...

Testing the throwing of errors when running Karma by utilizing sinon.spy on global functions like parseInt

I'm currently facing an issue with monitoring the usage of parseInt within my function. This is a Proof of Concept for integrating TypeScript into our company's workflow. I've tried following two different tutorials on testing Sinon, but no ...

The type 'Observable<void | AuthError>' cannot be assigned to 'Observable<Action>'

I am encountering an error that reads: error TS2322: Type 'Observable<void | AuthError>' is not assignable to type 'Observable<Action>'. Type 'void | AuthError' is not assignable to type 'Action'. Type &a ...

TS1056 Error: Accessors can only be utilized with ECMAScript 5 or newer versions targeted

I'm currently working on a SharePoint framework project that has the following folder layout: One of the directories is named dataaccess and contains a webpart factory method. The file Sharepointdataprovider.ts includes this code snippet: import { ...

Comparing vue.component to using import statements inside a component

After setting up a vue2 library using vue-cli, I have numerous components included in the index.ts file as shown below: import MyComponent1 from './components/MyComponent1.vue'; import MyComponent2 from './components/MyComponent2.vue'; ...

Angular 6 is experiencing an issue with the functionality of the file toggle JS

Currently, I am utilizing the file toggle.js within the Urban theme. In the HTML chatbox, using the img, the file toggle.js is hardcoded and is functioning properly. However, when implementing code in Angular 6, the toggle.js is not functioning as expecte ...

The issue of HTTP parameters not being appended to the GET request was discovered

app.module.ts getHttpParams = () => { const httpParamsInstance = new HttpParams(); console.log(this.userForm.controls) Object.keys(this.userForm.controls).forEach(key => { console.log(this.userForm.get(key).value) const v ...