Providing Context
File Context
Sometimes, users may want to ask questions about a file or set of files. In addition to just the “Test Input”, we also allow specifying any files that are part of the input to the model.
For example, let’s say that the users question is about who has liability in a car accident. In addition to the actual question, the user may want to upload a police report, a photo of the damage, etc. Or in a question about a legal contract, it’s necessary to upload the contract itself.
To add files, open the “Add Test” pane, and then press “Add Files”. Multiple files can be added at once.
Text Context
Sometimes, it is useful to provide other additional information beyond just an input under test to a model. For example:
- You may want to provide the most recent chat history.
- Metadata about the user
- Information about the context in which a user opened a copilot
We handle all of these scenarios with our “Context” feature, which allows you to provide arbitrary additional data to a test. Context takes the form of key / value pairs. The keys are strings, and the values can either be strings, or JSON objects (see the note at the end of this page)
So, for example, if you wanted to add chat history to an input, you could add a ‘message_history’ context item. For the value, you could do something like the following:
Web UI
To add the above example in the Web UI, open up the Add Test pane. Then, press “Add Input Context”, and copy and paste like so.
SDK
See the SDK Docs for more information on how to add context to a test.
NOTE: The value of a context field can either be a raw string, or a JSON object. If it is a JSON object, it will be parsed correctly and pretty-printed in the UI.