Skip to content

Commit

Permalink
cleanup: move __tests__ folder such that client can build successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
skeptrunedev committed Aug 23, 2024
1 parent bd1f26b commit 1b4098a
Show file tree
Hide file tree
Showing 14 changed files with 2,250 additions and 399 deletions.
1,774 changes: 1,407 additions & 367 deletions clients/ts-sdk/openapi.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TrieveSDK } from "../src/sdk";
import { TrieveSDK } from "../sdk";

export const GROUP_EXAMPLE_ID = "460e5ee8-98bc-4fed-b4ec-68f4d6453e5f";
export const GROUP_EXAMPLE_TRACKING_ID = "1234";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion clients/ts-sdk/src/functions/analytics/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
RecommendationAnalyticsResponse,
SearchAnalyticsResponse,
} from "../../types.gen";
import { CHUNK_EXAMPLE_ID, TRIEVE } from "../../../__tests__/constants";
import { CHUNK_EXAMPLE_ID, TRIEVE } from "../../__tests__/constants";

describe("Analytics Tests", async () => {
let trieve: TrieveSDK;
Expand Down
1 change: 1 addition & 0 deletions clients/ts-sdk/src/functions/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CTRDataRequestBody,
RAGAnalytics,
RecommendationAnalytics,
SearchAnalytics,
} from "../../fetch-client";
import { TrieveSDK } from "../../sdk";

Expand Down
2 changes: 1 addition & 1 deletion clients/ts-sdk/src/functions/chunks/chunk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
CHUNK_EXAMPLE_TRACKING_ID,
EXAMPLE_CHUNK_HTML,
TRIEVE,
} from "../../../__tests__/constants";
} from "../../__tests__/constants";

describe("Chunk Methods Test", async () => {
let trieve: TrieveSDK;
Expand Down
2 changes: 1 addition & 1 deletion clients/ts-sdk/src/functions/events/events.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { beforeAll, describe, expectTypeOf, test } from "vitest";
import { TrieveSDK } from "../../sdk";
import { EventReturn } from "../../types.gen";
import { TRIEVE } from "../../../__tests__/constants";
import { TRIEVE } from "../../__tests__/constants";

describe("Events Tests", async () => {
let trieve: TrieveSDK;
Expand Down
2 changes: 1 addition & 1 deletion clients/ts-sdk/src/functions/file/file.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { beforeAll, describe, expectTypeOf, test } from "vitest";
import { TrieveSDK } from "../../sdk";
import { File, FileDTO, UploadFileResult } from "../../types.gen";
import { EXAMPLE_FILE_ID, TRIEVE } from "../../../__tests__/constants";
import { EXAMPLE_FILE_ID, TRIEVE } from "../../__tests__/constants";
import fs from "fs";

const file = fs.readFileSync("./__tests__/uploadme.pdf");
Expand Down
2 changes: 1 addition & 1 deletion clients/ts-sdk/src/functions/groups/chunkGroup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
GROUP_EXAMPLE_ID,
GROUP_EXAMPLE_TRACKING_ID,
TRIEVE,
} from "../../../__tests__/constants";
} from "../../__tests__/constants";
import {
ChunkGroupAndFileId,
CreateChunkGroupResponseEnum,
Expand Down
4 changes: 2 additions & 2 deletions clients/ts-sdk/src/functions/message/message.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { beforeAll, describe, expectTypeOf, test } from "vitest";
import { TrieveSDK } from "../../sdk";
import { Message, Topic } from "../../types.gen";
import { EXAMPLE_TOPIC_ID, TRIEVE } from "../../../__tests__/constants";
import { Message } from "../../types.gen";
import { EXAMPLE_TOPIC_ID, TRIEVE } from "../../__tests__/constants";

describe("Message Tests", async () => {
let trieve: TrieveSDK;
Expand Down
2 changes: 1 addition & 1 deletion clients/ts-sdk/src/functions/topic/topic.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { beforeAll, describe, expectTypeOf, test } from "vitest";
import { TrieveSDK } from "../../sdk";
import { Topic } from "../../types.gen";
import { EXAMPLE_TOPIC_ID, TRIEVE } from "../../../__tests__/constants";
import { EXAMPLE_TOPIC_ID, TRIEVE } from "../../__tests__/constants";

describe("Topic Tests", async () => {
let trieve: TrieveSDK;
Expand Down
65 changes: 63 additions & 2 deletions clients/ts-sdk/src/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export type AutocompleteReqPayload = {
* If true, quoted and - prefixed words will be parsed from the queries and used as required and negated words respectively. Default is false.
*/
use_quote_negated_terms?: (boolean) | null;
/**
* User ID is the id of the user who is making the request. This is used to track user interactions with the search results.
*/
user_id?: (string) | null;
};

export type BatchQueuedChunkResponse = {
Expand Down Expand Up @@ -276,7 +280,7 @@ export type ChunkReqPayload = {
*/
group_ids?: Array<(string)> | null;
/**
* Group tracking_ids are the user-assigned tracking_ids of the groups that the chunk should be placed into. This is useful for when you want to create a chunk and add it to a group or multiple groups in one request. Groups with these user-assigned tracking_ids must be created first, it cannot be arbitrarily created through this route.
* Group tracking_ids are the user-assigned tracking_ids of the groups that the chunk should be placed into. This is useful for when you want to create a chunk and add it to a group or multiple groups in one request. If a group with the tracking_id does not exist, it will be created.
*/
group_tracking_ids?: Array<(string)> | null;
/**
Expand Down Expand Up @@ -437,6 +441,10 @@ export type CreateMessageReqPayload = {
* The ID of the topic to attach the message to.
*/
topic_id: string;
/**
* The user_id is the id of the user who is making the request. This is used to track user interactions with the RAG results.
*/
user_id?: (string) | null;
};

export type CreateOrganizationReqPayload = {
Expand Down Expand Up @@ -706,6 +714,10 @@ export type EditMessageReqPayload = {
* The id of the topic to edit the message at the given sort order for.
*/
topic_id: string;
/**
* The user_id is the id of the user who is making the request. This is used to track user interactions with the RAG results.
*/
user_id?: (string) | null;
};

export type ErrorResponseBody = {
Expand Down Expand Up @@ -818,6 +830,10 @@ export type GenerateOffChunksReqPayload = {
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Default is 0.5.
*/
temperature?: (number) | null;
/**
* User ID is the id of the user who is making the request. This is used to track user interactions with the RAG results.
*/
user_id?: (string) | null;
};

/**
Expand Down Expand Up @@ -1107,6 +1123,20 @@ export type OrganizationUsageCount = {
user_count: number;
};

export type PopularFilters = {
clause: string;
common_values: {
[key: string]: (number);
};
count: number;
field: string;
filter_type: string;
};

export type PopularFiltersResponse = {
popular_filters: Array<PopularFilters>;
};

/**
* Sort by lets you specify a method to sort the results by. If not specified, this defaults to the score of the chunks. If specified, this can be any key in the chunk metadata. This key must be a numeric value within the payload.
*/
Expand Down Expand Up @@ -1162,6 +1192,7 @@ export type RagQueryEvent = {
rag_type: string;
results: Array<ChunkMetadataStringTagSet>;
search_id: string;
user_id: string;
user_message: string;
};

Expand Down Expand Up @@ -1216,6 +1247,10 @@ export type RecommendChunksRequest = {
*/
slim_chunks?: (boolean) | null;
strategy?: ((RecommendationStrategy) | null);
/**
* User ID is the id of the user who is making the request. This is used to track user interactions with the recommendation results.
*/
user_id?: (string) | null;
};

export type RecommendChunksResponseBody = {
Expand Down Expand Up @@ -1255,6 +1290,10 @@ export type RecommendGroupsReqPayload = {
*/
slim_chunks?: (boolean) | null;
strategy?: ((RecommendationStrategy) | null);
/**
* The user_id is the id of the user who is making the request. This is used to track user interactions with the rrecommendation results.
*/
user_id?: (string) | null;
};

export type RecommendGroupsResponse = RecommendGroupsResponseBody | GroupScoreChunk;
Expand Down Expand Up @@ -1311,6 +1350,7 @@ export type RecommendationEvent = {
request_params: unknown;
results: Array<unknown>;
top_score: number;
user_id: string;
};

/**
Expand Down Expand Up @@ -1367,6 +1407,10 @@ export type RegenerateMessageReqPayload = {
* The id of the topic to regenerate the last message for.
*/
topic_id: string;
/**
* The user_id is the id of the user who is making the request. This is used to track user interactions with the RAG results.
*/
user_id?: (string) | null;
};

export type RemoveChunkFromGroupReqPayload = {
Expand Down Expand Up @@ -1445,6 +1489,9 @@ export type SearchAnalytics = {
} | {
search_id: string;
type: 'query_details';
} | {
filter?: ((SearchAnalyticsFilter) | null);
type: 'popular_filters';
};

export type type5 = 'latency_graph';
Expand All @@ -1455,11 +1502,12 @@ export type SearchAnalyticsFilter = {
search_type?: ((SearchType) | null);
};

export type SearchAnalyticsResponse = LatencyGraphResponse | SearchUsageGraphResponse | DatasetAnalytics | HeadQueryResponse | SearchQueryResponse | QueryCountResponse | SearchQueryEvent;
export type SearchAnalyticsResponse = LatencyGraphResponse | SearchUsageGraphResponse | DatasetAnalytics | HeadQueryResponse | SearchQueryResponse | QueryCountResponse | SearchQueryEvent | PopularFiltersResponse;

export type SearchCTRMetrics = {
avg_position_of_click: number;
percent_searches_with_clicks: number;
percent_searches_without_clicks: number;
searches_with_clicks: number;
};

Expand Down Expand Up @@ -1509,6 +1557,10 @@ export type SearchChunksReqPayload = {
* If true, quoted and - prefixed words will be parsed from the queries and used as required and negated words respectively. Default is false.
*/
use_quote_negated_terms?: (boolean) | null;
/**
* User ID is the id of the user who is making the request. This is used to track user interactions with the search results.
*/
user_id?: (string) | null;
};

export type SearchClusterResponse = {
Expand Down Expand Up @@ -1571,6 +1623,10 @@ export type SearchOverGroupsReqPayload = {
* If true, quoted and - prefixed words will be parsed from the queries and used as required and negated words respectively. Default is false.
*/
use_quote_negated_terms?: (boolean) | null;
/**
* The user_id is the id of the user who is making the request. This is used to track user interactions with the search results.
*/
user_id?: (string) | null;
};

export type SearchOverGroupsResponseBody = {
Expand Down Expand Up @@ -1610,6 +1666,7 @@ export type SearchQueryEvent = {
results: Array<unknown>;
search_type: string;
top_score: number;
user_id: string;
};

export type SearchQueryResponse = {
Expand Down Expand Up @@ -1686,6 +1743,10 @@ export type SearchWithinGroupReqPayload = {
* If true, quoted and - prefixed words will be parsed from the queries and used as required and negated words respectively. Default is false.
*/
use_quote_negated_terms?: (boolean) | null;
/**
* The user_id is the id of the user who is making the request. This is used to track user interactions with the search results.
*/
user_id?: (string) | null;
};

export type SearchWithinGroupResponseBody = {
Expand Down
3 changes: 2 additions & 1 deletion clients/ts-sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "config/tsconfig",
"compilerOptions": {
"noEmit": false,
"emitDeclarationOnly": true,
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"rootDir": "./src",
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
"declarationMap": true /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */,
"outDir": "./dist",
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
Expand Down
Loading

0 comments on commit 1b4098a

Please sign in to comment.