Skip to content

Commit

Permalink
feat: add rate search
Browse files Browse the repository at this point in the history
  • Loading branch information
SaraVieira authored and cdxker committed Oct 1, 2024
1 parent a0331ab commit 54fa779
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clients/ts-sdk/src/functions/analytics/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ describe("Analytics Tests", async () => {

expectTypeOf(data).toBeVoid();
});

test("rateSearchQuery", async () => {
const data = await trieve.rateSearchQuery({
rating: 1,
query_id: "9892d267-3dc7-43b7-8fc2-700903baa217",
});

expectTypeOf(data).toBeVoid();
});
test("getTopDatasets", async () => {
const data = await trieve.getTopDatasets({
organizationId: "de73679c-707f-4fc2-853e-994c910d944c",
Expand Down
28 changes: 28 additions & 0 deletions clients/ts-sdk/src/functions/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,34 @@ export async function rateRagQuery(
this: TrieveSDK,
data: RateQueryRequest,
signal?: AbortSignal
) {
return this.trieve.fetch(
"/api/analytics/rag",
"put",
{
data,
datasetId: this.datasetId,
},
signal
);
}

/**
* Function that allows you to rate a search query.
*
* Example:
* ```js
*const data = await trieve.rateSearchQuery({
query_id: 123,
rating: 1,
});
* ```
*/
export async function rateSearchQuery(
/** @hidden */
this: TrieveSDK,
data: RateQueryRequest,
signal?: AbortSignal
) {
return this.trieve.fetch(
"/api/analytics/search",
Expand Down

0 comments on commit 54fa779

Please sign in to comment.