Comparing version 0.1.14 to 0.1.15
@@ -24,2 +24,5 @@ { | ||
}, | ||
"globals": { | ||
"fetch": true | ||
}, | ||
"rules": { | ||
@@ -26,0 +29,0 @@ "@typescript-eslint/explicit-module-boundary-types": ["warn"], |
@@ -1,2 +0,2 @@ | ||
import fetch from "node-fetch"; | ||
import fetch from "isomorphic-fetch"; | ||
import * as t from "io-ts"; | ||
@@ -24,3 +24,3 @@ | ||
body: JSON.stringify({ files_list: files }), | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -51,3 +51,3 @@ if (!GenerateResponse.is(res)) { | ||
}, | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -73,3 +73,3 @@ if (!ProgressResponse.is(res)) { | ||
body: JSON.stringify({ doc_id: docId }), | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -96,3 +96,3 @@ if (!GenerateResponse.is(res)) { | ||
}, | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -119,3 +119,3 @@ if (!StructureResponse.is(res)) { | ||
}, | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -142,3 +142,3 @@ if (!OverviewResponse.is(res)) { | ||
}, | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -176,3 +176,3 @@ if (!GettingStartedResponse.is(res)) { | ||
body: JSON.stringify({ doc_id: docId, name, domain }), | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -179,0 +179,0 @@ if (!DeployResponse.is(res)) { |
@@ -24,3 +24,3 @@ import { generateWithType, t } from "../lib/index"; | ||
{ | ||
provider: "cohere", | ||
provider: "openai", | ||
}, | ||
@@ -27,0 +27,0 @@ ), |
@@ -1,2 +0,2 @@ | ||
import fetch from "node-fetch"; | ||
import fetch from "isomorphic-fetch"; | ||
import * as t from "io-ts"; | ||
@@ -51,3 +51,3 @@ import { ensurePolyfactToken } from "./helpers/ensurePolyfactToken"; | ||
const res = await fetch(`${POLYFACT_ENDPOINT}/generate`, { | ||
const resJSON = await fetch(`${POLYFACT_ENDPOINT}/generate`, { | ||
method: "POST", | ||
@@ -59,4 +59,8 @@ headers: { | ||
body: JSON.stringify(requestBody), | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.text()); | ||
console.log(resJSON); | ||
const res = JSON.parse(resJSON); | ||
if (!ResultType.is(res)) { | ||
@@ -63,0 +67,0 @@ throw new GenerationError(); |
@@ -1,2 +0,2 @@ | ||
import fetch from "node-fetch"; | ||
import fetch from "isomorphic-fetch"; | ||
import { ensurePolyfactToken } from "./helpers/ensurePolyfactToken"; | ||
@@ -31,3 +31,3 @@ | ||
}, | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -43,3 +43,7 @@ return res; | ||
async function updateMemory(id: string, input: string): Promise<{ success: boolean }> { | ||
async function updateMemory( | ||
id: string, | ||
input: string, | ||
maxToken = 0, | ||
): Promise<{ success: boolean }> { | ||
ensurePolyfactToken(); | ||
@@ -57,4 +61,5 @@ | ||
input, | ||
max_token: maxToken, | ||
}), | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -80,3 +85,3 @@ return res; | ||
}, | ||
}).then((res) => res.json()); | ||
}).then((res: any) => res.json()); | ||
@@ -83,0 +88,0 @@ return res; |
@@ -1,2 +0,2 @@ | ||
import fetch, { Blob } from "node-fetch"; | ||
import fetch from "isomorphic-fetch"; | ||
import FormData from "form-data"; | ||
@@ -13,3 +13,3 @@ import { Readable } from "stream"; | ||
export async function transcribe(file: Blob | Buffer | Readable): Promise<string> { | ||
export async function transcribe(file: Buffer | Readable): Promise<string> { | ||
if (!POLYFACT_TOKEN) { | ||
@@ -32,4 +32,4 @@ throw new Error( | ||
}, | ||
body: formData, | ||
}).then((res) => res.json()); | ||
body: formData as any, | ||
}).then((res: any) => res.json()); | ||
@@ -36,0 +36,0 @@ if (ResultType.is(res)) { |
{ | ||
"name": "polyfact", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"main": "dist/index.js", | ||
@@ -13,4 +13,4 @@ "types": "dist/index.d.ts", | ||
"io-ts": "^2.2.20", | ||
"isomorphic-fetch": "^3.0.0", | ||
"js-tiktoken": "^1.0.7", | ||
"node-fetch": "^2.6.1", | ||
"ts-node": "^10.9.1" | ||
@@ -21,3 +21,3 @@ }, | ||
"@types/node": "^14.14.31", | ||
"@types/node-fetch": "^2.6.4", | ||
"@types/isomorphic-fetch": "^0.0.36", | ||
"@typescript-eslint/eslint-plugin": "^4.14.1", | ||
@@ -24,0 +24,0 @@ "@typescript-eslint/parser": "^4.14.1", |
{ | ||
"compilerOptions": { | ||
"target": "es2021", | ||
"lib": ["es2021"], | ||
"lib": [ | ||
"es2021", | ||
"DOM", | ||
], | ||
"module": "commonjs", | ||
@@ -6,0 +9,0 @@ "strict": true, |
871217
47
1579
+ Addedisomorphic-fetch@^3.0.0
+ Addedisomorphic-fetch@3.0.0(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
- Removednode-fetch@^2.6.1