How to provide context?

Hi,

I have two questions related to each other.

  1. How can i properly provide context for a conversation like in the following screenshot?

Request body was

{
    "query": [
        {
            "query": "What's the test sensitivity?",
            "queryContext":  "", 
            "start": 0,
            "numResults": 10,
            "corpusKey": [
                {
                    "customerId": 1234455,
                    "corpusId": 1,
                    "semantics": 0,
                    "lexicalInterpolationConfig": {
                        "lambda": 0.025
                    },
                    "dim": [],
                    "metadataFilter": "part.type='IFU' and part.entity='Xtrava Health'"
                }
            ],
            "context_config": {
                "charsBefore": 0,
                "charsAfter": 0,
                "sentences_before": 2,
                "sentences_after": 2,
                "start_tag": "%START_SNIPPET%",
                "end_tag": "%END_SNIPPET%"
            },
            "summary": [
                {
                    "responseLang": "en",
                    "maxSummarizedResults": 5,
                    "summarizerPromptId": 1,
                    "promptText": "",
                    "debug": false,
                    "responseChars": 0
                }
            ]
        }
    ]
}

I know there is field called queryContext. I couldn’t find documentation on how to use it. So i tried setting it with a couple of different text. In which none worked for me.

I tried the following:

a.

{
  "query": "[NEW_QUERY]",
  "queryContext":  "[PREVIOUS_QUERY]", 
}

b.

{
  "query": "[NEW_QUERY]",
  "queryContext":  "[PREVIOUS_SUMMARY_TEXT]", 
}

c.

{
   "query": "[NEW_QUERY]",
   "queryContext":  "[PREVIOUS_QUERY] [PREVIOUS_SUMMARY_TEXT]", 
}
  1. Can the api return short answers? Like yes and no answers. Or in the above screenshot, to give me the number I ask it for?

Thanks!

Hello Kassem,

queryContext is the correct field to use, and you are using it correctly in all three examples you shared: (a), (b), and (c). Unfortunately, the current neural encoder does not make effective use of the context, which is why you’re not seeing any differences in the results returned. We hope to address this shortcoming in the next iteration of our model, which is currently under development.

Regarding your second question, “Can the API return short answers? Like yes and no answers.” the answer is yes, but it requires configuring a custom prompt. I’m not sure if that’s available in the free plan. Someone else on the team will be able to provide more information about how to go about setting that up.