Log conversations
You can log chat conversations to the Opik platform and track the full conversations your users are having with your chatbot.

Logging conversations
You can log chat conversations by specifying the thread_id
parameter when using either the low level SDK or
Python decorators:
Python decorators
Low level SDK
The input to each trace will be displayed as the user message while the output will be displayed as the AI assistant response.
Reviewing conversations
Conversations can be viewed at a project level in the threads
tab. All conversations are tracked and by clicking on the thread ID you will be able to
view the full conversation.
The thread view supports markdown making it easier for you to review the content that was returned to the user. If you would like to dig in deeper, you
can click on the View trace
button to deepdive into how the AI assistant response was generated.
By clicking on the thumbs up or thumbs down icons, you can quickly rate the AI assistant response. This feedback score will be logged and associated to the relevant trace. By switching to the trace view, you can review the full trace as well as add additional feedback scores through the annotation functionality.

Scoring conversations
It is possible to to assign conversation level feedback scores. For that, you need to understand how threads work in Opik. Threads are aggregated traces
that are created when tracking agents or simply traces interconnected by a thread_id
. In order to score a conversation, we need to ensure that the
thread is inactive, meaning that no new traces are being created.
By default, threads are marked as inactive after 15 minutes of inactivity. You can change this value by setting the OPIK_TRACE_THREAD_TIMEOUT_TO_MARK_AS_INACTIVE
environment variable (If you are using the Opik self-hosted version).
On cloud, you can change this setting at workspace level.
Threads are automatically marked as inactive after the timeout period and you can also manually mark a thread as inactive via UI using the Status
button on top right corner of the thread view.

Once a thread is inactive, you can assign a feedback score to the thread. This score will be associated to the thread and will be displayed in the thread view.

And in the conversation list, you can see the feedback score associated to the thread.

Important: The human feedback scores are removed in case the thread is re-activated. This is to avoid any confusion and to ensure that the feedback scores are always based on the full context of the conversation.
You can also tag a thread and add comments to it. This is useful to add additional context during the review process or investigate a specific conversation.
