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.2 to 0.0.5

6

dist/fetch-client.d.ts

@@ -36,5 +36,5 @@ import type { $OpenApiTs } from "./types.gen";

export declare class TrieveFetchClient {
private apiKey?;
private baseUrl;
private debug;
apiKey?: string;
baseUrl: string;
debug: boolean;
constructor(opts: TrieveOpts);

@@ -41,0 +41,0 @@ fetch<EJECT extends EjectOption = false, URQ = EJECT extends "eject" ? EjectedRequestBase<any> : never, URE = EJECT extends "eject" ? unknown : never, P extends Paths = Paths, M extends EJECT extends false ? MethodsForPath<P> & HttpMethod : any = MethodsForPath<P> & HttpMethod>(path: P, method: EJECT extends false ? M : HttpMethod, params?: EJECT extends false ? RequestParams<P, M> : URQ, signal?: AbortSignal): Promise<EJECT extends false ? ResponseBody<P, M> : URE>;

@@ -8,2 +8,3 @@ declare const _default: {

createMessage(this: import("..").TrieveSDK, data: import("..").CreateMessageReqPayload, signal?: AbortSignal): Promise<string>;
createMessageReader(this: import("..").TrieveSDK, data: import("..").CreateMessageReqPayload, signal?: AbortSignal): Promise<ReadableStreamDefaultReader<Uint8Array>>;
editMessage(this: import("..").TrieveSDK, data: import("..").EditMessageReqPayload, signal?: AbortSignal): Promise<unknown>;

@@ -10,0 +11,0 @@ regenerateMessage(this: import("..").TrieveSDK, data: import("..").RegenerateMessageReqPayload, signal?: AbortSignal): Promise<string>;

@@ -23,2 +23,16 @@ /**

/**
* Create a message. Messages are attached to topics in order to coordinate memory 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 reader = await trieve.createMessageReader({
topic_id: "3c90c3cc-1d76-27198-8888-8dd25736052a",
new_message_content: "a new message"
});
* ```
*/
export declare function createMessageReader(
/** @hidden */
this: TrieveSDK, data: CreateMessageReqPayload, signal?: AbortSignal): Promise<ReadableStreamDefaultReader<Uint8Array>>;
/**
* Edit message which exists within the topic’s chat history. 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.

@@ -25,0 +39,0 @@ *

@@ -632,2 +632,3 @@ var __defProp = Object.defineProperty;

createMessage: () => createMessage,
createMessageReader: () => createMessageReader,
editMessage: () => editMessage,

@@ -648,2 +649,19 @@ getAllMessagesForTopic: () => getAllMessagesForTopic,

}
async function createMessageReader(data, signal) {
const response = await fetch(this.trieve.baseUrl + "/api/message", {
method: "post",
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");
}
return reader;
}
async function editMessage(data, signal) {

@@ -650,0 +668,0 @@ return await this.trieve.fetch(

@@ -9,7 +9,7 @@ {

],
"version": "0.0.2",
"version": "0.0.5",
"license": "MIT",
"scripts": {
"lint": "eslint 'src/**/*.ts'",
"build:clean": "rm tsconfig.tsbuildinfo && rm -rf dist && yarn type:gen && yarn build",
"build:clean": "rm -f tsconfig.tsbuildinfo && rm -rf dist && yarn type:gen && yarn build",
"build": "yarn build:src && yarn type:dts",

@@ -23,3 +23,3 @@ "build:src": "node ./scripts/build.js",

"devDependencies": {
"@hey-api/openapi-ts": "^0.52.9",
"@hey-api/openapi-ts": "^0.53",
"@vitest/ui": "^2.0.5",

@@ -26,0 +26,0 @@ "esbuild": "^0.23.1",

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