Manage logs and datasets
Klu records each Action generation as a log. You can review those logs, attach feedback, save selected rows as a Dataset, and export data for analysis or training.
Before you begin
You need a Klu workspace, an App, and at least one Action. To log data with an SDK, you also need a workspace API key and the Action GUID.
Review generated data
Open your App and select Logs in the sidebar. The table contains generations recorded by Klu Studio and by your integrations.
Use the filter control to narrow the table. Available filters depend on the data recorded for the App and can include date, Action, version, input, feedback, issue, Dataset, experiment, user, model-derived insights, tool use, context use, and errors.
Select a row to inspect its input, output, prompt, model information, token counts, latency, metadata, and feedback. Fields that were not supplied when the generation was logged remain empty.
Add feedback
Use the rating control on a log to record positive or negative feedback. Open the log drawer to add a correction, an issue, or another user signal. Feedback is stored separately from the generation, so you can add more than one signal to the same data point.
Save logs as a Dataset
- In Logs, apply filters or select individual rows.
- Select Save Dataset.
- Enter Dataset Name.
- Choose whether the items are for training, evaluation, or both. Optimize (80/20) creates a training/evaluation split.
- To include every matching row, enable Select all data (with current filter).
- Select Save Dataset.
Klu opens the new Dataset after it is created. You can also open Datasets from the App sidebar to view all saved Datasets, import more items, edit individual items, add an Eval, or start a supported fine-tune.
For a repeatable SDK workflow that imports existing production history, see Backfill historical logs.
Import a file into a Dataset
Open Datasets and select Import Data. Enter a Dataset Name, upload a .jsonl or .csv file, choose its split, and select Save. Use Download Example File in the import dialog for the accepted local-file shape:
JSONL import
{"input":"Hello, world!","output":"Hello, user!"}
{"input":"Goodbye, world!","output":"Goodbye, user!"}
The import runs in the background. Keep the Dataset until its import status completes, then review the item count and contents. Invalid rows or records without usable input and output values fail validation or produce an import error.
Log data with an SDK
Both SDKs are asynchronous. Every create call must be awaited.
Log a generation and feedback
import asyncio
from klu import Klu
async def main() -> None:
klu = Klu("YOUR_API_KEY")
data = await klu.data.create(
input="Summarize the launch notes",
output="The release improves search and export reliability.",
action_guid="YOUR_ACTION_GUID",
model="gpt-4o-mini",
latency=842,
num_input_tokens=18,
num_output_tokens=10,
meta_data={"environment": "production"},
)
await klu.feedback.log(
data_guid=data.guid,
rating="Positive",
correction="The release improves search, exports, and retry handling.",
source="SDK",
created_by="YOUR_USER_ID",
)
print(data.guid)
asyncio.run(main())
Python uses action_guid, session_guid, and meta_data. TypeScript uses actionGuid, sessionGuid, and metadata. Rating values are Positive and Negative; the SDKs convert them to the API representation.
Create a Dataset with an SDK
Create the data points first, then pass their GUIDs to the Dataset client.
Create a Dataset
import asyncio
from klu import Klu
async def main() -> None:
klu = Klu("YOUR_API_KEY")
dataset = await klu.dataset.create(
name="Launch summaries",
description="Reviewed production examples",
app="YOUR_APP_GUID",
data=["YOUR_DATA_GUID"],
)
print(dataset.guid)
asyncio.run(main())
The Python client property is dataset, singular. The TypeScript creation method is createDS; the generic create method does not provide the same Dataset-specific signature.
Export data
In Logs, select rows or enable export for all rows matching the current filters, then choose Export CSV or Export JSONL. CSV includes the available data attributes. JSONL is prepared for model-training workflows.
Export preparation is asynchronous. A successful request shows Export started, and Klu emails the download link when the file is ready. If the export request fails, adjust the selection or filters and retry.