Threads are a way to visualize multi-step conversations. They hold less technical details as Traces and are showing the chronological discussion between assistant and user.


Viewing Threads

To view Threads, head to the Traces section and select the Threads tab.

The Threads Overview, dates, duration, traces, and costs are available to see.

The Threads Overview, dates, duration, traces, and costs are available to see.


By selecting a Thread, you can then visualize the conversation.

With each Trace you can see the Input sent to the [Deployment](doc:deployment) and the resulting generation.

With each Trace you can see the Input sent to the Deployment and the resulting generation.


Adding a Deployment Generation to a Thread

Threads are configured at runtime when using the Invoke API.

The API receives the following extra parameter:

Conversations will be grouped by Thread ID

Tags can be used to filter and search Threads in the panel.

{
  "thread": { 
   	"id": "<unique-thread-id>",
    "tags": ["tag1", "tag2"]
  }
}

Using the previously mentioned payload, the invoke call looks as follow:

import os

from orq_ai_sdk import Orq

client = Orq(
  api_key=os.environ.get("ORQ_API_KEY", "<insert your api key here>"),
  environment="production",
)

generation = client.deployments.invoke(
  key="deployment-demo",
  context={
    "environments": []
  },
  metadata={
    "custom-field-name": "custom-metadata-value"
  },
  thread={
    "id": "<insert unique thread id here>", 
    "tags": ["tag1", "tag2"]
  }
)

print(generation.choices[0].message.content)
import { Orq } from '@orq-ai/node';

const client = new Orq({
  apiKey: '<insert orq api key>',
  environment: 'production'
});

const deployment = await client.deployments.invoke({
   key: "deployment-demo",
   context: {
      environments: []
   },
   metadata: {
      "custom-field-name": "custom-metadata-value"
   },
   thread: {
      "id": "<insert unique thread id>",
      "tags": ["tag1", "tag2"] 
   }
});
curl 'https://my.orq.ai/v2/deployments/invoke' \
-H 'Authorization: Bearer <insert Orq API key>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
   "key": "deployment-demo",
   "context": {
      "environments": []
   },
   "metadata": {
      "custom-field-name": "custom-metadata-value"
   }, "thread": { "id": "<insert unique thread id>", "tags": ["tag1", "tag2"]}
}' \
--compressed