freeplay_feedback is a special case to capture your primary positive/negative user feedback signals from customers. It accepts only the following string values:
positivewill render a 👍 in the UInegativewill render as a 👎 in the UI
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Log customer feedback and events associated with LLM completions.
freeplay_feedback is a special case to capture your primary positive/negative user feedback signals from customers. It accepts only the following string values:
positive will render a 👍 in the UInegative will render as a 👎 in the UI| Method Name | Parameters | Description |
|---|---|---|
update | completion_id: string feedback: dict | Log feedback associated with a specified completion |
# create a session which will create a UID
session = fpClient.sessions.create()
# record the results
payload = RecordPayload(
project_id=project_id,
all_messages=all_messages,
inputs=prompt_vars,
session_info=session.session_info,
prompt_version_info=prompt_info,
call_info=CallInfo.from_prompt_info(prompt_info, start_time=s, end_time=e),
)
# this will create the completion id needed for the logging of customer feedback
completion_info = fpClient.recordings.create(payload)
# add some customer feedback
fpClient.customer_feedback.update(
completion_id=completion_info.completion_id,
feedback={'freeplay_feedback': 'positive',
'link_clicked': True}
)
// create a session
let session = fpClient.sessions.create({});
// record the interaction with Freeplay
const completionInfo = await fpClient.recordings.create({
projectId,
allMessages: messages,
inputs: promptVars,
sessionInfo: getSessionInfo(session),
promptVersionInfo: formattedPrompt.promptInfo,
callInfo: getCallInfo(formattedPrompt.promptInfo, start, end),
});
// record customer feedback
await fpClient.customerFeedback.update({
completionId: completionInfo.completionId,
customerFeedback: {
"freeplay_feedback": "positive",
"link_click": true
},
});
fpClient.recordings().create(
new RecordInfo(projectId, allMessages)
.inputs(variables)
.sessionInfo(sessionInfo)
.promptVersionInfo(formattedPrompt.getPromptInfo())
.callInfo(callInfo))
.thenCompose(recordResponse ->
fpClient.customerFeedback().update(
projectId,
recordResponse.getCompletionId(),
Map.of("helpful", "thumbsup")
)
.thenApply(feedbackResponse -> recordResponse)
);
// build the final record payload
val recordResponse = fpClient.recordings().create(
RecordInfo(
projectId,
allMessages
).inputs(variables)
.sessionInfo(session.sessionInfo)
.promptVersionInfo(prompt.promptInfo)
.callInfo(callInfo)
).await()
// log customer feedback
val feedbackResponse = fpClient.customerFeedback().update(
recordResponse.completionId,
mapOf("freeplay_feedback" to "positive")
).await()
