cencori 1.5.0 → 1.6.1
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -2
- package/dist/index.mjs.map +1 -1
- package/dist/web/index.d.mts +80 -2
- package/dist/web/index.d.ts +80 -2
- package/dist/web/index.js +28 -1
- package/dist/web/index.js.map +1 -1
- package/dist/web/index.mjs +28 -1
- package/dist/web/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -16,7 +16,7 @@ export { EntitiesResult, FetchedMemory, ForgetSuggestionsOptions, ForgetSuggesti
|
|
|
16
16
|
import { TelemetryClient } from './telemetry/index.mjs';
|
|
17
17
|
export { WebTelemetryPayload } from './telemetry/index.mjs';
|
|
18
18
|
import { WebNamespace } from './web/index.mjs';
|
|
19
|
-
export { WEB_FETCH_TOOL, WEB_SEARCH_TOOL, WebCrawlRequest, WebCrawlResponse, WebEvidenceSpan, WebExtractResult, WebFetchRequest, WebFetchResult, WebLink, WebSearchHit, WebSearchRequest, WebSearchResponse } from './web/index.mjs';
|
|
19
|
+
export { WEB_FETCH_TOOL, WEB_SEARCH_TOOL, WebBrowseJob, WebBrowseRequest, WebBrowserAction, WebCrawlRequest, WebCrawlResponse, WebEvidenceSpan, WebExtractResult, WebFetchRequest, WebFetchResult, WebLink, WebSearchHit, WebSearchRequest, WebSearchResponse, WebTakedownRequest, WebTakedownResponse } from './web/index.mjs';
|
|
20
20
|
export { CencoriChatSettings, CencoriProvider, CencoriProviderSettings, cencori, createCencori } from './vercel/index.mjs';
|
|
21
21
|
import '@ai-sdk/provider';
|
|
22
22
|
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { EntitiesResult, FetchedMemory, ForgetSuggestionsOptions, ForgetSuggesti
|
|
|
16
16
|
import { TelemetryClient } from './telemetry/index.js';
|
|
17
17
|
export { WebTelemetryPayload } from './telemetry/index.js';
|
|
18
18
|
import { WebNamespace } from './web/index.js';
|
|
19
|
-
export { WEB_FETCH_TOOL, WEB_SEARCH_TOOL, WebCrawlRequest, WebCrawlResponse, WebEvidenceSpan, WebExtractResult, WebFetchRequest, WebFetchResult, WebLink, WebSearchHit, WebSearchRequest, WebSearchResponse } from './web/index.js';
|
|
19
|
+
export { WEB_FETCH_TOOL, WEB_SEARCH_TOOL, WebBrowseJob, WebBrowseRequest, WebBrowserAction, WebCrawlRequest, WebCrawlResponse, WebEvidenceSpan, WebExtractResult, WebFetchRequest, WebFetchResult, WebLink, WebSearchHit, WebSearchRequest, WebSearchResponse, WebTakedownRequest, WebTakedownResponse } from './web/index.js';
|
|
20
20
|
export { CencoriChatSettings, CencoriProvider, CencoriProviderSettings, cencori, createCencori } from './vercel/index.js';
|
|
21
21
|
import '@ai-sdk/provider';
|
|
22
22
|
|
package/dist/index.js
CHANGED
|
@@ -1712,7 +1712,8 @@ var WEB_SEARCH_TOOL = {
|
|
|
1712
1712
|
query: { type: "string", description: "The web search query." },
|
|
1713
1713
|
limit: { type: "integer", minimum: 1, maximum: 50 },
|
|
1714
1714
|
domain: { type: "string", description: "Optional hostname to restrict results to." },
|
|
1715
|
-
freshness: { type: "string", description: "Optional ISO timestamp or duration such as 7d." }
|
|
1715
|
+
freshness: { type: "string", description: "Optional ISO timestamp or duration such as 7d." },
|
|
1716
|
+
language: { type: "string", description: "Optional BCP 47 language tag such as en." }
|
|
1716
1717
|
},
|
|
1717
1718
|
required: ["query"],
|
|
1718
1719
|
additionalProperties: false
|
|
@@ -1754,6 +1755,19 @@ var WebNamespace = class {
|
|
|
1754
1755
|
search(request) {
|
|
1755
1756
|
return this.post("/api/v1/web/search", request);
|
|
1756
1757
|
}
|
|
1758
|
+
/** Queue an isolated JavaScript browser exploration on Cencori-owned workers. */
|
|
1759
|
+
browse(request) {
|
|
1760
|
+
return this.post("/api/v1/web/browse", request);
|
|
1761
|
+
}
|
|
1762
|
+
/** Poll an isolated browser exploration until it completes or fails. */
|
|
1763
|
+
browserJob(id) {
|
|
1764
|
+
if (!id.trim()) throw new Error("Browser job id is required");
|
|
1765
|
+
return this.get(`/api/v1/web/browse/${encodeURIComponent(id)}`);
|
|
1766
|
+
}
|
|
1767
|
+
/** Submit a copyright, privacy, legal, robots, or other removal request. */
|
|
1768
|
+
requestTakedown(request) {
|
|
1769
|
+
return this.post("/api/v1/web/takedown", request);
|
|
1770
|
+
}
|
|
1757
1771
|
executeTool(name, args) {
|
|
1758
1772
|
if (name === "web_search") return this.search(args);
|
|
1759
1773
|
if (name === "web_fetch") return this.extract(args);
|
|
@@ -1781,6 +1795,19 @@ var WebNamespace = class {
|
|
|
1781
1795
|
}
|
|
1782
1796
|
return data;
|
|
1783
1797
|
}
|
|
1798
|
+
async get(path) {
|
|
1799
|
+
const response = await fetch(`${this.config.baseUrl}${path}`, {
|
|
1800
|
+
headers: { "CENCORI_API_KEY": this.config.apiKey, ...this.config.headers }
|
|
1801
|
+
});
|
|
1802
|
+
const data = await response.json();
|
|
1803
|
+
if (!response.ok) {
|
|
1804
|
+
const payload = data && typeof data === "object" ? data : {};
|
|
1805
|
+
const error = new Error(typeof payload.message === "string" ? payload.message : `Web request failed with status ${response.status}`);
|
|
1806
|
+
error.code = typeof payload.error === "string" ? payload.error : "request_failed";
|
|
1807
|
+
throw error;
|
|
1808
|
+
}
|
|
1809
|
+
return data;
|
|
1810
|
+
}
|
|
1784
1811
|
};
|
|
1785
1812
|
|
|
1786
1813
|
// src/utils.ts
|
|
@@ -1845,7 +1872,7 @@ var SafetyError = class _SafetyError extends CencoriError {
|
|
|
1845
1872
|
};
|
|
1846
1873
|
|
|
1847
1874
|
// src/cencori.ts
|
|
1848
|
-
var DEFAULT_BASE_URL = "https://
|
|
1875
|
+
var DEFAULT_BASE_URL = "https://cencori.com";
|
|
1849
1876
|
var Cencori = class {
|
|
1850
1877
|
/**
|
|
1851
1878
|
* Create a new Cencori client
|