New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

trieve-ts-sdk

Package Overview
Dependencies
Maintainers
0
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trieve-ts-sdk - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

2

dist/functions/analytics/index.d.ts

@@ -95,3 +95,3 @@ /**

/** @hidden */
this: TrieveSDK, data: RecommendationAnalytics, signal?: AbortSignal): Promise<import("../../types.gen").RecommendationsEventResponse>;
this: TrieveSDK, data: RecommendationAnalytics, signal?: AbortSignal): Promise<import("../../types.gen").RecommendationAnalyticsResponse>;
/**

@@ -98,0 +98,0 @@ * Function that allows you to view the search analytics for a dataset.

@@ -6,3 +6,3 @@ /**

*/
import { AutocompleteReqPayload, CountChunksReqPayload, CreateChunkReqPayloadEnum, DeleteChunkByTrackingIdData, DeleteChunkData, GenerateOffChunksReqPayload, GetChunkByIdData, GetChunkByTrackingIdData, GetChunksData, GetTrackingChunksData, RecommendChunksRequest, ScrollChunksReqPayload, SearchChunksReqPayload, SearchResponseBody, SuggestedQueriesReqPayload, UpdateChunkByTrackingIdData, UpdateChunkReqPayload } from "../../fetch-client";
import { AutocompleteReqPayload, CountChunksReqPayload, CreateChunkReqPayloadEnum, DeleteChunkByTrackingIdData, DeleteChunkData, GenerateOffChunksReqPayload, GetChunkByIdData, GetChunkByTrackingIdData, GetChunksData, GetTrackingChunksData, RecommendChunksRequest, RecommendChunksResponseBody, ScrollChunksReqPayload, SearchChunksReqPayload, SearchResponseBody, SuggestedQueriesReqPayload, UpdateChunkByTrackingIdData, UpdateChunkReqPayload } from "../../fetch-client";
import { TrieveSDK } from "../../sdk";

@@ -56,3 +56,3 @@ /**

/** @hidden */
this: TrieveSDK, props: AutocompleteReqPayload, signal?: AbortSignal): Promise<import("../../types.gen").SearchResponseTypes>;
this: TrieveSDK, props: AutocompleteReqPayload, signal?: AbortSignal): Promise<SearchResponseBody>;
/**

@@ -72,3 +72,3 @@ * Function that allows you to recommendations of chunks similar to the positive samples in the request and dissimilar to the negative.

/** @hidden */
this: TrieveSDK, props: RecommendChunksRequest, signal?: AbortSignal): Promise<import("../../types.gen").RecommendResponseTypes>;
this: TrieveSDK, props: RecommendChunksRequest, signal?: AbortSignal): Promise<RecommendChunksResponseBody>;
/**

@@ -97,2 +97,53 @@ * This function exists as an alternative to the topic+message resource pattern where our Trieve handles chat memory. With this endpoint, the user is responsible for providing the context window and the prompt and the conversation is ephemeral.

/**
* This function is just like ragOnChunk but it returns a reader to parse the stream easier.
* This function exists as an alternative to the topic+message resource pattern where our Trieve handles chat memory. With this endpoint, the user is responsible for providing the context window and the prompt and the conversation is ephemeral.
*
*
* Example:
* ```js
*const reader = await trieve.ragOnChunkReader({
chunk_ids: ["d290f1ee-6c54-4b01-90e6-d701748f0851"],
prev_messages: [
{
content: "How do I setup RAG with Trieve?",
role: "user",
},
],
prompt:
"Respond to the instruction and include the doc numbers that you used in square brackets at the end of the sentences that you used the docs for:",
stream_response: true,
});
* ```
*/
export declare function ragOnChunkReader(
/** @hidden */
this: TrieveSDK, props: GenerateOffChunksReqPayload, signal?: AbortSignal): Promise<ReadableStreamDefaultReader<Uint8Array>>;
/**
* This function is just like ragOnChunk but it returns a reader to parse the stream easier.
* This function exists as an alternative to the topic+message resource pattern where our Trieve handles chat memory. With this endpoint, the user is responsible for providing the context window and the prompt and the conversation is ephemeral.
*
*
* Example:
* ```js
*const { reader, queryId } = await trieve.ragOnChunkReader({
chunk_ids: ["d290f1ee-6c54-4b01-90e6-d701748f0851"],
prev_messages: [
{
content: "How do I setup RAG with Trieve?",
role: "user",
},
],
prompt:
"Respond to the instruction and include the doc numbers that you used in square brackets at the end of the sentences that you used the docs for:",
stream_response: true,
});
* ```
*/
export declare function ragOnChunkReaderWithQueryId(
/** @hidden */
this: TrieveSDK, props: GenerateOffChunksReqPayload, signal?: AbortSignal): Promise<{
reader: ReadableStreamDefaultReader<Uint8Array>;
queryId: string | null;
}>;
/**
* This function will generate 3 suggested queries based off a hybrid search using RAG with the query provided in the request body and return them as a JSON object.

@@ -99,0 +150,0 @@ *

@@ -6,3 +6,3 @@ /**

*/
import { AddChunkToGroupReqPayload, CreateChunkGroupReqPayloadEnum, DeleteChunkGroupData, DeleteGroupByTrackingIdData, GetChunkGroupData, GetChunksInGroupByTrackingIdData, GetChunksInGroupData, GetGroupByTrackingIdData, GetGroupsForChunksReqPayload, GetGroupsForDatasetData, RecommendGroupsReqPayload, RemoveChunkFromGroupReqPayload, SearchOverGroupsReqPayload, SearchWithinGroupReqPayload, UpdateChunkGroupReqPayload, UpdateGroupByTrackingIDReqPayload } from "../../fetch-client";
import { AddChunkToGroupReqPayload, CreateChunkGroupReqPayloadEnum, DeleteChunkGroupData, DeleteGroupByTrackingIdData, GetChunkGroupData, GetChunksInGroupByTrackingIdData, GetChunksInGroupData, GetGroupByTrackingIdData, GetGroupsForChunksReqPayload, GetGroupsForDatasetData, RecommendGroupsReqPayload, RecommendGroupsResponseBody, RemoveChunkFromGroupReqPayload, SearchOverGroupsReqPayload, SearchOverGroupsResponseBody, SearchWithinGroupReqPayload, SearchWithinGroupResponseBody, UpdateChunkGroupReqPayload, UpdateGroupByTrackingIDReqPayload } from "../../fetch-client";
import { TrieveSDK } from "../../sdk";

@@ -42,3 +42,3 @@ /**

/** @hidden */
this: TrieveSDK, data: SearchOverGroupsReqPayload, signal?: AbortSignal): Promise<import("../../types.gen").SearchOverGroupsResponseTypes>;
this: TrieveSDK, data: SearchOverGroupsReqPayload, signal?: AbortSignal): Promise<SearchOverGroupsResponseBody>;
/**

@@ -56,3 +56,3 @@ * This function allows you to search only within a group. This is useful for when you only want search results to contain chunks which are members of a specific group. If choosing hybrid search, the results will be re-ranked using scores from a cross encoder model.

/** @hidden */
this: TrieveSDK, data: SearchWithinGroupReqPayload, signal?: AbortSignal): Promise<import("../../types.gen").SearchGroupResponseTypes>;
this: TrieveSDK, data: SearchWithinGroupReqPayload, signal?: AbortSignal): Promise<SearchWithinGroupResponseBody>;
/**

@@ -70,3 +70,3 @@ * Function to get recommended groups. This route will return groups which are similar to the groups in the request body. You must provide at least one positive group id or group tracking id.

/** @hidden */
this: TrieveSDK, data: RecommendGroupsReqPayload, signal?: AbortSignal): Promise<import("../../types.gen").RecommendGroupsResponse>;
this: TrieveSDK, data: RecommendGroupsReqPayload, signal?: AbortSignal): Promise<RecommendGroupsResponseBody>;
/**

@@ -73,0 +73,0 @@ * Update a chunk_group. One of group_id or tracking_id must be provided. If you try to change the tracking_id to one that already exists, this operation will fail. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization.

@@ -13,8 +13,17 @@ declare const _default: {

}>;
editMessage(this: import("..").TrieveSDK, data: import("..").EditMessageReqPayload, signal?: AbortSignal): Promise<unknown>;
editMessage(this: import("..").TrieveSDK, data: import("..").EditMessageReqPayload, signal?: AbortSignal): Promise<string>;
editMessageReader(this: import("..").TrieveSDK, data: import("..").EditMessageReqPayload, signal?: AbortSignal): Promise<ReadableStreamDefaultReader<Uint8Array>>;
editMessageReaderWithQueryId(this: import("..").TrieveSDK, data: import("..").EditMessageReqPayload, signal?: AbortSignal): Promise<{
reader: ReadableStreamDefaultReader<Uint8Array>;
queryId: string | null;
}>;
regenerateMessage(this: import("..").TrieveSDK, data: import("..").RegenerateMessageReqPayload, signal?: AbortSignal): Promise<string>;
regenerateMessageReader(this: import("..").TrieveSDK, data: import("..").RegenerateMessageReqPayload, signal?: AbortSignal): Promise<ReadableStreamDefaultReader<Uint8Array>>;
regenerateMessageReaderWithQueryId(this: import("..").TrieveSDK, data: import("..").RegenerateMessageReqPayload, signal?: AbortSignal): Promise<{
reader: ReadableStreamDefaultReader<Uint8Array>;
queryId: string | null;
}>;
getAllMessagesForTopic(this: import("..").TrieveSDK, data: Omit<import("..").GetAllTopicMessagesData, "trDataset">, signal?: AbortSignal): Promise<import("..").Message[]>;
createTopic(this: import("..").TrieveSDK, data: import("..").CreateTopicReqPayload, signal?: AbortSignal): Promise<import("..").Topic>;
cloneTopic(this: import("..").TrieveSDK, data: import("..").CloneTopicReqPayload, signal?: AbortSignal): Promise<import("..").Topic>;
updateTopic(this: import("..").TrieveSDK, data: import("..").UpdateTopicReqPayload, signal?: AbortSignal): Promise<void>;

@@ -26,3 +35,3 @@ getAllTopics(this: import("..").TrieveSDK, data: Omit<import("..").GetAllTopicsForOwnerIdData, "trDataset">, signal?: AbortSignal): Promise<import("..").Topic[]>;

getRagAnalytics(this: import("..").TrieveSDK, data: import("..").RAGAnalytics, signal?: AbortSignal): Promise<import("..").RAGAnalyticsResponse>;
getRecommendationAnalytics(this: import("..").TrieveSDK, data: import("..").RecommendationAnalytics, signal?: AbortSignal): Promise<import("..").RecommendationsEventResponse>;
getRecommendationAnalytics(this: import("..").TrieveSDK, data: import("..").RecommendationAnalytics, signal?: AbortSignal): Promise<import("..").RecommendationAnalyticsResponse>;
getSearchAnalytics(this: import("..").TrieveSDK, data: import("..").SearchAnalytics, signal?: AbortSignal): Promise<import("..").SearchAnalyticsResponse>;

@@ -37,5 +46,5 @@ getClusterAnalytics(this: import("..").TrieveSDK, data: import("..").ClusterAnalytics, signal?: AbortSignal): Promise<import("..").ClusterAnalyticsResponse>;

createChunkGroup(this: import("..").TrieveSDK, data: Omit<import("..").CreateChunkGroupReqPayloadEnum, "datasetId">): Promise<import("..").CreateChunkGroupResponseEnum>;
searchOverGroups(this: import("..").TrieveSDK, data: import("..").SearchOverGroupsReqPayload, signal?: AbortSignal): Promise<import("..").SearchOverGroupsResponseTypes>;
searchInGroup(this: import("..").TrieveSDK, data: import("..").SearchWithinGroupReqPayload, signal?: AbortSignal): Promise<import("..").SearchGroupResponseTypes>;
recommendedGroups(this: import("..").TrieveSDK, data: import("..").RecommendGroupsReqPayload, signal?: AbortSignal): Promise<import("..").RecommendGroupsResponse>;
searchOverGroups(this: import("..").TrieveSDK, data: import("..").SearchOverGroupsReqPayload, signal?: AbortSignal): Promise<import("..").SearchOverGroupsResponseBody>;
searchInGroup(this: import("..").TrieveSDK, data: import("..").SearchWithinGroupReqPayload, signal?: AbortSignal): Promise<import("..").SearchWithinGroupResponseBody>;
recommendedGroups(this: import("..").TrieveSDK, data: import("..").RecommendGroupsReqPayload, signal?: AbortSignal): Promise<import("..").RecommendGroupsResponseBody>;
updateGroup(this: import("..").TrieveSDK, data: import("..").UpdateChunkGroupReqPayload, signal?: AbortSignal): Promise<void>;

@@ -64,5 +73,10 @@ updateGroupByTrackingId(this: import("..").TrieveSDK, data: import("..").UpdateGroupByTrackingIDReqPayload, signal?: AbortSignal): Promise<void>;

createChunk(this: import("..").TrieveSDK, props: import("..").CreateChunkReqPayloadEnum, signal?: AbortSignal): Promise<import("..").ReturnQueuedChunk>;
autocomplete(this: import("..").TrieveSDK, props: import("..").AutocompleteReqPayload, signal?: AbortSignal): Promise<import("..").SearchResponseTypes>;
getRecommendedChunks(this: import("..").TrieveSDK, props: import("..").RecommendChunksRequest, signal?: AbortSignal): Promise<import("..").RecommendResponseTypes>;
autocomplete(this: import("..").TrieveSDK, props: import("..").AutocompleteReqPayload, signal?: AbortSignal): Promise<import("..").SearchResponseBody>;
getRecommendedChunks(this: import("..").TrieveSDK, props: import("..").RecommendChunksRequest, signal?: AbortSignal): Promise<import("..").RecommendChunksResponseBody>;
ragOnChunk(this: import("..").TrieveSDK, props: import("..").GenerateOffChunksReqPayload, signal?: AbortSignal): Promise<string>;
ragOnChunkReader(this: import("..").TrieveSDK, props: import("..").GenerateOffChunksReqPayload, signal?: AbortSignal): Promise<ReadableStreamDefaultReader<Uint8Array>>;
ragOnChunkReaderWithQueryId(this: import("..").TrieveSDK, props: import("..").GenerateOffChunksReqPayload, signal?: AbortSignal): Promise<{
reader: ReadableStreamDefaultReader<Uint8Array>;
queryId: string | null;
}>;
suggestedQueries(this: import("..").TrieveSDK, props: import("..").SuggestedQueriesReqPayload, signal?: AbortSignal): Promise<import("..").SuggestedQueriesResponse>;

@@ -69,0 +83,0 @@ countChunksAboveThreshold(this: import("..").TrieveSDK, props: import("..").CountChunksReqPayload, signal?: AbortSignal): Promise<import("..").CountChunkQueryResponseBody>;

@@ -41,3 +41,3 @@ /**

* ```js
*const reader = await trieve.createMessageReader({
*const { reader, queryId } = await trieve.createMessageReader({
topic_id: "3c90c3cc-1d76-27198-8888-8dd25736052a",

@@ -68,3 +68,3 @@ new_message_content: "a new message"

/** @hidden */
this: TrieveSDK, data: EditMessageReqPayload, signal?: AbortSignal): Promise<unknown>;
this: TrieveSDK, data: EditMessageReqPayload, signal?: AbortSignal): Promise<string>;
/**

@@ -86,2 +86,20 @@ * Edit message which exists within the topic’s chat history as a stream and returns a reader. This will delete the message and replace it with a new message. The new message will be generated by the AI based on the new content provided in the request body. The response will include Chunks first on the stream if the topic is using RAG. The structure will look like [chunks]||mesage. See docs.trieve.ai for more information. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization.

/**
* Edit message which exists within the topic’s chat history as a stream and returns a reader along with the queryID. This will delete the message and replace it with a new message. The new message will be generated by the AI based on the new content provided in the request body. The response will include Chunks first on the stream if the topic is using RAG. The structure will look like [chunks]||mesage. See docs.trieve.ai for more information. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization. The queryID is used for adding tracking events to the message
*
* Example:
* ```js
*const { reader, queryId } = await trieve.editMessageReader({
topic_id: "3c90c3cc-1d76-27198-8888-8dd25736052a",
new_message_content: "a new message",
message_sort_order: 1
});
* ```
*/
export declare function editMessageReaderWithQueryId(
/** @hidden */
this: TrieveSDK, data: EditMessageReqPayload, signal?: AbortSignal): Promise<{
reader: ReadableStreamDefaultReader<Uint8Array>;
queryId: string | null;
}>;
/**
* Regenerate the assistant response to the last user message of a topic. This will delete the last message and replace it with a new message. The response will include Chunks first on the stream if the topic is using RAG. The structure will look like [chunks]||mesage. See docs.trieve.ai for more information. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization.

@@ -113,2 +131,18 @@ *

/**
* Regenerate the assistant response to the last user message of a topic as a stream and returns a reader. This will delete the last message and replace it with a new message. The response will include Chunks first on the stream if the topic is using RAG. The structure will look like [chunks]||mesage. See docs.trieve.ai for more information. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization.
*
* Example:
* ```js
*const { reader, queryId } = await trieve.regenerateMessageReader({
topic_id: "3c90c3cc-1d76-27198-8888-8dd25736052a",
});
* ```
*/
export declare function regenerateMessageReaderWithQueryId(
/** @hidden */
this: TrieveSDK, data: RegenerateMessageReqPayload, signal?: AbortSignal): Promise<{
reader: ReadableStreamDefaultReader<Uint8Array>;
queryId: string | null;
}>;
/**
* Get all messages for a given topic. If the topic is a RAG topic then the response will include Chunks first on each message. The structure will look like [chunks]||mesage. See docs.trieve.ai for more information.

@@ -115,0 +149,0 @@ *

@@ -6,3 +6,3 @@ /**

*/
import { CreateTopicReqPayload, DeleteTopicData2, GetAllTopicsForOwnerIdData, UpdateTopicReqPayload } from "../../fetch-client";
import { CreateTopicReqPayload, DeleteTopicData2, GetAllTopicsForOwnerIdData, UpdateTopicReqPayload, CloneTopicReqPayload } from "../../fetch-client";
import { TrieveSDK } from "../../sdk";

@@ -25,2 +25,17 @@ /**

/**
* Clone a chat topic and all its messages to a new topic. Topics are attached to a owner_id’s and act as a coordinator for conversation message history of gen-AI chat sessions. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization.
*
* Example:
* ```js
*const data = await trieve.cloneTopic({
first_user_message: "hello",
name: "Test",
owner_id: "3c90c3cc-1d76-27198-8888-8dd25736052a",
});
* ```
*/
export declare function cloneTopic(
/** @hidden */
this: TrieveSDK, data: CloneTopicReqPayload, signal?: AbortSignal): Promise<import("../../types.gen").Topic>;
/**
* Update an existing chat topic. Currently, only the name of the topic can be updated. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization.

@@ -27,0 +42,0 @@ *

@@ -102,2 +102,4 @@ var __defProp = Object.defineProperty;

ragOnChunk: () => ragOnChunk,
ragOnChunkReader: () => ragOnChunkReader,
ragOnChunkReaderWithQueryId: () => ragOnChunkReaderWithQueryId,
scroll: () => scroll,

@@ -166,2 +168,40 @@ search: () => search,

}
async function ragOnChunkReader(props, signal) {
const response = await fetch(this.trieve.baseUrl + "/api/chunk/generate", {
method: "post",
headers: {
"Content-Type": "application/json",
"TR-Dataset": this.datasetId,
Authorization: `Bearer ${this.trieve.apiKey}`
},
body: JSON.stringify(props),
signal
});
const reader = response.body?.getReader();
if (!reader) {
throw new Error("Failed to get reader from response body");
}
return reader;
}
async function ragOnChunkReaderWithQueryId(props, signal) {
const response = await fetch(this.trieve.baseUrl + "/api/chunk/generate", {
method: "post",
headers: {
"Content-Type": "application/json",
"TR-Dataset": this.datasetId,
Authorization: `Bearer ${this.trieve.apiKey}`
},
body: JSON.stringify(props),
signal
});
const reader = response.body?.getReader();
if (!reader) {
throw new Error("Failed to get reader from response body");
}
const queryId = response.headers.get("TR-QueryID");
return {
reader,
queryId
};
}
async function suggestedQueries(props, signal) {

@@ -616,3 +656,3 @@ return this.trieve.fetch(

return await this.trieve.fetch(
"/api/analytics/events",
"/api/analytics/events/all",
"post",

@@ -629,2 +669,3 @@ {

__export(topic_exports, {
cloneTopic: () => cloneTopic,
createTopic: () => createTopic,

@@ -646,2 +687,13 @@ deleteTopic: () => deleteTopic,

}
async function cloneTopic(data, signal) {
return await this.trieve.fetch(
"/api/topic/clone",
"post",
{
data,
datasetId: this.datasetId
},
signal
);
}
async function updateTopic(data, signal) {

@@ -689,5 +741,7 @@ return await this.trieve.fetch(

editMessageReader: () => editMessageReader,
editMessageReaderWithQueryId: () => editMessageReaderWithQueryId,
getAllMessagesForTopic: () => getAllMessagesForTopic,
regenerateMessage: () => regenerateMessage,
regenerateMessageReader: () => regenerateMessageReader
regenerateMessageReader: () => regenerateMessageReader,
regenerateMessageReaderWithQueryId: () => regenerateMessageReaderWithQueryId
});

@@ -771,2 +825,23 @@ async function createMessage(data, signal) {

}
async function editMessageReaderWithQueryId(data, signal) {
const response = await fetch(this.trieve.baseUrl + "/api/message", {
method: "put",
headers: {
"Content-Type": "application/json",
"TR-Dataset": this.datasetId,
Authorization: `Bearer ${this.trieve.apiKey}`
},
body: JSON.stringify(data),
signal
});
const reader = response.body?.getReader();
if (!reader) {
throw new Error("Failed to get reader from response body");
}
const queryId = response.headers.get("TR-QueryID");
return {
reader,
queryId
};
}
async function regenerateMessage(data, signal) {

@@ -800,2 +875,23 @@ return await this.trieve.fetch(

}
async function regenerateMessageReaderWithQueryId(data, signal) {
const response = await fetch(this.trieve.baseUrl + "/api/message", {
method: "delete",
headers: {
"Content-Type": "application/json",
"TR-Dataset": this.datasetId,
Authorization: `Bearer ${this.trieve.apiKey}`
},
body: JSON.stringify(data),
signal
});
const reader = response.body?.getReader();
if (!reader) {
throw new Error("Failed to get reader from response body");
}
const queryId = response.headers.get("TR-QueryID");
return {
reader,
queryId
};
}
async function getAllMessagesForTopic(data, signal) {

@@ -873,3 +969,3 @@ return await this.trieve.fetch(

return await this.trieve.fetch(
"/api/events",
"/api/dataset/events",
"post",

@@ -876,0 +972,0 @@ {

@@ -9,3 +9,3 @@ {

],
"version": "0.0.12",
"version": "0.0.13",
"license": "MIT",

@@ -12,0 +12,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc