@surfaceapi/langchain 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,12 +8,12 @@ Surface by Canada Site Ops. Ontario, Canada.
|
|
|
8
8
|
|
|
9
9
|
## Get a free API key in about 10 seconds
|
|
10
10
|
|
|
11
|
-
No email, no card. Then set `SURFACE_API_KEY`, or pass `apiKey`. The tool sends it as `Authorization: Bearer <key>`.
|
|
11
|
+
No email, no card. Then set `SURFACE_KEY` or `SURFACE_API_KEY`, or pass `apiKey`. The tool sends it as `Authorization: Bearer <key>`.
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
curl -s -X POST https://nova-otter-delta-cloud.grok.me/v1/keys
|
|
15
15
|
# returns {"key","created_at","free_monthly":1000000,"usage_url"}
|
|
16
|
-
export
|
|
16
|
+
export SURFACE_KEY=... # or SURFACE_API_KEY; paste the key value
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
A key gets its own million free requests a month. Anonymous calls still work on a shared demo limit.
|
package/index.js
CHANGED
|
@@ -11,13 +11,13 @@ const env = (k) => (typeof process !== "undefined" && process.env ? process.env[
|
|
|
11
11
|
|
|
12
12
|
export async function preflight(url, { apiKey, baseUrl, headers, timeoutMs = 15000 } = {}) {
|
|
13
13
|
const base = (baseUrl || env("SURFACE_BASE_URL") || DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
14
|
-
const key = apiKey || env("SURFACE_API_KEY");
|
|
14
|
+
const key = apiKey || env("SURFACE_KEY") || env("SURFACE_API_KEY");
|
|
15
15
|
const res = await fetch(base + "/v1/preflight", {
|
|
16
16
|
method: "POST",
|
|
17
17
|
headers: {
|
|
18
18
|
"content-type": "application/json",
|
|
19
19
|
accept: "application/json",
|
|
20
|
-
"user-agent": "@surfaceapi/langchain/0.1.
|
|
20
|
+
"user-agent": "@surfaceapi/langchain/0.1.2",
|
|
21
21
|
...(key ? { authorization: "Bearer " + key } : {}),
|
|
22
22
|
...(headers || {}),
|
|
23
23
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surfaceapi/langchain",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Surface for langchain: the link-safety layer between an AI agent and the open web. One tool, surface_preflight, that answers fetch or skip without returning the page.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|