Overview
Client-side SDK for collecting user feedback
The CobblPublicClient is designed for client-facing operations that don't require authentication. Use this client when you need to collect user feedback in browser environments.
The public client is safe to use in browser environments — no API key required.
When to Use CobblPublicClient
- Submitting user feedback for prompt runs
- Updating feedback with additional details
- Browser-based applications (React, Vue, vanilla JS)
- Any public-facing context where users interact with AI outputs
For executing prompts with your API key, use the CobblAdminClient instead. It's designed for server-side operations where you can securely store your API key.
Installation
npm install @cobbl-ai/sdkInitialization
import { CobblPublicClient } from '@cobbl-ai/sdk'
const publicClient = new CobblPublicClient()No configuration is required for production use!
Methods
createFeedback
Create new feedback for a prompt run.
const { id } = await publicClient.createFeedback({
runId: 'run_abc123',
helpful: 'helpful',
userFeedback: 'Great response!',
})| Parameter | Type | Required | Description |
|---|---|---|---|
runId | string | Yes | The run ID from runPrompt() |
helpful | 'helpful' | 'not_helpful' | No* | Whether the output was helpful |
userFeedback | string | No* | Detailed feedback message |
At least one of helpful or userFeedback is required.
updateFeedback
Update existing feedback with additional data.
await publicClient.updateFeedback(feedbackId, {
userFeedback: 'Actually, could use more detail on the second point.',
})| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The feedback ID from createFeedback |
helpful | 'helpful' | 'not_helpful' | No | Update the helpfulness rating |
userFeedback | string | No | Update the feedback text |
See Collecting Feedback for detailed usage examples.
Import Patterns
Namespaced Import
For optimal tree-shaking and bundle size:
import { CobblPublicClient } from '@cobbl-ai/sdk'This approach results in smaller bundle sizes as unused code is eliminated.