Socket
Socket
Sign inDemoInstall

@axflow/models

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axflow/models - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

5

dist/anthropic/completion.d.ts

@@ -18,2 +18,3 @@ declare namespace AnthropicCompletionTypes {

headers?: Record<string, string>;
signal?: AbortSignal;
};

@@ -61,2 +62,3 @@ type Completion = {

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns Anthropic completion. See Anthropic's documentation for /v1/complete.

@@ -78,2 +80,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of bytes directly from the API.

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

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of objects representing each chunk from the API.

@@ -112,2 +116,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of tokens from the API.

@@ -114,0 +119,0 @@ */

6

dist/anthropic/completion.js

@@ -45,3 +45,4 @@ "use strict";

body: JSON.stringify({ ...request, stream: false }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -55,3 +56,4 @@ return response.json();

body: JSON.stringify({ ...request, stream: true }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -58,0 +60,0 @@ if (!response.body) {

@@ -6,2 +6,3 @@ type SharedRequestOptions = {

headers?: Record<string, string>;
signal?: AbortSignal;
};

@@ -41,2 +42,3 @@

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns An object consisting of the text embeddings and other metadata. See Cohere's documentation for /v1/embed.

@@ -43,0 +45,0 @@ */

@@ -48,3 +48,4 @@ "use strict";

body: JSON.stringify(request),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -51,0 +52,0 @@ return response.json();

@@ -6,2 +6,3 @@ type SharedRequestOptions = {

headers?: Record<string, string>;
signal?: AbortSignal;
};

@@ -73,2 +74,3 @@

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns Cohere completion. See Cohere's documentation for /v1/generate.

@@ -88,2 +90,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of bytes directly from the API.

@@ -103,2 +106,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of objects representing each chunk from the API.

@@ -118,2 +122,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of tokens from the API.

@@ -120,0 +125,0 @@ */

@@ -48,3 +48,4 @@ "use strict";

body: JSON.stringify({ ...request, stream: false }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -58,3 +59,4 @@ return response.json();

body: JSON.stringify({ ...request, stream: true }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -61,0 +63,0 @@ if (!response.body) {

@@ -22,6 +22,7 @@ declare namespace HuggingFaceTextGenerationTypes {

type RequestOptions = {
accessToken?: string;
apiKey?: string;
apiUrl?: string;
fetch?: typeof fetch;
headers?: Record<string, string>;
signal?: AbortSignal;
};

@@ -54,6 +55,7 @@ type GeneratedText = {

* @param options
* @param options.accessToken The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiKey The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiUrl The HuggingFace API URL. Defaults to https://api-inference.huggingface.co/models/
* @param options.fetch The fetch implementation to use. Defaults to globalThis.fetch
* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns The response body from HF. See their documentation linked above for details

@@ -69,6 +71,7 @@ */

* @param options
* @param options.accessToken The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiKey The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiUrl The HuggingFace API URL. Defaults to https://api-inference.huggingface.co/models/
* @param options.fetch The fetch implementation to use. Defaults to globalThis.fetch
* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of bytes directly from the API.

@@ -90,6 +93,7 @@ */

* @param options
* @param options.accessToken The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiKey The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiUrl The HuggingFace API URL. Defaults to https://api-inference.huggingface.co/models/
* @param options.fetch The fetch implementation to use. Defaults to globalThis.fetch
* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of objects representing each chunk from the API

@@ -106,6 +110,7 @@ */

* @param options
* @param options.accessToken The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiKey The HuggingFace access token. If not provided, requests will be throttled
* @param options.apiUrl The HuggingFace API URL. Defaults to https://api-inference.huggingface.co/models/
* @param options.fetch The fetch implementation to use. Defaults to globalThis.fetch
* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of tokens from the API.

@@ -112,0 +117,0 @@ */

@@ -29,3 +29,3 @@ "use strict";

var HUGGING_FACE_STOP_TOKEN = "</s>";
function headers(accessToken, customHeaders) {
function headers(apiKey, customHeaders) {
const headers2 = {

@@ -36,4 +36,4 @@ accept: "application/json",

};
if (typeof accessToken === "string") {
headers2.authorization = `Bearer ${accessToken}`;
if (typeof apiKey === "string") {
headers2.authorization = `Bearer ${apiKey}`;
}

@@ -44,3 +44,3 @@ return headers2;

const url = options.apiUrl || HUGGING_FACE_MODEL_API_URL + request.model;
const headers_ = headers(options.accessToken, options.headers);
const headers_ = headers(options.apiKey, options.headers);
const body = JSON.stringify({ ...request, stream: false });

@@ -50,3 +50,4 @@ const response = await (0, import_shared.POST)(url, {

body,
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -57,3 +58,3 @@ return response.json();

const url = options.apiUrl || HUGGING_FACE_MODEL_API_URL + request.model;
const headers_ = headers(options.accessToken, options.headers);
const headers_ = headers(options.apiKey, options.headers);
const body = JSON.stringify({ ...request, stream: true });

@@ -64,3 +65,4 @@ try {

body,
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -67,0 +69,0 @@ if (!response.body) {

@@ -6,2 +6,3 @@ type SharedRequestOptions = {

headers?: Record<string, string>;
signal?: AbortSignal;
};

@@ -88,2 +89,3 @@

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns OpenAI chat completion. See OpenAI's documentation for /v1/chat/completions.

@@ -103,2 +105,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of bytes directly from the API.

@@ -118,2 +121,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of objects representing each chunk from the API.

@@ -133,2 +137,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of tokens from the API.

@@ -135,0 +140,0 @@ */

@@ -85,3 +85,4 @@ "use strict";

body: JSON.stringify({ ...request, stream: false }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -95,3 +96,4 @@ return response.json();

body: JSON.stringify({ ...request, stream: true }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -98,0 +100,0 @@ if (!response.body) {

@@ -6,2 +6,3 @@ type SharedRequestOptions = {

headers?: Record<string, string>;
signal?: AbortSignal;
};

@@ -70,2 +71,3 @@

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns OpenAI completion. See OpenAI's documentation for /v1/completions.

@@ -85,2 +87,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of bytes directly from the API.

@@ -100,2 +103,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of objects representing each chunk from the API.

@@ -115,2 +119,3 @@ */

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns A stream of tokens from the API.

@@ -117,0 +122,0 @@ */

@@ -85,3 +85,4 @@ "use strict";

body: JSON.stringify({ ...request, stream: false }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -95,3 +96,4 @@ return response.json();

body: JSON.stringify({ ...request, stream: true }),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -98,0 +100,0 @@ if (!response.body) {

@@ -6,2 +6,3 @@ type SharedRequestOptions = {

headers?: Record<string, string>;
signal?: AbortSignal;
};

@@ -42,2 +43,3 @@

* @param options.headers Optionally add additional HTTP headers to the request.
* @param options.signal An AbortSignal that can be used to abort the fetch request.
* @returns An object consisting of the text embeddings and other metadata. See OpenAI's documentation for /v1/embeddings.

@@ -44,0 +46,0 @@ */

@@ -48,3 +48,4 @@ "use strict";

body: JSON.stringify(request),
fetch: options.fetch
fetch: options.fetch,
signal: options.signal
});

@@ -51,0 +52,0 @@ return response.json();

{
"name": "@axflow/models",
"version": "0.0.8",
"version": "0.0.9",
"description": "Zero-dependency, modular SDK for building robust natural language applications",

@@ -170,3 +170,3 @@ "author": "Axflow (https://axflow.dev)",

},
"gitHead": "fb9d324b6ddabe6a3bca15ab5f20030486633243"
"gitHead": "9983d39fd9f24d86032ae7c0a8767cd41a519e84"
}

@@ -23,6 +23,7 @@ # @axflow/models

- ✅ Anthropic and Anthropic-compatible Completion models
- ✅ HuggingFace text generation inference API and Inference Endpoints
- HuggingFace (coming soon)
- Google PaLM models (coming soon)
- Azure OpenAI (coming soon)
- Replicate (coming soon)
- HuggingFace (coming soon)

@@ -39,2 +40,3 @@ ## Documentation

- [@axflow/models/cohere/embedding](https://docs.axflow.dev/documentation/models/cohere-embedding.html)
- [@axflow/models/huggingface/text-generation](https://docs.axflow.dev/documentation/models/huggingface-text-generation.html)
- [@axflow/models/react](https://docs.axflow.dev/documentation/models/react.html)

@@ -41,0 +43,0 @@ - [@axflow/models/node](https://docs.axflow.dev/documentation/models/node.html)

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

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