Include retrievals

Include the retrieval results when invoking your deployment.

When querying a Deployment using a Knowledge Base, it is possible to fetch the details of the knowledge base retrievals during generation.

Invoking with retrieval

When using Invoke a Deployment, use the optional field include_retrievals to embed the retrieval chunks within the response payload.

Here are examples on how to use the include_retrievals field in the invoke_options object in your queries payload.

curl --location 'https://my.orq.ai/v2/deployments/invoke' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer xxxxx' \
--data '{
    "key": "deployment_key",
    "messages": [
        {
            "role": "user",
            "content": ""
        }
    ],
    "invoke_options": {
        "include_retrievals": true
    }
}'
generation = client.deployments.invoke(
    key="deployment_key",
    messages=[
      {
        "role": "user",
        "content": ""
      }
    ],
    invoke_options={"include_retrievals": true}
)

print(generation.choices[0].message.content)
const deployment = await client.deployments.invoke({
   key: "deployment_key",
   messages: [
     {
       "role": "user",
       "content": ""
     }
   ],
  invoke_options: { include_retrievals: true },
});

Your invokation will then embed the response chunks from the response field retrievals as follow

The retrieval results will be embeded in the `retrievals` field, they contain the document details as well as metadata related to the file and search score.

The retrieval results will be embedded in the retrievals field, they contain the document details as well as metadata related to the file and search score.