Create a thread for traces.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.sessions.create(external_id="<id>", duration=7329.24, contact_ids=[
"<value 1>",
"<value 2>",
], billing={
"input_cost": 5975.95,
"output_cost": 754.22,
"total_cost": 2965.14,
}, usage={
"prompt_tokens": 424835,
"completion_tokens": 793505,
"total_tokens": 726901,
}, traces_count=451437, tags=[
"<value 1>",
"<value 2>",
"<value 3>",
])
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
external_id |
str |
✔️ |
N/A |
duration |
float |
✔️ |
N/A |
contact_ids |
List[str] |
✔️ |
N/A |
billing |
models.ThreadBilling |
✔️ |
N/A |
usage |
models.ThreadUsage |
✔️ |
N/A |
traces_count |
int |
✔️ |
N/A |
tags |
List[str] |
✔️ |
N/A |
project_id |
Optional[str] |
➖ |
N/A |
started_at |
date |
➖ |
N/A |
updated_at |
date |
➖ |
N/A |
title |
Optional[str] |
➖ |
N/A |
client |
Optional[str] |
➖ |
N/A |
repo |
Optional[str] |
➖ |
N/A |
kind |
Optional[models.ThreadKind] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Thread
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Get total count of trace threads.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.sessions.get_count(filters={
"interval": "SESSION_INTERVAL_LAST_30_MINUTES",
})
# Handle response
print(res)
models.GetThreadCountResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
List trace threads from your workspace.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.sessions.list(filters={
"interval": "SESSION_INTERVAL_LAST_7_DAYS",
})
# Handle response
print(res)
models.ListThreadsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Retrieves all unique thread tags in the workspace.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.sessions.list_tags()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
List[str]
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Get a trace thread.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.sessions.get(session_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
session_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Thread
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Delete a trace thread.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
orq.sessions.delete(session_id="<id>")
# Use the SDK ...
| Parameter |
Type |
Required |
Description |
session_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Update a trace thread.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.sessions.update(session_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
session_id |
str |
✔️ |
N/A |
external_id |
Optional[str] |
➖ |
N/A |
duration |
Optional[float] |
➖ |
N/A |
contact_ids |
List[str] |
➖ |
N/A |
billing |
Optional[models.ThreadBilling] |
➖ |
N/A |
usage |
Optional[models.ThreadUsage] |
➖ |
N/A |
traces_count |
Optional[int] |
➖ |
N/A |
tags |
List[str] |
➖ |
N/A |
project_id |
Optional[str] |
➖ |
N/A |
started_at |
date |
➖ |
N/A |
updated_at |
date |
➖ |
N/A |
clear_contact_ids |
Optional[bool] |
➖ |
Remove every contact id. Mutually exclusive with contact_ids. |
clear_tags |
Optional[bool] |
➖ |
Remove every tag. Mutually exclusive with tags. |
title |
Optional[str] |
➖ |
N/A |
client |
Optional[str] |
➖ |
N/A |
repo |
Optional[str] |
➖ |
N/A |
kind |
Optional[models.ThreadKind] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Thread
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |