You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/llm_observability/evaluations/managed_evaluations/_index.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,16 +171,17 @@ This check identifies instances where the LLM makes a claim that disagrees with
171
171
| Evaluated on Output | Evaluated using LLM | Hallucination flags any output that disagrees with the context provided to the LLM. |
172
172
173
173
##### Instrumentation
174
-
175
-
In order to take advantage of Hallucination detection, you will need to annotate LLM spans with the user query and context:
174
+
You can use [Prompt Tracking][6] annotations to track your prompts and set them up for hallucination configuration. Annotate your LLM spans with the user query and context so hallucination detection can evaluate model outputs against the retrieved data.
176
175
177
176
{{< code-block lang="python" >}}
178
177
from ddtrace.llmobs import LLMObs
179
-
from ddtrace.llmobs.utils import Prompt
178
+
from ddtrace.llmobs.types import Prompt
180
179
181
180
# if your llm call is auto-instrumented...
182
181
with LLMObs.annotation_context(
183
182
prompt=Prompt(
183
+
id="generate_answer_prompt",
184
+
template="Generate an answer to this question :{user_question}. Only answer based on the information from this article : {article}",
The variables dictionary should contain the key-value pairs your app uses to construct the LLM input prompt (for example, the messages for an OpenAI chat completion request). Set `rag_query_variables` and `rag_context_variables` to indicate which variables constitute the query and the context, respectively. A list of variables is allowed to account for cases where multiple variables make up the context (for example, multiple articles retrieved from a knowledge base).
207
+
The `variables` dictionary should contain the key-value pairs your app uses to construct the LLM input prompt (for example, the messages for an OpenAI chat completion request). Use `rag_query_variables` and `rag_context_variables` to specify which variables represent the user query and which represent the retrieval context. A list of variables is allowed to account for cases where multiple variables make up the context (for example, multiple articles retrieved from a knowledge base).
206
208
207
209
Hallucination detection does not run if either the rag query, the rag context, or the span output is empty.
208
210
209
-
You can find more examples of instrumentation in the [SDK documentation][6].
211
+
Prompt Tracking is available on python starting from the 3.15 version, It also requires an ID for the prompt and the template set up to monitor and track your prompt versions.
212
+
You can find more examples of prompt tracking and instrumentation in the [SDK documentation][6].
210
213
211
214
##### Hallucination configuration
212
215
<divclass="alert alert-info">Hallucination detection is only available for OpenAI.</div>
@@ -336,8 +339,8 @@ This check ensures that sensitive information is handled appropriately and secur
0 commit comments