unbody-io / ts-client

Typescript client for Unbody's API
https://unbody.io/docs/libraries/typescript-client
7 stars 1 forks source link

Feat/get query #4

Closed miladazhdehnia closed 1 year ago

miladazhdehnia commented 1 year ago

Hi there,

This update enables the usage of a GET query for all types of documents.

Here are some important notes to consider:

You will notice the presence of @ts-ignore comments in the QueryBuilder methods. These comments are necessary due to certain limitations of TypeScript. However, they enhance the overall syntax usage and prevent clients from making mistakes such as chaining where multiple times or using ask after already using bm25, resulting in a more elegant and robust implementation.

I welcome any suggestions and feedback for a thorough review. Please ensure that you review the changes meticulously, as there might be some aspects that I might have inadvertently missed.

Thank you for your time and attention to this pull request!

2

amirhouieh commented 1 year ago

TODO on @jeangovil side

jeangovil commented 1 year ago

Provide a list of arguments order per function

Provide a list of functions that come with the _additional

groupBy, ask, near*, hybrid, bm25

@miladazhdehnia, there's also the after() method we forgot to include in the requirements.

miladazhdehnia commented 1 year ago

@jeangovil

Provide a list of functions that come with the _additional

groupBy, ask, near*, hybrid, bm25

What is the the default additional query for each one of them should look like? Also it seems that you forgot nearObject in list of arguments order per function

jeangovil commented 1 year ago

What is the the default additional query for each one of them should look like?

groupBy

_additional {
  group {
    id
    minDistance
    maxDistance
    count
    hits {
       _additional {
           distance
           id 
      }
       # fields specified using the .select() method
    }
  }
}

ask

_additional {
  answer {
    result
    property
    hasAnswer
    endPosition
    startPosition
  }
}

hybrid, bm25

_additional {
  score
}

nearText, nearObject, nearVector

_additional {
  certainty
  distance
}

Also it seems that you forgot nearObject in list of arguments order per function

My mistake, I missed it: nearObject(id, distance?)

I'm very sorry for my delayed response, please let me know if anything else is needed.