polyfire-js
Advanced tools
Comparing version 0.2.27 to 0.2.28
@@ -145,3 +145,3 @@ "use strict"; | ||
if (typeof window === "undefined") { | ||
throw new Error("signInWithOAuth not usable outside of the browser environment"); | ||
throw new error_1.PolyfireError("signInWithOAuth not usable outside of the browser environment"); | ||
} | ||
@@ -273,3 +273,3 @@ var url = "".concat(endpoint, "/project/").concat(project, "/auth/provider/redirect?provider=").concat(provider, "&redirect_to=").concat(encodeURIComponent("".concat(window === null || window === void 0 ? void 0 : window.location))); | ||
clearSessionStorage(); | ||
co.throw(new Error("You need to be authenticated to use this function")); | ||
co.throw(new error_1.PolyfireError("You need to be authenticated to use this function")); | ||
return [2 /*return*/]; | ||
@@ -288,3 +288,3 @@ } | ||
if (typeof window === "undefined") { | ||
co.throw(new Error("You need to be authenticated to use this function")); | ||
co.throw(new error_1.PolyfireError("You need to be authenticated to use this function")); | ||
return [2 /*return*/, false]; | ||
@@ -311,3 +311,3 @@ } | ||
e_3 = _a.sent(); | ||
co.throw(new Error("You need to be authenticated to use this function")); | ||
co.throw(new error_1.PolyfireError("You need to be authenticated to use this function")); | ||
return [2 /*return*/, false]; | ||
@@ -314,0 +314,0 @@ case 5: return [2 /*return*/]; |
@@ -302,3 +302,3 @@ "use strict"; | ||
if (limit < 0 || limit % 1 !== 0 || offset < 0 || offset % 1 !== 0) { | ||
throw new Error("limit and offset must be positive integers"); | ||
throw new error_1.PolyfireError("limit and offset must be positive integers"); | ||
} | ||
@@ -305,0 +305,0 @@ url.searchParams.append("orderBy", orderBy); |
@@ -52,2 +52,3 @@ "use strict"; | ||
var utils_1 = require("./utils"); | ||
var error_1 = require("./helpers/error"); | ||
function defaultOptions(popts) { | ||
@@ -62,3 +63,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
if (!opts.token && !utils_1.POLYFACT_TOKEN) { | ||
throw new Error("Please put your polyfire token in the POLYFACT_TOKEN environment variable. You can get one at https://app.polyfire.com"); | ||
throw new error_1.PolyfireError("Missing polyfire token"); | ||
} | ||
@@ -65,0 +66,0 @@ return [2 /*return*/, __assign({ endpoint: utils_1.POLYFACT_ENDPOINT || "https://api.polyfire.com", token: utils_1.POLYFACT_TOKEN || "" }, opts)]; |
@@ -6,2 +6,3 @@ import { TextGenerated, TextGeneratedProps } from "./TextGenerated"; | ||
import { ImageGenerated, ImageGeneratedProps } from "./ImageGenerated"; | ||
export { TextGenerated, TextGeneratedProps, TextSummary, TextSummaryProps, AutoCompleteInput, ImageGenerated, ImageGeneratedProps, TextTranslated, TextTranslatedProps, }; | ||
import { Login, LoginProps } from "./Login"; | ||
export { TextGenerated, TextGeneratedProps, TextSummary, TextSummaryProps, AutoCompleteInput, ImageGenerated, ImageGeneratedProps, TextTranslated, TextTranslatedProps, Login, LoginProps, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TextTranslated = exports.ImageGenerated = exports.AutoCompleteInput = exports.TextSummary = exports.TextGenerated = void 0; | ||
exports.Login = exports.TextTranslated = exports.ImageGenerated = exports.AutoCompleteInput = exports.TextSummary = exports.TextGenerated = void 0; | ||
var TextGenerated_1 = require("./TextGenerated"); | ||
@@ -14,1 +14,3 @@ Object.defineProperty(exports, "TextGenerated", { enumerable: true, get: function () { return TextGenerated_1.TextGenerated; } }); | ||
Object.defineProperty(exports, "ImageGenerated", { enumerable: true, get: function () { return ImageGenerated_1.ImageGenerated; } }); | ||
var Login_1 = require("./Login"); | ||
Object.defineProperty(exports, "Login", { enumerable: true, get: function () { return Login_1.Login; } }); |
@@ -52,6 +52,6 @@ "use strict"; | ||
function TextGenerated(_a) { | ||
var prompt = _a.prompt, stream = _a.stream, loadingElement = _a.loadingElement, props = __rest(_a, ["prompt", "stream", "loadingElement"]); | ||
var _b = (0, hooks_1.usePolyfire)(), status = _b.auth.status, generate = _b.models.generate; | ||
var _c = (0, react_1.useState)(), text = _c[0], setText = _c[1]; | ||
var _d = (0, react_1.useState)(), currentStream = _d[0], setCurrentStream = _d[1]; | ||
var prompt = _a.prompt, stream = _a.stream, _b = _a.loadingElement, loadingElement = _b === void 0 ? "loading..." : _b, props = __rest(_a, ["prompt", "stream", "loadingElement"]); | ||
var _c = (0, hooks_1.usePolyfire)(), status = _c.auth.status, generate = _c.models.generate; | ||
var _d = (0, react_1.useState)(), text = _d[0], setText = _d[1]; | ||
var _e = (0, react_1.useState)(), currentStream = _e[0], setCurrentStream = _e[1]; | ||
(0, react_1.useEffect)(function () { | ||
@@ -65,3 +65,3 @@ // In case the stream or generate props changed, or the user logged out | ||
if (status === "authenticated" && prompt) { | ||
var newGeneration = generate(prompt); | ||
var newGeneration = generate(prompt, { temperature: 0 }); | ||
setCurrentStream(newGeneration); | ||
@@ -68,0 +68,0 @@ if (stream) { |
@@ -52,6 +52,6 @@ "use strict"; | ||
function TextSummary(_a) { | ||
var prompt = _a.prompt, stream = _a.stream, loadingElement = _a.loadingElement, props = __rest(_a, ["prompt", "stream", "loadingElement"]); | ||
var _b = (0, hooks_1.usePolyfire)(), status = _b.auth.status, generate = _b.models.generate; | ||
var _c = (0, react_1.useState)(), text = _c[0], setText = _c[1]; | ||
var _d = (0, react_1.useState)(), currentStream = _d[0], setCurrentStream = _d[1]; | ||
var prompt = _a.prompt, stream = _a.stream, _b = _a.loadingElement, loadingElement = _b === void 0 ? "loading..." : _b, props = __rest(_a, ["prompt", "stream", "loadingElement"]); | ||
var _c = (0, hooks_1.usePolyfire)(), status = _c.auth.status, generate = _c.models.generate; | ||
var _d = (0, react_1.useState)(), text = _d[0], setText = _d[1]; | ||
var _e = (0, react_1.useState)(), currentStream = _e[0], setCurrentStream = _e[1]; | ||
(0, react_1.useEffect)(function () { | ||
@@ -67,2 +67,3 @@ // In case the stream or generate props changed, or the user logged out | ||
systemPrompt: "Summarize what the text the user provided", | ||
temperature: 0, | ||
}); | ||
@@ -69,0 +70,0 @@ setCurrentStream(newGeneration); |
@@ -52,5 +52,5 @@ "use strict"; | ||
function TextTranslated(_a) { | ||
var text = _a.text, language = _a.language, loadingElement = _a.loadingElement, props = __rest(_a, ["text", "language", "loadingElement"]); | ||
var _b = (0, hooks_1.usePolyfire)(), status = _b.auth.status, generate = _b.models.generate; | ||
var _c = (0, react_1.useState)(), translation = _c[0], setTranslation = _c[1]; | ||
var text = _a.text, language = _a.language, _b = _a.loadingElement, loadingElement = _b === void 0 ? "loading..." : _b, props = __rest(_a, ["text", "language", "loadingElement"]); | ||
var _c = (0, hooks_1.usePolyfire)(), status = _c.auth.status, generate = _c.models.generate; | ||
var _d = (0, react_1.useState)(), translation = _d[0], setTranslation = _d[1]; | ||
(0, react_1.useEffect)(function () { | ||
@@ -61,2 +61,3 @@ setTranslation(undefined); | ||
systemPrompt: "Translate the text the user provided to this language: \"".concat(language, "\". Just say the translated text. Do not write anything else, do not write any explanation. Only write in the target language (").concat(language, ")"), | ||
temperature: 0, | ||
}).then(setTranslation); | ||
@@ -63,0 +64,0 @@ } |
@@ -293,2 +293,3 @@ "use strict"; | ||
ws.onmessage = function (data) { return onMessage(data, resultStream); }; | ||
ws.onclose = function () { return resultStream.push(null); }; | ||
resultStream.stop = function () { | ||
@@ -295,0 +296,0 @@ ws.send("STOP"); |
@@ -5,3 +5,6 @@ export interface ErrorData { | ||
} | ||
export declare class ApiError extends Error { | ||
export declare class PolyfireError extends Error { | ||
constructor(message: string); | ||
} | ||
export declare class ApiError extends PolyfireError { | ||
errorType?: string; | ||
@@ -8,0 +11,0 @@ errorMessage?: string; |
@@ -18,7 +18,15 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ApiError = void 0; | ||
exports.ApiError = exports.PolyfireError = void 0; | ||
var PolyfireError = /** @class */ (function (_super) { | ||
__extends(PolyfireError, _super); | ||
function PolyfireError(message) { | ||
return _super.call(this, "polyfire-js: ".concat(message)) || this; | ||
} | ||
return PolyfireError; | ||
}(Error)); | ||
exports.PolyfireError = PolyfireError; | ||
var ApiError = /** @class */ (function (_super) { | ||
__extends(ApiError, _super); | ||
function ApiError(errorData) { | ||
var _this = _super.call(this, errorData === null || errorData === void 0 ? void 0 : errorData.message) || this; | ||
var _this = _super.call(this, "ApiError: ".concat(errorData === null || errorData === void 0 ? void 0 : errorData.message)) || this; | ||
_this.errorType = (errorData === null || errorData === void 0 ? void 0 : errorData.code) || "unknown_error"; | ||
@@ -29,3 +37,3 @@ _this.errorMessage = (errorData === null || errorData === void 0 ? void 0 : errorData.message) || "An unknown error occured"; | ||
return ApiError; | ||
}(Error)); | ||
}(PolyfireError)); | ||
exports.ApiError = ApiError; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getEmbeddingSize = exports.getModelSize = exports.models = void 0; | ||
var error_1 = require("./error"); | ||
exports.models = { | ||
@@ -22,3 +23,3 @@ "gpt-3.5-turbo-16k": { resolvedName: "gpt-3.5-turbo-16k", contextSize: 16384 }, | ||
} | ||
throw new Error("Unknown model name: ".concat(modelName)); | ||
throw new error_1.PolyfireError("Unknown model name: ".concat(modelName)); | ||
}; | ||
@@ -25,0 +26,0 @@ exports.getModelSize = getModelSize; |
@@ -45,2 +45,3 @@ "use strict"; | ||
var __1 = require(".."); | ||
var error_1 = require("../helpers/error"); | ||
var ActionAgent = __1.t.type({ | ||
@@ -115,7 +116,7 @@ thought: __1.t.string.description("Provide your reasoning or thought process about the action you plan to undertake from ACTION_LIST to address the user's question and from the last Observation. For example: 'To find out the capital of France, I should search for it.'"), | ||
if (!ActionAgent.is(result)) { | ||
throw new Error("Expected ActionAgent"); | ||
throw new error_1.PolyfireError("Expected ActionAgent"); | ||
} | ||
progress("Thought", result === null || result === void 0 ? void 0 : result.thought); | ||
if (!(result === null || result === void 0 ? void 0 : result.action.type)) { | ||
throw new Error("Expected action"); | ||
throw new error_1.PolyfireError("Expected action"); | ||
} | ||
@@ -122,0 +123,0 @@ if (result.action.type === "Finish" || loop === 4 || !isRunning) { |
@@ -65,2 +65,3 @@ "use strict"; | ||
var uuid_1 = require("../helpers/uuid"); | ||
var error_1 = require("../helpers/error"); | ||
var usePolyfire_1 = __importDefault(require("./usePolyfire")); | ||
@@ -271,3 +272,3 @@ var getChatList = function (getToken) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onSendMessage = (0, react_1.useCallback)(function (message) { return __awaiter(_this, void 0, void 0, function () { | ||
var newChatInstance, userMessage_1, aiMessage_1, stream_1, error_1; | ||
var newChatInstance, userMessage_1, aiMessage_1, stream_1, error_2; | ||
var _a, _b; | ||
@@ -291,3 +292,3 @@ var _this = this; | ||
if (!newChatInstance) { | ||
throw new Error("sendMessage: You need to be authenticated to use this function"); | ||
throw new error_1.PolyfireError("sendMessage: You need to be authenticated to use this function"); | ||
} | ||
@@ -342,6 +343,6 @@ _a = { | ||
case 5: | ||
error_1 = _c.sent(); | ||
if (error_1 instanceof Error) { | ||
setAnswerError(error_1.message); | ||
onError === null || onError === void 0 ? void 0 : onError(error_1.message); | ||
error_2 = _c.sent(); | ||
if (error_2 instanceof Error) { | ||
setAnswerError(error_2.message); | ||
onError === null || onError === void 0 ? void 0 : onError(error_2.message); | ||
} | ||
@@ -348,0 +349,0 @@ return [3 /*break*/, 6]; |
@@ -80,2 +80,3 @@ "use strict"; | ||
var client_1 = __importDefault(require("../client")); | ||
var error_1 = require("../helpers/error"); | ||
var PolyfireContext = (0, react_1.createContext)(null); | ||
@@ -102,3 +103,3 @@ function PolyfireProvider(_a) { | ||
if (!polyfire) { | ||
throw new Error("PolyfireProvider not found, did you forget to wrap your app in <PolyfireProvider>...</PolyfireProvider>?"); | ||
throw new error_1.PolyfireError("PolyfireProvider not found, did you forget to wrap your app in <PolyfireProvider>...</PolyfireProvider>?"); | ||
} | ||
@@ -105,0 +106,0 @@ var client = polyfire.client, status = polyfire.status, setStatus = polyfire.setStatus; |
@@ -7,3 +7,2 @@ import * as t from "polyfact-io-ts"; | ||
import { Embeddings, createEmbeddings, updateEmbeddings, getAllEmbeddings } from "./embeddings"; | ||
import { splitString, tokenCount } from "./split"; | ||
import { usage } from "./user"; | ||
@@ -27,3 +26,3 @@ import { get as KVGet, set as KVSet, del as KVDel, all as KVAll } from "./kv"; | ||
export declare const Memory: typeof Embeddings; | ||
export { generate, generateWithType, GenerationOptions, Chat, transcribe, Embeddings, createEmbeddings, updateEmbeddings, getAllEmbeddings, usage, splitString, tokenCount, t, kv, generateImage, TextFileLoader, StringLoader, AudioLoader, }; | ||
export { generate, generateWithType, GenerationOptions, Chat, transcribe, Embeddings, createEmbeddings, updateEmbeddings, getAllEmbeddings, usage, t, kv, generateImage, TextFileLoader, StringLoader, AudioLoader, }; | ||
export default PolyfireClientBuilder; |
@@ -32,3 +32,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AudioLoader = exports.StringLoader = exports.TextFileLoader = exports.generateImage = exports.kv = exports.t = exports.tokenCount = exports.splitString = exports.usage = exports.getAllEmbeddings = exports.updateEmbeddings = exports.createEmbeddings = exports.Embeddings = exports.transcribe = exports.Chat = exports.generateWithType = exports.generate = exports.Memory = exports.getAllMemories = exports.updateMemory = exports.createMemory = void 0; | ||
exports.AudioLoader = exports.StringLoader = exports.TextFileLoader = exports.generateImage = exports.kv = exports.t = exports.usage = exports.getAllEmbeddings = exports.updateEmbeddings = exports.createEmbeddings = exports.Embeddings = exports.transcribe = exports.Chat = exports.generateWithType = exports.generate = exports.Memory = exports.getAllMemories = exports.updateMemory = exports.createMemory = void 0; | ||
var t = __importStar(require("polyfact-io-ts")); | ||
@@ -49,5 +49,2 @@ exports.t = t; | ||
Object.defineProperty(exports, "getAllEmbeddings", { enumerable: true, get: function () { return embeddings_1.getAllEmbeddings; } }); | ||
var split_1 = require("./split"); | ||
Object.defineProperty(exports, "splitString", { enumerable: true, get: function () { return split_1.splitString; } }); | ||
Object.defineProperty(exports, "tokenCount", { enumerable: true, get: function () { return split_1.tokenCount; } }); | ||
var user_1 = require("./user"); | ||
@@ -54,0 +51,0 @@ Object.defineProperty(exports, "usage", { enumerable: true, get: function () { return user_1.usage; } }); |
{ | ||
"name": "polyfire-js", | ||
"version": "0.2.27", | ||
"version": "0.2.28", | ||
"main": "index.js", | ||
@@ -10,3 +10,2 @@ "types": "index.d.ts", | ||
"@supabase/supabase-js": "^2.31.0", | ||
"@types/lodash.debounce": "^4.0.9", | ||
"async-mutex": "^0.4.0", | ||
@@ -16,3 +15,2 @@ "axios": "^0.27.2", | ||
"fp-ts": "^2.16.0", | ||
"inquirer": "^9.2.10", | ||
"isomorphic-ws": "^5.0.0", | ||
@@ -29,5 +27,3 @@ "js-tiktoken": "^1.0.7", | ||
"devDependencies": { | ||
"@types/cli-progress": "^3.11.0", | ||
"@types/inquirer": "^9.0.3", | ||
"@types/isomorphic-fetch": "^0.0.36", | ||
"@types/lodash.debounce": "^4.0.9", | ||
"@types/node": "^20.4.5", | ||
@@ -39,4 +35,2 @@ "@types/react": "^18.2.21", | ||
"@typescript-eslint/parser": "^4.14.1", | ||
"cli-progress": "^3.12.0", | ||
"commander": "^11.0.0", | ||
"esbuild": "0.15.10", | ||
@@ -71,5 +65,5 @@ "eslint": "^7.21.0", | ||
"build:vanilla-js": "esbuild target/vanilla-js.ts --bundle --minify --target=chrome67,firefox68,edge79,safari15 --outfile=build/vanilla-js.js", | ||
"build": "tsc --target es5 --lib es2021,DOM --moduleResolution node --strict --esModuleInterop --declaration --jsx react --skipLibCheck --outDir dist --rootDir lib lib/*.ts lib/**/*.ts lib/**/*.tsx && cp package.json README.md dist/", | ||
"build": "tsc --target es5 --lib es2021,DOM --moduleResolution node --strict --esModuleInterop --declaration --jsx react --skipLibCheck --outDir dist --rootDir lib lib/*.ts lib/**/*.ts lib/**/*.tsx && cp package.json README.md dist/ && find lib/ -type f -name '*.css' -exec sh -c 'cp {} $(echo {} | sed s/^lib/dist/)' \\;", | ||
"npm-publish": "npm run build && cd dist && npm publish && cd .." | ||
} | ||
} |
@@ -41,2 +41,3 @@ "use strict"; | ||
var generate_1 = require("../generate"); | ||
var error_1 = require("../helpers/error"); | ||
// The ts.io types are way too complex for me to write, I didn't want to spend 2 days fixing this so I | ||
@@ -104,3 +105,3 @@ // decided to bypass the typechecker and throw an error at runtime if the type is not supported. | ||
} | ||
throw new Error("Unsupported type \"".concat(type._tag, "\".\nPlease use one of:\n\t- InterfaceType (t.type)\n\t- ArrayType (t.array)\n\t- NumberType (t.number)\n\t- StringType (t.string)\n\t- BooleanType (t.boolean)")); | ||
throw new error_1.PolyfireError("Unsupported type \"".concat(type._tag, "\".\nPlease use one of:\n\t- InterfaceType (t.type)\n\t- ArrayType (t.array)\n\t- NumberType (t.number)\n\t- StringType (t.string)\n\t- BooleanType (t.boolean)")); | ||
} | ||
@@ -152,3 +153,3 @@ function tsio2String(type) { | ||
return [3 /*break*/, 1]; | ||
case 4: throw new Error("Generation failed to match the given type after 5 retry"); | ||
case 4: throw new error_1.PolyfireError("Generation failed to match the given type after 5 retry"); | ||
} | ||
@@ -155,0 +156,0 @@ }); |
@@ -11,6 +11,7 @@ <h1 align="center">🔥 polyfire</h1> | ||
Why use Polyfire? | ||
* Just code from the frontend, no backend needed | ||
* If you already have backend, less code to write | ||
* Most backend services you'd need in a couple lines of code | ||
- Just code from the frontend, no backend needed | ||
- If you already have backend, less code to write | ||
- Most backend services you'd need in a couple lines of code | ||
We **manage your AI backend** so you don't have to. | ||
@@ -29,16 +30,11 @@ | ||
import { createRoot } from "react-dom/client"; | ||
import { PolyfireProvider, usePolyfire } from "polyfire-js/hooks"; | ||
import { TextGenerated, Login } from "polyfire-js/components"; | ||
function App() { | ||
const { auth: { login, status }, models: { generate } } = usePolyfire(); | ||
const [haiku, setHaiku] = useState(); | ||
useEffect(() => { | ||
if (status === "authenticated") generate("haiku").then(setHaiku); | ||
}, [status]); | ||
if (status === "unauthenticated") | ||
return <button onClick={() => login("github")}>Login with Github</button>; | ||
else if (status === "loading" || !haiku) return <h1>Loading...</h1>; | ||
return <h1>{haiku}</h1>; | ||
return ( | ||
<Login> | ||
<h2>Here's a little auto-generated haiku for you:</h2> | ||
<TextGenerated prompt="Generate a hello world haiku" /> | ||
</Login> | ||
); | ||
} | ||
@@ -48,4 +44,9 @@ | ||
const root = createRoot(document.getElementById("app")); | ||
root.render(<PolyfireProvider project="your_project_id"><App /></PolyfireProvider>); | ||
root.render( | ||
<PolyfireProvider project="your_project_id"> | ||
<App /> | ||
</PolyfireProvider>, | ||
); | ||
``` | ||
> Don't forget to change the **your_project_id** by your project ID you will have got on https://beta.polyfire.com | ||
@@ -58,15 +59,16 @@ | ||
<script> | ||
(async () => { | ||
const polyfire = window.PolyfireClientBuilder({ project: "your_project_id" }) | ||
const isAuthenticated = await polyfire.auth.init(); | ||
if (!isAuthenticated) { | ||
await polyfire.auth.login("github") | ||
} | ||
const helloWorld = await polyfire.models.generate("Write me a hello world haiku"); | ||
console.log(helloWorld); | ||
})() | ||
(async () => { | ||
const polyfire = window.PolyfireClientBuilder({ project: "your_project_id" }); | ||
const isAuthenticated = await polyfire.auth.init(); | ||
if (!isAuthenticated) { | ||
await polyfire.auth.login("github"); | ||
} | ||
const helloWorld = await polyfire.models.generate("Write me a hello world haiku"); | ||
console.log(helloWorld); | ||
})(); | ||
</script> | ||
``` | ||
> Don't forget to change the **your_project_id** by your project ID you will have got on https://beta.polyfire.com | ||
@@ -82,25 +84,25 @@ | ||
- **[How to make a clone of ChatGPT](https://docs.polyfire.com/docs/chatgpt-clone)** | ||
- **[New Project & Rate Limits](https://docs.polyfire.com/docs/new-project-rate-limit)** | ||
- **[Adding stripe subscriptions](https://docs.polyfire.com/docs/react-stripe-subscriptions)** | ||
- **[Call Polyfire from React](https://docs.polyfire.com/docs/usepolyfire)**: The usePolyfire hooks lets you use Polyfire and handle authentification without having to deploy any backend | ||
- **[Call Polyfire from other browser environments](https://docs.polyfire.com/docs/javascript)**: The Polyfire Client Object allows you to use Polyfire and handle authentification without having to deploy any backend in any environment | ||
- **[How to make a clone of ChatGPT](https://docs.polyfire.com/docs/chatgpt-clone)** | ||
- **[New Project & Rate Limits](https://docs.polyfire.com/docs/new-project-rate-limit)** | ||
- **[Adding stripe subscriptions](https://docs.polyfire.com/docs/react-stripe-subscriptions)** | ||
- **[Call Polyfire from React](https://docs.polyfire.com/docs/usepolyfire)**: The usePolyfire hooks lets you use Polyfire and handle authentification without having to deploy any backend | ||
- **[Call Polyfire from other browser environments](https://docs.polyfire.com/docs/javascript)**: The Polyfire Client Object allows you to use Polyfire and handle authentification without having to deploy any backend in any environment | ||
## 📚 Useful References | ||
- **[Generate Simple Text](https://docs.polyfire.com/reference/generate)**: Answer to simple requests as text | ||
- **[Create Chatbots](https://docs.polyfire.com/reference/chats)**: Easily create chatbots | ||
- **[Transcribe](https://docs.polyfire.com/reference/transcribe)**: Transcribe audio files to text | ||
- **[Memory](https://docs.polyfire.com/reference/embeddings)**: Easily create a long-term memory and simplify the use of large amounts of information | ||
- **[GenerateImage](https://docs.polyfire.com/reference/generate-image)**: Generate images with Dall-E | ||
- **[Generate Simple Text](https://docs.polyfire.com/reference/generate)**: Answer to simple requests as text | ||
- **[Create Chatbots](https://docs.polyfire.com/reference/chats)**: Easily create chatbots | ||
- **[Transcribe](https://docs.polyfire.com/reference/transcribe)**: Transcribe audio files to text | ||
- **[Memory](https://docs.polyfire.com/reference/embeddings)**: Easily create a long-term memory and simplify the use of large amounts of information | ||
- **[GenerateImage](https://docs.polyfire.com/reference/generate-image)**: Generate images with Dall-E | ||
## 🔗 Links | ||
* Website: [polyfire.com](https://www.polyfire.com) | ||
* Documentation: [docs.polyfire.com](https://docs.polyfire.com) | ||
* Dashboard: [beta.polyfire.com](https://beta.polyfire.com) | ||
* Discord: [polyfire.com/discord](https://www.polyfire.com/discord) | ||
* Javascript SDK: [github.com/polyfire-ai/polyfire-js](https://www.github.com/polyfire-ai/polyfire-js) | ||
* Open Source API (your managed backend!): [github.com/polyfire-ai/polyfire-api](https://github.com/polyfire-ai/polyfire-api) | ||
- Website: [polyfire.com](https://www.polyfire.com) | ||
- Documentation: [docs.polyfire.com](https://docs.polyfire.com) | ||
- Dashboard: [beta.polyfire.com](https://beta.polyfire.com) | ||
- Discord: [polyfire.com/discord](https://www.polyfire.com/discord) | ||
- Javascript SDK: [github.com/polyfire-ai/polyfire-js](https://www.github.com/polyfire-ai/polyfire-js) | ||
- Open Source API (your managed backend!): [github.com/polyfire-ai/polyfire-api](https://github.com/polyfire-ai/polyfire-api) | ||
We're open source! Make a good PR to the JS SDK or the API and we'll merge it. |
10
tts.js
@@ -87,3 +87,3 @@ "use strict"; | ||
else { | ||
throw new Error("AudioContext is not supported in this environment"); | ||
throw new error_1.PolyfireError("AudioContext is not supported in this environment"); | ||
} | ||
@@ -112,3 +112,3 @@ }); | ||
else { | ||
reject(Error("AudioContext is not supported in this environment")); | ||
reject(new error_1.PolyfireError("AudioContext is not supported in this environment")); | ||
} | ||
@@ -133,3 +133,3 @@ })]; | ||
else { | ||
reject(Error("AudioSource is not playing")); | ||
reject(new error_1.PolyfireError("AudioSource is not playing")); | ||
} | ||
@@ -147,3 +147,3 @@ })]; | ||
else { | ||
throw Error("AudioSource is not playing"); | ||
throw new error_1.PolyfireError("AudioSource is not playing"); | ||
} | ||
@@ -161,3 +161,3 @@ return [2 /*return*/]; | ||
else { | ||
throw Error("AudioSource does not exist"); | ||
throw new error_1.PolyfireError("AudioSource does not exist"); | ||
} | ||
@@ -164,0 +164,0 @@ return [2 /*return*/]; |
@@ -43,2 +43,3 @@ "use strict"; | ||
var buffer_1 = require("buffer"); | ||
var error_1 = require("./helpers/error"); | ||
var token; | ||
@@ -142,3 +143,3 @@ var endpoint; | ||
throw e_1; | ||
case 3: throw new Error("Missing function in then"); | ||
case 3: throw new error_1.PolyfireError("Missing function in then"); | ||
} | ||
@@ -145,0 +146,0 @@ }); |
266092
14
19
67
5432
104
- Removed@types/lodash.debounce@^4.0.9
- Removedinquirer@^9.2.10
- Removed@inquirer/figures@1.0.9(transitive)
- Removed@types/lodash@4.17.14(transitive)
- Removed@types/lodash.debounce@4.0.9(transitive)
- Removedansi-escapes@4.3.2(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedbl@4.1.0(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedchalk@4.1.2(transitive)
- Removedchardet@0.7.0(transitive)
- Removedcli-cursor@3.1.0(transitive)
- Removedcli-spinners@2.9.2(transitive)
- Removedcli-width@4.1.0(transitive)
- Removedclone@1.0.4(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removeddefaults@1.0.4(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedexternal-editor@3.1.0(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinherits@2.0.4(transitive)
- Removedinquirer@9.3.7(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-interactive@1.0.0(transitive)
- Removedis-unicode-supported@0.1.0(transitive)
- Removedlog-symbols@4.1.0(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedmute-stream@1.0.0(transitive)
- Removedonetime@5.1.2(transitive)
- Removedora@5.4.1(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedrestore-cursor@3.1.0(transitive)
- Removedrun-async@3.0.0(transitive)
- Removedrxjs@7.8.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtmp@0.0.33(transitive)
- Removedtype-fest@0.21.3(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwcwidth@1.0.1(transitive)
- Removedwrap-ansi@6.2.0(transitive)
- Removedyoctocolors-cjs@2.1.2(transitive)