Languages & Environments
Usage Documentation
- Sharing Requests
- Prompt Registry
- Running Requests
- Advanced Logging
- FAQ
Why PromptLayer?
Reference
- REST API Reference
- POSTGet Prompt Template
- POSTPublish Prompt Template
- GETGet Prompt Template Labels
- PATCHMove Prompt Template Labels
- DELDelete a Prompt Template Label
- POSTCreate a Prompt Template Label
- POSTTrack Score
- POSTTrack Prompt
- POSTTrack Group
- POSTTrack Metadata
- GETGet All Prompt Templates
- POSTCreate Dataset from History
- POSTCreate Evaluation Pipeline
- DELDelete Reports by Name
- POSTLog Request
- GETGet Agent Version Execution Results
- POSTRun Agent
Reference
Create Dataset from History
POST
/
dataset-from-filter-params
curl --request POST \
--url https://api.promptlayer.com/dataset-from-filter-params \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"name": "<string>",
"workspace_id": 123,
"q": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"tags_and": [
"<string>"
],
"tags_or": [
"<string>"
],
"metadata_and": [
{
"key": "<string>",
"value": "<string>"
}
],
"metadata_or": [
{
"key": "<string>",
"value": "<string>"
}
],
"scores": [
{
"name": "<string>",
"operator": "<string>",
"value": 123
}
],
"starred": true,
"prompt_template": {
"name": "<string>",
"version_numbers": [
123
]
},
"limit": 123
}'
{
"success": true,
"message": "<string>",
"dataset_id": 123
}
This endpoint allows you to create a dataset based on a historical search query. Search filters can include tags, metadata, and other criteria such as time range and scores. This dataset is then stored in a given workspace.
Example Code
import requests
response = requests.post(
"https://api.promptlayer.com/dataset-from-filter-params",
headers=headers,
json={
"name": "Dataset Name",
"workspace_id": 1,
"q": "javascript",
"start_time": "2023-11-17 20:14:31.874642",
"end_time": "2024-11-18 20:14:31.874642",
"tags_or": ["prod", "dev"],
"metadata": [
{"key": "user_id", "value": "abc123"},
{"key": "success", "value": "true"}
],
"scores": [
{"name": "default", "operator": ">", "value": 90}
],
"starred": True,
"prompt_template": {
"name": "recipe_template",
"version_numbers": [50, 51]
},
"limit": 500,
}
)
Headers
API key to authorize the operation.
Body
application/json
Response
200
application/json
Dataset created successfully
The response is of type object
.
Was this page helpful?
curl --request POST \
--url https://api.promptlayer.com/dataset-from-filter-params \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"name": "<string>",
"workspace_id": 123,
"q": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"tags_and": [
"<string>"
],
"tags_or": [
"<string>"
],
"metadata_and": [
{
"key": "<string>",
"value": "<string>"
}
],
"metadata_or": [
{
"key": "<string>",
"value": "<string>"
}
],
"scores": [
{
"name": "<string>",
"operator": "<string>",
"value": 123
}
],
"starred": true,
"prompt_template": {
"name": "<string>",
"version_numbers": [
123
]
},
"limit": 123
}'
{
"success": true,
"message": "<string>",
"dataset_id": 123
}
Assistant
Responses are generated using AI and may contain mistakes.