typescript-client icon indicating copy to clipboard operation
typescript-client copied to clipboard

certainty parameter not found in The qna-openai module

Open Chuck1sn opened this issue 2 years ago • 0 comments

https://weaviate.io/developers/weaviate/modules/reader-generator-modules/qna-openai

The qna-openai module tries to find an answer in the data objects of the specified class. If an answer is found within the given certainty range, it will be returned in the GraphQL _additional { answer { ... } } field. There will be a maximum of 1 answer returned, if this is above the optionally set certainty. The answer with the highest certainty (confidence level) will be returned.

  1. How can I use the certainty parameter to filter out irrelevant questions when using the question and answer module with OpenAI?
  2. And if certainty parameter is supported, is certainty:0.75 be properly when I want to return empty when users ask questions that are unrelated to the extracted article content?

Here is my code block

client.graphql
		.get()
		.withClassName(schema)
		.withAsk({
			question: question
		})
		.withFields(
			'content _additional { answer { hasAnswer property result startPosition endPosition } }'
		)
		.withLimit(1)
		.do()
		.then((res: any) => {
			console.log(JSON.stringify(res, null, 2))
			return res.data.Get[schema][0]._additional.answer.result
		})

Chuck1sn avatar May 05 '23 03:05 Chuck1sn