API Reference
Platform APIs
- Models
- Functions
- Observability
- Knowledge base
- Datasets
- Other
Datasets
List Dataset Entries
GET
/
datasets
/
{dataset_id}
/
entries
Copy
Ask AI
from opperai import Opper
import time
opper = Opper(http_bearer="YOUR_API_KEY")
# First, create a function and add some entries to get a dataset with data
unique_name = f"science_qa_{int(time.time())}"
created_function = opper.functions.create(
name=unique_name,
description="Science question answering assistant",
instructions="Answer science questions clearly and accurately with helpful explanations.",
model="openai/gpt-4o-mini",
)
print(f"Created function with dataset ID: {created_function.dataset_id}")
# Add a few entries to the dataset
opper.datasets.create_entry(
dataset_id=created_function.dataset_id,
input="What is photosynthesis?",
output="Photosynthesis is the process by which plants convert sunlight, carbon dioxide, and water into glucose and oxygen.",
expected="Photosynthesis is the biological process that converts light energy into chemical energy in plants.",
)
opper.datasets.create_entry(
dataset_id=created_function.dataset_id,
input="What is gravity?",
output="Gravity is the force that attracts objects toward each other, with larger objects having stronger gravitational pull.",
expected="Gravity is a fundamental force of attraction between masses.",
)
# List dataset entries with pagination
entries = opper.datasets.list_entries(
dataset_id=created_function.dataset_id, offset=0, limit=10
)
print(f"Total entries: {entries.meta.total_count}")
for entry in entries.data:
print(f"Entry {entry.id}: {entry.input[:50]}...")
print(f" Output: {entry.output[:50]}...")
Copy
Ask AI
{
"meta": {
"total_count": 1
},
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"input": "Given this input, what is the output?",
"output": "This is the output to the dataset entry",
"expected": "This `was` the output to the dataset entry",
"comment": "This is an example of how one can edit the output"
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
The id of the dataset
Query Parameters
The offset of the entries to get
Required range:
x >= 0
The limit of the entries to get
Required range:
1 <= x <= 100
Response
200
application/json
Successful Response
The response is of type object
.
Copy
Ask AI
from opperai import Opper
import time
opper = Opper(http_bearer="YOUR_API_KEY")
# First, create a function and add some entries to get a dataset with data
unique_name = f"science_qa_{int(time.time())}"
created_function = opper.functions.create(
name=unique_name,
description="Science question answering assistant",
instructions="Answer science questions clearly and accurately with helpful explanations.",
model="openai/gpt-4o-mini",
)
print(f"Created function with dataset ID: {created_function.dataset_id}")
# Add a few entries to the dataset
opper.datasets.create_entry(
dataset_id=created_function.dataset_id,
input="What is photosynthesis?",
output="Photosynthesis is the process by which plants convert sunlight, carbon dioxide, and water into glucose and oxygen.",
expected="Photosynthesis is the biological process that converts light energy into chemical energy in plants.",
)
opper.datasets.create_entry(
dataset_id=created_function.dataset_id,
input="What is gravity?",
output="Gravity is the force that attracts objects toward each other, with larger objects having stronger gravitational pull.",
expected="Gravity is a fundamental force of attraction between masses.",
)
# List dataset entries with pagination
entries = opper.datasets.list_entries(
dataset_id=created_function.dataset_id, offset=0, limit=10
)
print(f"Total entries: {entries.meta.total_count}")
for entry in entries.data:
print(f"Entry {entry.id}: {entry.input[:50]}...")
print(f" Output: {entry.output[:50]}...")
Copy
Ask AI
{
"meta": {
"total_count": 1
},
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"input": "Given this input, what is the output?",
"output": "This is the output to the dataset entry",
"expected": "This `was` the output to the dataset entry",
"comment": "This is an example of how one can edit the output"
}
]
}
Assistant
Responses are generated using AI and may contain mistakes.