Added Feedback in SDK (#2393)
This commit is contained in:
@@ -23,6 +23,8 @@ export type {
|
||||
Message,
|
||||
AllUsers,
|
||||
User,
|
||||
FeedbackPayload,
|
||||
Feedback,
|
||||
} from "./mem0.types";
|
||||
|
||||
// Export telemetry types
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
Webhook,
|
||||
WebhookPayload,
|
||||
Message,
|
||||
FeedbackPayload,
|
||||
} from "./mem0.types";
|
||||
import { captureClientEvent, generateHash } from "./telemetry";
|
||||
|
||||
@@ -560,6 +561,18 @@ export default class MemoryClient {
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
async feedback(data: FeedbackPayload): Promise<{ message: string }> {
|
||||
const response = await this._fetchWithErrorHandling(
|
||||
`${this.host}/v1/feedback/`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(data),
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
export { MemoryClient };
|
||||
|
||||
@@ -31,6 +31,12 @@ export enum API_VERSION {
|
||||
V2 = "v2",
|
||||
}
|
||||
|
||||
export enum Feedback {
|
||||
POSITIVE = "POSITIVE",
|
||||
NEGATIVE = "NEGATIVE",
|
||||
VERY_NEGATIVE = "VERY_NEGATIVE",
|
||||
}
|
||||
|
||||
export interface MultiModalMessages {
|
||||
type: "image_url";
|
||||
image_url: {
|
||||
@@ -164,3 +170,9 @@ export interface WebhookPayload {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface FeedbackPayload {
|
||||
memory_id: string;
|
||||
feedback?: Feedback | null;
|
||||
feedback_reason?: string | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user