POST
/
datasets
/
{dataset_id}
Python
from opperai import Opper
import time

opper = Opper(http_bearer="YOUR_API_KEY")

# First, create a function to get a dataset_id
unique_name = f"geography_qa_{int(time.time())}"
created_function = opper.functions.create(
    name=unique_name,
    description="Geography question answering assistant",
    instructions="Answer geography questions accurately and concisely.",
    model="openai/gpt-4o-mini",
)

print(f"Created function with ID: {created_function.id}")
print(f"Function dataset ID: {created_function.dataset_id}")

# Create a new dataset entry using the function's dataset_id
entry = opper.datasets.create_entry(
    dataset_id=created_function.dataset_id,
    input="What is the capital of France?",
    output="The capital of France is Paris.",
    expected="Paris is the capital and largest city of France.",
    comment="Basic geography question with enhanced expected output",
)

print(f"Created entry: {entry.id}")
print(f"Input: {entry.input}")
print(f"Output: {entry.output}")
{
  "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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

dataset_id
string<uuid>
required

The id of the dataset

Body

application/json
input
any
required

The input to the dataset entry

output
any
required

The output to the dataset entry

expected
any

The expected output to the dataset entry, this is an optionally edited version of the output

comment
string | null

The comment to the dataset entry

Example:

"This is an example of how one can edit the output"

Response

Successful Response

id
string<uuid>
required

The id of the dataset entry

input
string
required

The input to the dataset entry

Example:

"Given this input, what is the output?"

output
string
required

The output to the dataset entry

Example:

"This is the output to the dataset entry"

expected
string | null

The expected output to the dataset entry, this is an optionally edited version of the output

Example:

"Thiswasthe output to the dataset entry"

comment
string | null

The comment to the dataset entry

Example:

"This is an example of how one can edit the output"