Hi,
In the QA module, the first step involves semantic search. Is it possible to use modules like Hybrid search for this step?
Currently I have a good search result with Hybrid + Rerank, and I’d like to apply QA to the output. If this is possible, I’m not quite sure how to structure the full GraphQL query.
Hi @boogityboo !!
I believe we have have a bug here.
I have investigated and asked internally already (sorry for the delay
)
I replicated using this recipe:
and changed one of the queries a little bit:
import json
# lets do a RAG directly using only Weaviate
# This is our prompt.
generateTask = "Quelle est la nourriture traditionnelle de ce pays ? Answer in Spanish"
# lets filter it out, and only use this specific file
source_file = "brazil-wikipedia-article-text.pdf"
result = (
client.query
.get("WikipediaLangChain", "text")
.with_generate(grouped_task = generateTask)
.with_where({
"operator": "Equal",
"path": ["source"],
"valueText": source_file
})
.with_near_text({
"concepts": ["traditional Food"]
})
#.with_hybrid(
# query="traditional Food",
#)
.with_additional('rerank(property: "text" query: "fruit") { score }')
.with_limit(5).do()
)
and this was the result I got:
{
"data": {
"Get": {
"WikipediaLangChain": [
{
"_additional": {
"generate": null, <-------- NO GENERATED ANSWER
"rerank": [
{
"score": 0.14139993
}
]
},
"text": "make pa\u00e7oca, rapadura and p\u00e9-de-moleque. Local common fruits like a\u00e7a\u00ed, cupua\u00e7u, mango, papaya, cocoa, cashew,\nguava, orange, lime, passionfruit, pineapple, and hog plum are turned in juices and used to make chocolates, ice pops and\nice cream.\nCinema\nThe Brazilian film industry began in the late 19th century, during the early days of the Belle \u00c9poque. While there were"
},
Is this what you are trying to do?
Thanks!
I’m…not quite sure. Here’s what I’m currently doing:
query = '''
query {
Get {
Article(
limit: 100
hybrid: {
query: PLACEHOLDER
alpha: 0.75
fusionType: relativeScoreFusion
}) {
text
_additional {
score
explainScore
rerank(
property: "text"
query: PLACEHOLDER
) {
score
}
}
}
}
}
'''.replace("PLACEHOLDER", json.dumps(query_string))
What i’m wondering is how can feed the output of the reranker to the QA module with the query. i.e. combine the above with something like:
{
Get {
Article(
ask: {
question: PLACEHOLDER,
properties: ["text"],
},
limit: 10
) {
title
_additional {
answer {
hasAnswer
property
result
startPosition
endPosition
}
}
}
}
}
I’ve made an attempt to combine “hybrid” and “ask” in the same query, but the search result doesn’t seem to be affected compared to just using “ask” alone.