Llm

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
PATCH
DELETE
POST

Retrieve llm analytics trace reviews

Required API key scopes

llm_analytics:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/llm_analytics/trace_reviews/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/llm_analytics/trace_reviews/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trace_id": "string",
"trace_url": "http://example.com",
"comment": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"reviewed_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"scores": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"definition_kind": "string",
"definition_archived": true,
"definition_version_id": "3b4c7def-d68b-4f5f-846c-43f0f8a328ab",
"definition_version": 0,
"definition_config": {
"options": [
{
"key": "string",
"label": "string"
}
],
"selection_mode": "single",
"min_selections": 1,
"max_selections": 1,
"passing_rule": {
"categories": [
"string"
]
}
},
"categorical_values": [
"string"
],
"numeric_value": "string",
"boolean_value": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
],
"team": 0
}

Update llm analytics trace reviews

Required API key scopes

llm_analytics:write

Path parameters

  • id
    string

Request parameters

  • trace_id
    string
  • comment
    string | null
  • scores
    Click to open
    array
  • queue_id
    string | null

Response


Example request

PATCH /api/projects/:project_id/llm_analytics/trace_reviews/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/llm_analytics/trace_reviews/:id/\
-d trace_id="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trace_id": "string",
"trace_url": "http://example.com",
"comment": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"reviewed_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"scores": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"definition_kind": "string",
"definition_archived": true,
"definition_version_id": "3b4c7def-d68b-4f5f-846c-43f0f8a328ab",
"definition_version": 0,
"definition_config": {
"options": [
{
"key": "string",
"label": "string"
}
],
"selection_mode": "single",
"min_selections": 1,
"max_selections": 1,
"passing_rule": {
"categories": [
"string"
]
}
},
"categorical_values": [
"string"
],
"numeric_value": "string",
"boolean_value": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
],
"team": 0
}

Delete llm analytics trace reviews

Required API key scopes

llm_analytics:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/llm_analytics/trace_reviews/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/llm_analytics/trace_reviews/:id/

Example response

Status 204 No response body

Create llm analytics translate

Translate text to target language.

Required API key scopes

llm_analytics:write

Request parameters

  • text
    string
  • target_language
    string
    Default: en

Example request

POST /api/projects/:project_id/llm_analytics/translate
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/llm_analytics/translate/\
-d text="string"

Example response

Status 200