Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@markprompt/core

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markprompt/core - npm Package Compare versions

Comparing version 0.33.0 to 0.35.0

dist/chat/index.d.ts

7

dist/feedback.d.ts

@@ -1,3 +0,5 @@

import type { PromptFeedback, BaseOptions } from './types.js';
export type CSAT = 0 | 1 | 2 | 3 | 4 | 5;
import type { BaseOptions } from './types.js';
export interface PromptFeedback {
vote: '1' | '-1';
}
export interface SubmitFeedbackBody {

@@ -18,2 +20,3 @@ /** Prompt feedback */

export declare function submitFeedback(body: SubmitFeedbackBody, projectKey: string, options?: SubmitFeedbackOptions & BaseOptions): Promise<void>;
export type CSAT = 0 | 1 | 2 | 3 | 4 | 5;
export interface SubmitCSATBody {

@@ -20,0 +23,0 @@ /** Thread id */

import defaults from 'defaults';
import { DEFAULT_OPTIONS } from './index.js';
import { DEFAULT_OPTIONS } from './constants.js';
const allowedOptionKeys = ['signal', 'apiUrl'];

@@ -4,0 +4,0 @@ export const DEFAULT_SUBMIT_FEEDBACK_OPTIONS = {};

import type { SearchOptions } from '@algolia/client-search';
import type { AlgoliaDocSearchResultsResponse, BaseOptions, SearchResultsResponse } from './types.js';
import { DocSearchHit } from './docsearch.js';
import type { BaseOptions, FileReferenceFileData, FileSectionReferenceSectionData } from './types.js';
export interface SubmitSearchQueryOptions {

@@ -39,2 +40,24 @@ /**

}
export interface SearchResultSection extends FileSectionReferenceSectionData {
content?: string;
snippet?: string;
}
export interface SearchResult extends SearchResultSection {
/**
* Reference file.
*/
file: FileReferenceFileData;
/**
* Match type.
*/
matchType: 'title' | 'leadHeading' | 'content';
}
export interface SearchResultsResponse {
debug?: unknown;
data: SearchResult[];
}
export type AlgoliaDocSearchHit = DocSearchHit;
export interface AlgoliaDocSearchResultsResponse {
hits: AlgoliaDocSearchHit[];
}
export declare const DEFAULT_SUBMIT_SEARCH_QUERY_OPTIONS: SubmitSearchQueryOptions;

@@ -41,0 +64,0 @@ /**

import defaults from 'defaults';
import { DEFAULT_OPTIONS } from './index.js';
import { DEFAULT_OPTIONS } from './constants.js';
import { getErrorMessage, isAbortError } from './utils.js';

@@ -4,0 +4,0 @@ export const DEFAULT_SUBMIT_SEARCH_QUERY_OPTIONS = {

@@ -1,12 +0,1 @@

import type { DocSearchHit } from './docsearch.js';
export type { Chat, ChatCompletion, ChatCompletionAssistantMessageParam, ChatCompletionChunk, ChatCompletionFunctionMessageParam, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionSystemMessageParam, ChatCompletionTool, ChatCompletionToolChoiceOption, ChatCompletionToolMessageParam, ChatCompletionUserMessageParam, } from 'openai/resources/chat/index.js';
export type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
type ArrayToUnion<T> = T extends (infer U)[] ? U : T extends readonly (infer U)[] ? U : never;
export declare const CHAT_COMPLETIONS_MODELS: readonly ["claude-3-5-sonnet-20240620", "gpt-3.5-turbo", "gpt-4-1106-preview", "gpt-4-32k", "gpt-4-turbo-preview", "gpt-4", "gpt-4o", "meta-llama-3-70b-instruct", "meta-llama-3-8b-instruct", "mixtral-8x7b-instruct-v0.1"];
export type ChatCompletionsModel = ArrayToUnion<typeof CHAT_COMPLETIONS_MODELS>;
export declare const COMPLETIONS_MODELS: readonly ["ada", "babbage", "curie", "davinci", "text-ada-001", "text-babbage-001", "text-curie-001", "text-davinci-002", "text-davinci-003"];
export type CompletionsModel = ArrayToUnion<typeof COMPLETIONS_MODELS>;
export declare const EMBEDDINGS_MODEL: "text-embedding-ada-002";
export type EmbeddingsModel = typeof EMBEDDINGS_MODEL;
export type Model = ChatCompletionsModel | CompletionsModel | EmbeddingsModel;
export type SourceType = 'github' | 'motif' | 'website' | 'file-upload' | 'api-upload' | 'nango' | 'salesforce';

@@ -24,16 +13,2 @@ export interface Source {

}
export interface SearchResult extends SearchResultSection {
/**
* Reference file.
*/
file: FileReferenceFileData;
/**
* Match type.
*/
matchType: 'title' | 'leadHeading' | 'content';
}
export interface SearchResultSection extends FileSectionReferenceSectionData {
content?: string;
snippet?: string;
}
export interface FileSectionReference extends FileSectionReferenceSectionData {

@@ -76,27 +51,2 @@ /**

}
export interface SearchResultsResponse {
debug?: unknown;
data: SearchResult[];
}
export type AlgoliaDocSearchHit = DocSearchHit;
export interface AlgoliaDocSearchResultsResponse {
hits: AlgoliaDocSearchHit[];
}
export interface PromptFeedback {
vote: '1' | '-1';
}
export interface ChatCompletionMetadata {
threadId?: string;
messageId?: string;
references?: FileSectionReference[];
/**
* @deprecated Use `messageId` instead.
*/
promptId?: string;
}
export interface NoStreamingData {
text: string;
references?: FileSectionReference[];
responseId: string;
}
export interface BaseOptions {

@@ -103,0 +53,0 @@ apiUrl?: string;

@@ -1,25 +0,2 @@

export const CHAT_COMPLETIONS_MODELS = [
'claude-3-5-sonnet-20240620',
'gpt-3.5-turbo',
'gpt-4-1106-preview',
'gpt-4-32k',
'gpt-4-turbo-preview',
'gpt-4',
'gpt-4o',
'meta-llama-3-70b-instruct',
'meta-llama-3-8b-instruct',
'mixtral-8x7b-instruct-v0.1',
];
export const COMPLETIONS_MODELS = [
'ada',
'babbage',
'curie',
'davinci',
'text-ada-001',
'text-babbage-001',
'text-curie-001',
'text-davinci-002',
'text-davinci-003',
];
export const EMBEDDINGS_MODEL = 'text-embedding-ada-002';
export {};
//# sourceMappingURL=types.js.map

@@ -1,15 +0,8 @@

import type { ChatCompletion, ChatCompletionChunk, ChatCompletionMessage, ChatCompletionMessageToolCall, ChatCompletionMetadata, FileSectionReference, NoStreamingData } from './types.js';
export type { ChatCompletion, ChatCompletionChunk, ChatCompletionMessage, ChatCompletionMessageToolCall, } from 'openai/resources/index.mjs';
import { FileSectionReference } from './types.js';
export type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
export type ArrayToUnion<T> = T extends (infer U)[] ? U : T extends readonly (infer U)[] ? U : never;
export declare const isKeyOf: <T extends object>(obj: T, key: PropertyKey) => key is keyof T;
export declare const getErrorMessage: (res: Response) => Promise<string>;
export declare const parseEncodedJSONHeader: (response: Response, name: string) => unknown | undefined;
export declare function isAbortError(err: unknown): err is DOMException;
export declare function isFileSectionReferences(data: unknown): data is FileSectionReference[];
export declare function isMarkpromptMetadata(json: unknown): json is ChatCompletionMetadata;
export declare function isChatCompletion(json: unknown): json is ChatCompletion;
export declare const isChatCompletionMessage: (obj: unknown) => obj is ChatCompletionMessage;
export declare const isToolCall: (tool_call: unknown) => tool_call is ChatCompletionMessageToolCall;
export declare const isToolCalls: (tool_calls: unknown) => tool_calls is ChatCompletionMessageToolCall[];
export declare const isChatCompletionChunk: (json: unknown) => json is ChatCompletionChunk;
export declare const isKeyOf: <T extends object>(obj: T, key: PropertyKey) => key is keyof T;
export declare const isNoStreamingData: (data: unknown) => data is NoStreamingData;
//# sourceMappingURL=utils.d.ts.map

@@ -0,1 +1,2 @@

export const isKeyOf = (obj, key) => Object.hasOwn(obj, key);
export const getErrorMessage = async (res) => {

@@ -11,17 +12,2 @@ const text = await res.text();

};
export const parseEncodedJSONHeader = (response, name) => {
try {
const headerValue = response.headers.get(name);
if (headerValue) {
const headerArray = new Uint8Array(headerValue.split(',').map(Number));
const decoder = new TextDecoder();
const decodedValue = decoder.decode(headerArray);
return JSON.parse(decodedValue);
}
}
catch (e) {
// Do nothing
}
return undefined;
};
export function isAbortError(err) {

@@ -36,46 +22,2 @@ return ((err instanceof DOMException && err.name === 'AbortError') ||

}
export function isMarkpromptMetadata(json) {
return (typeof json === 'object' &&
json !== null &&
(('threadId' in json && typeof json.threadId === 'string') ||
('messageId' in json && typeof json.messageId === 'string') ||
('references' in json && isFileSectionReferences(json.references))));
}
export function isChatCompletion(json) {
return (typeof json === 'object' &&
json !== null &&
'object' in json &&
json.object === 'chat.completion');
}
export const isChatCompletionMessage = (obj) => {
return (typeof obj === 'object' &&
obj !== null &&
'content' in obj &&
(typeof obj.content === 'string' || obj.content === null) &&
'role' in obj &&
obj.role === 'assistant');
};
export const isToolCall = (tool_call) => {
return (typeof tool_call === 'object' &&
tool_call !== null &&
'id' in tool_call &&
typeof tool_call.id === 'string' &&
'type' in tool_call &&
tool_call.type === 'function' &&
'function' in tool_call);
};
export const isToolCalls = (tool_calls) => {
return Array.isArray(tool_calls) && tool_calls.every(isToolCall);
};
export const isChatCompletionChunk = (json) => {
return (typeof json === 'object' &&
json !== null &&
'object' in json &&
typeof json.object === 'string' &&
json.object === 'chat.completion.chunk');
};
export const isKeyOf = (obj, key) => key in obj;
export const isNoStreamingData = (data) => {
return typeof data === 'object' && data !== null && 'text' in data;
};
//# sourceMappingURL=utils.js.map
{
"name": "@markprompt/core",
"version": "0.33.0",
"version": "0.35.0",
"repository": {
"type": "git",
"url": "git+https://github.com/motifland/markprompt-js.git",
"url": "git+https://github.com/markprompt/markprompt-js.git",
"directory": "packages/core"

@@ -12,4 +12,28 @@ },

"type": "module",
"exports": "./dist/index.js",
"main": "./dist/index.js",
"exports": {
"./chat": {
"types": "./dist/chat/index.d.ts",
"import": "./dist/chat/index.js"
},
"./constants": {
"types": "./dist/constants.d.ts",
"import": "./dist/constants.js"
},
"./feedback": {
"types": "./dist/feedback.d.ts",
"import": "./dist/feedback.js"
},
"./search": {
"types": "./dist/search.d.ts",
"import": "./dist/search.js"
},
"./types": {
"types": "./dist/types.d.ts",
"import": "./dist/types.js"
},
"./utils": {
"types": "./dist/utils.d.ts",
"import": "./dist/utils.js"
}
},
"files": [

@@ -16,0 +40,0 @@ "dist"

@@ -40,3 +40,3 @@ # Markprompt Core

```js
import { submitChat } from '@markprompt/core';
import { submitChat } from '@markprompt/core/chat';

@@ -43,0 +43,0 @@ for await (const chunk of submitChat(

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 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