Syntax Supported by Indexes
A large model index is used to identify or locate the position or number of a prompt or response content in the JSONPath of the request body. It complies with the JSONPath syntax. If your enable Injection Detection, Compliance Check, and Response Compliance Check are enabled, you need to configure indexes to facilitate the searching, accessing, and processing of prompt or response content.
- Prompt Index: If Injection Detection and Compliance Check are enabled, this index is used to locate the position of the prompt in the JSONPath of the request body. All syntax in the following table is supported.
- Response Content Index: If Response Compliance Check is enabled, this index is used to locate the response content in the JSONPath of the response body. Syntax 1, 2, 3, and 5 in the following table are supported. Wildcard extraction is not supported.
|
No. |
Scenario |
JSON structure |
Path (Max. Depth: 10 Levels) |
Result |
Description |
|---|---|---|---|---|---|
|
1 |
Single object |
{"prompt": {"role": "user","content": "..."}} |
$.prompt.content |
"..." |
Periods (.) are used to access subnodes layer by layer to locate the target field. Each subnode name in the path must be explicitly specified. |
|
2 |
Obtaining the first element |
{"prompt": [{"role": "user","content": "A"}, {"role":"assistant", "content": "B"}]} |
$.prompt[0].content |
"A" |
The array index starts from 0. [0] indicates the first element. |
|
3 |
Obtaining the last element |
{"prompt": [{"role": "user","content": "A"}, {"role":"assistant", "content": "B"}]} |
$.prompt[-1].content |
["B"] |
The negative index -1 is used to indicate the last element. |
|
4 |
Obtaining elements using the wildcard character |
{"prompt": [{"role": "user","content": "A"}, {"role":"assistant", "content": "B"},{"role": "user", "content": "C"}]} |
$.prompt[*].content |
["A", "B", "C"] |
[*] matches all elements in an array. Recursive retrieval is not supported. |
|
5 |
Obtaining the root node |
{"prompt": [{"role": "user","content": "A"}, {"role":"assistant", "content": "B"}]} |
$ |
{"prompt":[{"role": "user","content": "A"},{"role":"assistant","content":"B"}]} |
The JSON content of the root node is obtained. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot