Run an experiment
import requests
url = "https://app.langwatch.ai/api/experiments/{slug}/run"
payload = {
"data": [{}],
"dataset_id": "<string>",
"parameters": {},
"row_indices": [1]
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: [{}], dataset_id: '<string>', parameters: {}, row_indices: [1]})
};
fetch('https://app.langwatch.ai/api/experiments/{slug}/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/experiments/{slug}/run \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"data": [
{}
],
"dataset_id": "<string>",
"parameters": {},
"row_indices": [
1
]
}
'{
"runId": "<string>",
"status": "<string>",
"total": 123,
"runUrl": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}Experiments
Run an experiment
Start a run of a saved experiment, addressed by slug. Returns a runId to poll straight away. Send Accept: text/event-stream instead to stream progress events until the run finishes.
POST
/
api
/
experiments
/
{slug}
/
run
Run an experiment
import requests
url = "https://app.langwatch.ai/api/experiments/{slug}/run"
payload = {
"data": [{}],
"dataset_id": "<string>",
"parameters": {},
"row_indices": [1]
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: [{}], dataset_id: '<string>', parameters: {}, row_indices: [1]})
};
fetch('https://app.langwatch.ai/api/experiments/{slug}/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/experiments/{slug}/run \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"data": [
{}
],
"dataset_id": "<string>",
"parameters": {},
"row_indices": [
1
]
}
'{
"runId": "<string>",
"status": "<string>",
"total": 123,
"runUrl": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}Authorizations
Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.
Path Parameters
Body
application/json
Rows to evaluate inline, instead of the experiment's saved dataset. Mutually exclusive with dataset_id.
A saved dataset to evaluate, instead of the one the experiment is configured with. Mutually exclusive with data.
Constant inputs applied to every row, overriding fields of the same name
Show child attributes
Show child attributes
Run only these rows of the dataset, by zero-based index
Required range:
x >= 0Was this page helpful?
⌘I