Skip to content

Commit d80cd69

Browse files
jsimphercswatt
andauthored
add example for http api prompt variables (#32772)
* add example for http api prompt variables * tabbed * fix * Update api.md --------- Co-authored-by: cecilia saixue wat-kim <cecilia.watt@datadoghq.com>
1 parent cad4094 commit d80cd69

File tree

1 file changed

+26
-0
lines changed
  • content/en/llm_observability/instrumentation

1 file changed

+26
-0
lines changed

content/en/llm_observability/instrumentation/api.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ If the request is successful, the API responds with a 202 network code and an em
167167
| id | string | The id of this document. |
168168

169169
#### Prompt
170+
{{< tabs >}}
171+
{{% tab "Model" %}}
170172
| Field | Type | Description |
171173
|----------------------|--------|--------------------------|
172174
| id | string | Logical identifier for this prompt template. Should be unique per `ml_app`. |
@@ -178,6 +180,30 @@ If the request is successful, the API responds with a 202 network code and an em
178180
| context_variable_keys | [string] | Variable keys that contain ground-truth or context content. Used for hallucination detection. |
179181
| tags | Dict[key (string), string] | Tags to attach to the prompt run. |
180182

183+
**Note**: LLM Observability registers new versions of templates when the `template` or `chat_template` value is updated. If the input is expected to change between invocations, extract the dynamic parts into a variable.
184+
185+
{{% /tab %}}
186+
{{% tab "Example" %}}
187+
{{< code-block lang="json" >}}
188+
{
189+
"id": "translation-prompt",
190+
"chat_template": [
191+
{
192+
"role": "system",
193+
"content": "You are a translation service. You translate to {{language}}."
194+
}, {
195+
"role": "user",
196+
"content": "{{user_input}}"
197+
}
198+
],
199+
"variables": {
200+
"language": "french",
201+
"user_input": "<USER_INPUT_TEXT>"
202+
}
203+
}
204+
{{< /code-block >}}
205+
{{% /tab %}}
206+
{{< /tabs >}}
181207

182208
#### Meta
183209
| Field | Type | Description |

0 commit comments

Comments
 (0)